From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44372C4338F for ; Wed, 18 Aug 2021 01:45:44 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8143A60F38 for ; Wed, 18 Aug 2021 01:45:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8143A60F38 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 16DF682039; Wed, 18 Aug 2021 03:45:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ACyreJoT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09FA282039; Wed, 18 Aug 2021 03:45:41 +0200 (CEST) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D345982BEC for ; Wed, 18 Aug 2021 03:45:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x52d.google.com with SMTP id 17so598544pgp.4 for ; Tue, 17 Aug 2021 18:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=k40j6dnaEUvkxM1dS7R3p9fUCrQ2wQ4M+N7NRDaAsw0=; b=ACyreJoT6lL9Wftl5zvdya5ocuuxu+baOuYMonKnIM99bzfbHUj1O6e6gZ1khnqNX0 XNs+fohXKWjJthfpV0NKNloMLbhVUOG2o1r1EP1ELOnrUVd3VlD8flThEANf6njHkDO4 l0aeRWoav67xVa+qlTNAIOYfh28F3eB4o3gCj7XfBLDYu9wgo3rsNO6KCTP4WTeNVH9j RnvkTJSGxATN/szJ3TkKcE4hCshXI4oucpaUr6zMYgd3Uk9UWYjNAH7WZsGYQCzv44r3 XMojtm5pAO0rkLScw9Oour/ThGbYtXARfndnveJfOJR2vYlYoq72gtggfdTUL19dCh7N U7WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=k40j6dnaEUvkxM1dS7R3p9fUCrQ2wQ4M+N7NRDaAsw0=; b=Y7B+ykjUbqgvZCL7GLg2AfctWtzA6UAjr22ru6HyseDyYTlon/xhWSbupWIMHKTLCK 0Sl4AOapZ+++/3NACo7v2nDqN0O1nM5kSODzSH34nq7E6B4wwHygZztDs0M8MYpgQ+vt l4hR7lm1aS0jgXLXTwUtPA5v04mhr7gKMpnQjk4ep/KROZjeeL8hDkFOyh1vgPtx1Iko 4Z5NadSvTMPamk60PPPZk3Vm7ngWuPAu7vDhjUBcMi2QFsPzZyBp3RYcxGgKcITadm/9 iCQkqeJBVvP2x+Sb+Dj1AOIwoJ3NLaenIzFg4f+A+HA5pl9fRDoHptEHzX5fEfPIsVWp YmnA== X-Gm-Message-State: AOAM533cMlFfxWnH5+v0+ex9DFjMtrQMG0VJD3hwX3qsRcw9bNushE8O YwWNVKstj6aiyS7Zm/vSQ1d2sQ== X-Google-Smtp-Source: ABdhPJzc28bdO/M4Ie3HroyVT+VFoAQSXoCQoTnOYKk7RedwHQXokk3dLMK/ezM+O9pjvHmTyWnIFg== X-Received: by 2002:a65:5a49:: with SMTP id z9mr6244568pgs.121.1629251132657; Tue, 17 Aug 2021 18:45:32 -0700 (PDT) Received: from laputa (pdb6272e8.tkyea130.ap.so-net.ne.jp. [219.98.114.232]) by smtp.gmail.com with ESMTPSA id fv2sm3146708pjb.53.2021.08.17.18.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 18:45:32 -0700 (PDT) Date: Wed, 18 Aug 2021 10:45:28 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Alexander Graf , Heinrich Schuchardt , Bin Meng , Simon Glass Subject: Re: [PATCH 3/5] efi_loader: use correct type for AllocatePages, AllocatePool Message-ID: <20210818014528.GB39588@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, Alexander Graf , Heinrich Schuchardt , Bin Meng , Simon Glass References: <20210817160225.222760-1-heinrich.schuchardt@canonical.com> <20210817160225.222760-4-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210817160225.222760-4-heinrich.schuchardt@canonical.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Heinrich, On Tue, Aug 17, 2021 at 06:02:23PM +0200, Heinrich Schuchardt wrote: > Use enum efi_memory_type and enum_allocate_type in the definitions of the > efi_allocate_pages(), efi_allocate_pool(). > > In the external UEFI API leave the type as int as the UEFI specification > explicitly requires that enums use a 32bit type. > > Signed-off-by: Heinrich Schuchardt > --- > include/efi_loader.h | 9 +++++---- > lib/efi_loader/efi_memory.c | 5 +++-- > 2 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/include/efi_loader.h b/include/efi_loader.h > index 32cb8d0f1e..c440962fe5 100644 > --- a/include/efi_loader.h > +++ b/include/efi_loader.h > @@ -676,13 +676,14 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid); > /* Generic EFI memory allocator, call this to get memory */ > void *efi_alloc(uint64_t len, int memory_type); > /* More specific EFI memory allocator, called by EFI payloads */ > -efi_status_t efi_allocate_pages(int type, int memory_type, efi_uintn_t pages, > - uint64_t *memory); > +efi_status_t efi_allocate_pages(enum efi_allocate_type type, > + enum efi_memory_type memory_type, > + efi_uintn_t pages, uint64_t *memory); > /* EFI memory free function. */ > efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages); > /* EFI memory allocator for small allocations */ > -efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, > - void **buffer); > +efi_status_t efi_allocate_pool(enum efi_memory_type pool_type, > + efi_uintn_t size, void **buffer); > /* EFI pool memory free function. */ > efi_status_t efi_free_pool(void *buffer); > /* Returns the EFI memory map */ > diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c > index be2f655dff..f4acbee4f9 100644 > --- a/lib/efi_loader/efi_memory.c > +++ b/lib/efi_loader/efi_memory.c > @@ -454,7 +454,8 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr) > * @memory allocated memory > * @return status code > */ > -efi_status_t efi_allocate_pages(int type, int memory_type, > +efi_status_t efi_allocate_pages(enum efi_allocate_type type, > + enum efi_memory_type memory_type, > efi_uintn_t pages, uint64_t *memory) > { > u64 len = pages << EFI_PAGE_SHIFT; > @@ -556,7 +557,7 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages) > * @buffer: allocated memory > * Return: status code > */ > -efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer) > +efi_status_t efi_allocate_pool(enum efi_memory_type pool_type, efi_uintn_t size, void **buffer) Given the purpose of this patch series, I think that the second argument of this function should be renamed from "pool_type" to "memory_type" which is also used in efi_allocate_pages() to avoid any confusion. (and the description for @pool_type as well) Otherwise, it looks good. -Takahiro Akashi > { > efi_status_t r; > u64 addr; > -- > 2.30.2 >