From patchwork Sun Dec 17 15:43:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 849638 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3z07pt43ydz9sR8 for ; Mon, 18 Dec 2017 02:47:50 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 12649C21FEC; Sun, 17 Dec 2017 15:46:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7CEB1C21FC5; Sun, 17 Dec 2017 15:45:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 802A4C21F29; Sun, 17 Dec 2017 15:45:15 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id 50FEAC21FBF for ; Sun, 17 Dec 2017 15:45:11 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx103 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MLelb-1eQK8r09it-000pdU; Sun, 17 Dec 2017 16:45:10 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 17 Dec 2017 16:43:30 +0100 Message-Id: <20171217154342.15469-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171217154342.15469-1-xypron.glpk@gmx.de> References: <20171217154342.15469-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:bR+bh7xwjMgvXYhEjU9VLv7/EpB2IDrv2bNFftI+n+g44FEtI8U 3loAu7dojlgfIxaE4FsxXy0lMGhOyjClfI66q1IFaUttTPRqC1LD6REOqnDH9G66XDS0p7p hhzD3SZqqiaR6gKJp7xZZMPO9oHhsw/lT7ZRwz7bAQtd5OFOJKKhDegmrzUVcnJR4Xsk0j7 GxsINOEycOvn7l9KifVvA== X-UI-Out-Filterresults: notjunk:1; V01:K0:N5MQRtQOT0M=:4LRGezSbvBph/w82Bln+8+ /6dvPicGq1D+K8RWvYG6GwU9eutEnnTmnOICQHoX95qFQauwXnXMbYkDJZKVcA5VQEnj0WFYT N1DRC7rAJg03omtp/DonvS3GaAPfTzOrsr2BBCjMzS0ywQz4gW+79crvPOrVpzGsdvVIKr/wr 6X6Taq/37gpP7rdRLmf0jM/DYJ8au2gGt5Yz+EtHqQNYogYmJWajAh1FfWOGXHFNK3iWC/j9n OgxnCIheX2iu2+kl3gE1AJhCpTVnt7V27P6XRggjh02vRiXKpE4mRfkZWvrpyo/KKs8eckoBf njs0oBAwxu+xb3xMVb6zoAN/W820woIFusamrXiISA09k17vkphxq7h3+b7nv3u2Am/FHCKat eXEOVyLDS2iVHZ21SQmVX6Er2cONlVImBLZUSrtjg0O43MPZ1stP4Rq4Q/N683RAXem1ftOjK S1JY9bzKh4Z2LVzAG1IpukOJltERCM0kraNK7qpmf/RGp0gjlhDhAImedFf6OAM+l/ace7uEl pXXljWdzqrV2NY9nIk7Jjz8vq/ckV2gpguZQwwlx3xRIOiSXm+DE/q1sszuFOYxqFHvNeedfe U5AoWL7o/K0SgMAWRYcHkZaCuGzQQWT879C5tmpjcylYErzDMZ6kP1KZI08K9OrWChbf50rmx m8i+OUMjlqNY8AReU3UaOjvd4UySV3znNR0QcUxohscbdM9Q/Kr4P3szli3f18JxpSbvEzIR5 D2+WC4eq+JHJ7ybzyt6lYvUsV884hb60vbzeI5JOvgBTyyhejeIHnpusymxxlc/+HMO89m99S enmZyUVu4dXITPncl4s3X+Xw5p5tg== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH 04/16] efi_loader: list of open protocol infos X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add a list of open protocol infos to each protocol of a handle. Provide helper functions to access the list items. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/efi_loader.h | 15 ++++++++++++++- lib/efi_loader/efi_boottime.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 6185055e78..637e6e166d 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -96,15 +96,28 @@ extern const efi_guid_t efi_file_info_guid; extern unsigned int __efi_runtime_start, __efi_runtime_stop; extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop; +/* + * When a protocol is opened a open protocol info entry is created. + * These are maintained in a list. + */ +struct efi_open_protocol_info_item { + /* Link to the list of open protocol info entries of a protocol */ + struct list_head link; + struct efi_open_protocol_info_entry info; +}; + /* * When the UEFI payload wants to open a protocol on an object to get its * interface (usually a struct with callback functions), this struct maps the - * protocol GUID to the respective protocol interface */ + * protocol GUID to the respective protocol interface + */ struct efi_handler { /* Link to the list of protocols of a handle */ struct list_head link; const efi_guid_t *guid; void *protocol_interface; + /* Link to the list of open protocol info items */ + struct list_head open_infos; }; /* diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 99eb36c306..f5ec2a8866 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -814,6 +814,40 @@ struct efi_object *efi_search_obj(const void *handle) return NULL; } +/* + * Create open protocol info entry and add it to a protocol. + * + * @handler handler of a protocol + * @return open protocol info entry + */ +static struct efi_open_protocol_info_entry *efi_create_open_info( + struct efi_handler *handler) +{ + struct efi_open_protocol_info_item *item; + + item = calloc(1, sizeof(struct efi_open_protocol_info_item)); + if (!item) + return NULL; + /* Append the item to the open protocol info list. */ + list_add_tail(&item->link, &handler->open_infos); + + return &item->info; +} + +/* + * Remove an open protocol info entry from a protocol. + * + * @handler handler of a protocol + * @return status code + */ +static efi_status_t efi_delete_open_info( + struct efi_open_protocol_info_item *item) +{ + list_del(&item->link); + free(item); + return EFI_SUCCESS; +} + /* * Install new protocol on a handle. * @@ -840,6 +874,7 @@ efi_status_t efi_add_protocol(const void *handle, const efi_guid_t *protocol, return EFI_OUT_OF_RESOURCES; handler->guid = protocol; handler->protocol_interface = protocol_interface; + INIT_LIST_HEAD(&handler->open_infos); list_add_tail(&handler->link, &efiobj->protocols); return EFI_SUCCESS; }