Re: [edk2-devel] [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib
On Sun, 26 Jun 2022 at 05:06, Min Xu wrote: > > From: Min M Xu > > AllocateRuntimePages is used to allocate one or more 4KB pages of > type EfiRuntimeServicesData. > > Cc: Leif Lindholm > Cc: Ard Biesheuvel > Cc: Abner Chang > Cc: Daniel Schaefer > Cc: Gerd Hoffmann > Signed-off-by: Min Xu Reviewed-by: Ard Biesheuvel > --- > EmbeddedPkg/Include/Library/PrePiLib.h| 19 ++ > .../MemoryAllocationLib.c | 64 ++- > 2 files changed, 67 insertions(+), 16 deletions(-) > > diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h > b/EmbeddedPkg/Include/Library/PrePiLib.h > index 7b2cea296f1c..3741b08c4478 100644 > --- a/EmbeddedPkg/Include/Library/PrePiLib.h > +++ b/EmbeddedPkg/Include/Library/PrePiLib.h > @@ -665,6 +665,25 @@ AllocatePages ( >IN UINTN Pages >); > > +/** > + Allocates one or more 4KB pages of type EfiRuntimeServicesData. > + > + Allocates the number of 4KB pages of type EfiRuntimeServicesData and > returns a pointer to the > + allocated buffer. The buffer returned is aligned on a 4KB boundary. If > Pages is 0, then NULL > + is returned. If there is not enough memory remaining to satisfy the > request, then NULL is > + returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocateRuntimePages ( > + IN UINTN Pages > + ); > + > /** >Allocates a buffer of type EfiBootServicesData. > > diff --git > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > index 78f8da5e9527..9d7b34ad28fa 100644 > --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > @@ -14,23 +14,11 @@ > #include > #include > > -/** > - Allocates one or more 4KB pages of type EfiBootServicesData. > - > - Allocates the number of 4KB pages of MemoryType and returns a pointer to > the > - allocated buffer. The buffer returned is aligned on a 4KB boundary. If > Pages is 0, then NULL > - is returned. If there is not enough memory remaining to satisfy the > request, then NULL is > - returned. > - > - @param Pages The number of 4 KB pages to allocate. > - > - @return A pointer to the allocated buffer or NULL if allocation fails. > - > -**/ > VOID * > EFIAPI > -AllocatePages ( > - IN UINTN Pages > +InternalAllocatePages ( > + IN UINTNPages, > + IN EFI_MEMORY_TYPE MemoryType >) > { >EFI_PEI_HOB_POINTERS Hob; > @@ -65,12 +53,56 @@ AllocatePages ( > BuildMemoryAllocationHob ( >Hob.HandoffInformationTable->EfiFreeMemoryTop, >Pages * EFI_PAGE_SIZE, > - EfiBootServicesData > + MemoryType >); > return (VOID *)(UINTN)Hob.HandoffInformationTable->EfiFreeMemoryTop; >} > } > > +/** > + Allocates one or more 4KB pages of type EfiBootServicesData. > + > + Allocates the number of 4KB pages of MemoryType and returns a pointer to > the > + allocated buffer. The buffer returned is aligned on a 4KB boundary. If > Pages is 0, then NULL > + is returned. If there is not enough memory remaining to satisfy the > request, then NULL is > + returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocatePages ( > + IN UINTN Pages > + ) > +{ > + return InternalAllocatePages (Pages, EfiBootServicesData); > +} > + > +/** > + Allocates one or more 4KB pages of type EfiRuntimeServicesData. > + > + Allocates the number of 4KB pages of type EfiRuntimeServicesData and > returns a pointer to the > + allocated buffer. The buffer returned is aligned on a 4KB boundary. If > Pages is 0, then NULL > + is returned. If there is not enough memory remaining to satisfy the > request, then NULL is > + returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocateRuntimePages ( > + IN UINTN Pages > + ) > +{ > + return InternalAllocatePages (Pages, EfiRuntimeServicesData); > +} > + > /** >Allocates one or more 4KB pages of type EfiBootServicesData at a specified > alignment. > > -- > 2.29.2.windows.2 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#92078): https://edk2.groups.io/g/devel/message/92078 Mute This Topic: https://groups.io/mt/91995190/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib
Hi, Leif/Ard/Abner/Daniel Since you're maintainers/reviewers of EmbeddedPkg. Do you have any comments to this patch? The same reminder mail has been sent out two weeks ago but no response is received. Or anyone else can comment on this patch? Thanks much! Min > -Original Message- > From: Xu, Min M > Sent: Wednesday, July 20, 2022 4:50 PM > To: devel@edk2.groups.io; Leif Lindholm ; Ard Biesheuvel > ; Chang, Abner ; > Schaefer, Daniel > Cc: Gerd Hoffmann ; Xu, Min M > Subject: RE: [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in > PrePiMemoryAllocationLib > > Hi, Leif/Ard/Abner/Daniel > Since you're maintainers/reviewers of EmbeddedPkg. Do you have any > comments to this patch? > > Thanks > Min > > > -Original Message- > > From: Xu, Min M > > Sent: Sunday, June 26, 2022 11:06 AM > > To: devel@edk2.groups.io > > Cc: Xu, Min M ; Leif Lindholm > > ; Ard Biesheuvel > > ; Chang, Abner ; > > Schaefer, Daniel ; Gerd Hoffmann > > > > Subject: [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in > > PrePiMemoryAllocationLib > > > > From: Min M Xu > > > > AllocateRuntimePages is used to allocate one or more 4KB pages of type > > EfiRuntimeServicesData. > > > > Cc: Leif Lindholm > > Cc: Ard Biesheuvel > > Cc: Abner Chang > > Cc: Daniel Schaefer > > Cc: Gerd Hoffmann > > Signed-off-by: Min Xu > > --- > > EmbeddedPkg/Include/Library/PrePiLib.h| 19 ++ > > .../MemoryAllocationLib.c | 64 ++- > > 2 files changed, 67 insertions(+), 16 deletions(-) > > > > diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h > > b/EmbeddedPkg/Include/Library/PrePiLib.h > > index 7b2cea296f1c..3741b08c4478 100644 > > --- a/EmbeddedPkg/Include/Library/PrePiLib.h > > +++ b/EmbeddedPkg/Include/Library/PrePiLib.h > > @@ -665,6 +665,25 @@ AllocatePages ( > >IN UINTN Pages > >); > > > > +/** > > + Allocates one or more 4KB pages of type EfiRuntimeServicesData. > > + > > + Allocates the number of 4KB pages of type EfiRuntimeServicesData > > + and returns a pointer to the allocated buffer. The buffer returned > > + is aligned on a 4KB boundary. If Pages is 0, then NULL is > > + returned. If there is not enough memory remaining to satisfy the > > + request, then NULL is > > returned. > > + > > + @param Pages The number of 4 KB pages to allocate. > > + > > + @return A pointer to the allocated buffer or NULL if allocation fails. > > + > > +**/ > > +VOID * > > +EFIAPI > > +AllocateRuntimePages ( > > + IN UINTN Pages > > + ); > > + > > /** > >Allocates a buffer of type EfiBootServicesData. > > > > diff --git > > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > > index 78f8da5e9527..9d7b34ad28fa 100644 > > --- > > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > > +++ > > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > > @@ -14,23 +14,11 @@ > > #include > > #include > > > > -/** > > - Allocates one or more 4KB pages of type EfiBootServicesData. > > - > > - Allocates the number of 4KB pages of MemoryType and returns a > > pointer to the > > - allocated buffer. The buffer returned is aligned on a 4KB > > boundary. If Pages is 0, then NULL > > - is returned. If there is not enough memory remaining to satisfy > > the request, then NULL is > > - returned. > > - > > - @param Pages The number of 4 KB pages to allocate. > > - > > - @return A pointer to the allocated buffer or NULL if allocation fails. > > - > > -**/ > > VOID * > > EFIAPI > > -AllocatePages ( > > - IN UINTN Pages > > +InternalAllocatePages ( > > + IN UINTNPages, > > + IN EFI_MEMORY_TYPE MemoryType > >) > > { > >EFI_PEI_HOB_POINTERS Hob; > > @@ -65,12 +53,56 @@ AllocatePages ( > > BuildMemoryAllocationHob ( > >Hob.HandoffInformationTable->EfiFreeMemoryTop, > >Pages * EFI_PAGE_SIZE, > > - EfiBootServicesData > > + MemoryType > >); > > return (VOID *)(UINTN)Hob.HandoffInformationTable- > > >EfiFreeMemoryTop; > >} > > } > > > > +/** > > + Allocates one or more 4KB pages of type EfiBootServicesData. > > + > > + Allocates the number of 4KB pages of MemoryType and returns a > > + pointer to the allocated buffer. The buffer returned is aligned on > > + a 4KB boundary. If Pages is 0, then NULL is returned. If there is > > + not enough memory remaining to satisfy the request, then NULL is > returned. > > + > > + @param Pages The number of 4 KB pages to allocate. > > + > > + @return A pointer to the allocated buffer or NULL if allocation fails. > > + > > +**/ > > +VOID * > > +EFIAPI > > +AllocatePages ( > > + IN UINTN Pages > > + ) > > +{ > > + return InternalAllocatePages (Pages, EfiBootServicesData); } > > + > > +/** > > + Allocates one or more 4KB pages of type EfiRuntimeServicesData. > > + > > +
Re: [edk2-devel] [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib
Hi, Leif/Ard/Abner/Daniel Since you're maintainers/reviewers of EmbeddedPkg. Do you have any comments to this patch? Thanks Min > -Original Message- > From: Xu, Min M > Sent: Sunday, June 26, 2022 11:06 AM > To: devel@edk2.groups.io > Cc: Xu, Min M ; Leif Lindholm > ; Ard Biesheuvel ; > Chang, Abner ; Schaefer, Daniel > ; Gerd Hoffmann > Subject: [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in > PrePiMemoryAllocationLib > > From: Min M Xu > > AllocateRuntimePages is used to allocate one or more 4KB pages of type > EfiRuntimeServicesData. > > Cc: Leif Lindholm > Cc: Ard Biesheuvel > Cc: Abner Chang > Cc: Daniel Schaefer > Cc: Gerd Hoffmann > Signed-off-by: Min Xu > --- > EmbeddedPkg/Include/Library/PrePiLib.h| 19 ++ > .../MemoryAllocationLib.c | 64 ++- > 2 files changed, 67 insertions(+), 16 deletions(-) > > diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h > b/EmbeddedPkg/Include/Library/PrePiLib.h > index 7b2cea296f1c..3741b08c4478 100644 > --- a/EmbeddedPkg/Include/Library/PrePiLib.h > +++ b/EmbeddedPkg/Include/Library/PrePiLib.h > @@ -665,6 +665,25 @@ AllocatePages ( >IN UINTN Pages >); > > +/** > + Allocates one or more 4KB pages of type EfiRuntimeServicesData. > + > + Allocates the number of 4KB pages of type EfiRuntimeServicesData and > + returns a pointer to the allocated buffer. The buffer returned is > + aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If > + there is not enough memory remaining to satisfy the request, then NULL is > returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocateRuntimePages ( > + IN UINTN Pages > + ); > + > /** >Allocates a buffer of type EfiBootServicesData. > > diff --git > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > index 78f8da5e9527..9d7b34ad28fa 100644 > --- > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > +++ > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > @@ -14,23 +14,11 @@ > #include > #include > > -/** > - Allocates one or more 4KB pages of type EfiBootServicesData. > - > - Allocates the number of 4KB pages of MemoryType and returns a pointer > to the > - allocated buffer. The buffer returned is aligned on a 4KB boundary. If > Pages is 0, then NULL > - is returned. If there is not enough memory remaining to satisfy the > request, then NULL is > - returned. > - > - @param Pages The number of 4 KB pages to allocate. > - > - @return A pointer to the allocated buffer or NULL if allocation fails. > - > -**/ > VOID * > EFIAPI > -AllocatePages ( > - IN UINTN Pages > +InternalAllocatePages ( > + IN UINTNPages, > + IN EFI_MEMORY_TYPE MemoryType >) > { >EFI_PEI_HOB_POINTERS Hob; > @@ -65,12 +53,56 @@ AllocatePages ( > BuildMemoryAllocationHob ( >Hob.HandoffInformationTable->EfiFreeMemoryTop, >Pages * EFI_PAGE_SIZE, > - EfiBootServicesData > + MemoryType >); > return (VOID *)(UINTN)Hob.HandoffInformationTable- > >EfiFreeMemoryTop; >} > } > > +/** > + Allocates one or more 4KB pages of type EfiBootServicesData. > + > + Allocates the number of 4KB pages of MemoryType and returns a pointer > + to the allocated buffer. The buffer returned is aligned on a 4KB > + boundary. If Pages is 0, then NULL is returned. If there is not > + enough memory remaining to satisfy the request, then NULL is returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocatePages ( > + IN UINTN Pages > + ) > +{ > + return InternalAllocatePages (Pages, EfiBootServicesData); } > + > +/** > + Allocates one or more 4KB pages of type EfiRuntimeServicesData. > + > + Allocates the number of 4KB pages of type EfiRuntimeServicesData and > + returns a pointer to the allocated buffer. The buffer returned is > + aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If > + there is not enough memory remaining to satisfy the request, then NULL is > returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocateRuntimePages ( > + IN UINTN Pages > + ) > +{ > + return InternalAllocatePages (Pages, EfiRuntimeServicesData); } > + > /** >Allocates one or more 4KB pages of type EfiBootServicesData at a specified > alignment. > > -- > 2.29.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online
[edk2-devel] [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib
From: Min M Xu AllocateRuntimePages is used to allocate one or more 4KB pages of type EfiRuntimeServicesData. Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Abner Chang Cc: Daniel Schaefer Cc: Gerd Hoffmann Signed-off-by: Min Xu --- EmbeddedPkg/Include/Library/PrePiLib.h| 19 ++ .../MemoryAllocationLib.c | 64 ++- 2 files changed, 67 insertions(+), 16 deletions(-) diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h b/EmbeddedPkg/Include/Library/PrePiLib.h index 7b2cea296f1c..3741b08c4478 100644 --- a/EmbeddedPkg/Include/Library/PrePiLib.h +++ b/EmbeddedPkg/Include/Library/PrePiLib.h @@ -665,6 +665,25 @@ AllocatePages ( IN UINTN Pages ); +/** + Allocates one or more 4KB pages of type EfiRuntimeServicesData. + + Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the + allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL + is returned. If there is not enough memory remaining to satisfy the request, then NULL is + returned. + + @param Pages The number of 4 KB pages to allocate. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +AllocateRuntimePages ( + IN UINTN Pages + ); + /** Allocates a buffer of type EfiBootServicesData. diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c index 78f8da5e9527..9d7b34ad28fa 100644 --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c @@ -14,23 +14,11 @@ #include #include -/** - Allocates one or more 4KB pages of type EfiBootServicesData. - - Allocates the number of 4KB pages of MemoryType and returns a pointer to the - allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL - is returned. If there is not enough memory remaining to satisfy the request, then NULL is - returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ VOID * EFIAPI -AllocatePages ( - IN UINTN Pages +InternalAllocatePages ( + IN UINTNPages, + IN EFI_MEMORY_TYPE MemoryType ) { EFI_PEI_HOB_POINTERS Hob; @@ -65,12 +53,56 @@ AllocatePages ( BuildMemoryAllocationHob ( Hob.HandoffInformationTable->EfiFreeMemoryTop, Pages * EFI_PAGE_SIZE, - EfiBootServicesData + MemoryType ); return (VOID *)(UINTN)Hob.HandoffInformationTable->EfiFreeMemoryTop; } } +/** + Allocates one or more 4KB pages of type EfiBootServicesData. + + Allocates the number of 4KB pages of MemoryType and returns a pointer to the + allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL + is returned. If there is not enough memory remaining to satisfy the request, then NULL is + returned. + + @param Pages The number of 4 KB pages to allocate. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +AllocatePages ( + IN UINTN Pages + ) +{ + return InternalAllocatePages (Pages, EfiBootServicesData); +} + +/** + Allocates one or more 4KB pages of type EfiRuntimeServicesData. + + Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the + allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL + is returned. If there is not enough memory remaining to satisfy the request, then NULL is + returned. + + @param Pages The number of 4 KB pages to allocate. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +AllocateRuntimePages ( + IN UINTN Pages + ) +{ + return InternalAllocatePages (Pages, EfiRuntimeServicesData); +} + /** Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment. -- 2.29.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90755): https://edk2.groups.io/g/devel/message/90755 Mute This Topic: https://groups.io/mt/91995190/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-