[PATCH 09/12] UefiPayloadPkg: Remove assert when reserve MMIO/IO resource for devices


Guo Dong
 

Reviewed-by: Guo Dong <guo.dong@intel.com>

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@intel.com>
Sent: Sunday, June 20, 2021 8:47 AM
To: devel@edk2.groups.io
Cc: Ma, Maurice <maurice.ma@intel.com>; Dong, Guo
<guo.dong@intel.com>; You, Benjamin <benjamin.you@intel.com>
Subject: [PATCH 09/12] UefiPayloadPkg: Remove assert when reserve
MMIO/IO resource for devices

Some boot loader may already reserve MMIO/IO resource for IOAPIC and
HPET,
so remove the assert when reserve MMIO/IO resource for IOAPIC and HPET

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
index ffd3427fb3..04e968a232 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
@@ -41,13 +41,12 @@ ReserveResourceInGcd (
);

if (EFI_ERROR (Status)) {

DEBUG ((

- DEBUG_ERROR,

+ DEBUG_WARN,

"Failed to add memory space :0x%lx 0x%lx\n",

BaseAddress,

Length

));

}

- ASSERT_EFI_ERROR (Status);

Status = gDS->AllocateMemorySpace (

EfiGcdAllocateAddress,

GcdType,

@@ -57,14 +56,20 @@ ReserveResourceInGcd (
ImageHandle,

NULL

);

- ASSERT_EFI_ERROR (Status);

} else {

Status = gDS->AddIoSpace (

GcdType,

BaseAddress,

Length

);

- ASSERT_EFI_ERROR (Status);

+ if (EFI_ERROR (Status)) {

+ DEBUG ((

+ DEBUG_WARN,

+ "Failed to add IO space :0x%lx 0x%lx\n",

+ BaseAddress,

+ Length

+ ));

+ }

Status = gDS->AllocateIoSpace (

EfiGcdAllocateAddress,

GcdType,

@@ -74,7 +79,6 @@ ReserveResourceInGcd (
ImageHandle,

NULL

);

- ASSERT_EFI_ERROR (Status);

}

return Status;

}

@@ -106,11 +110,9 @@ BlDxeEntryPoint (
//

// Report MMIO/IO Resources

//

- Status = ReserveResourceInGcd (TRUE,
EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0,
ImageHandle); // IOAPIC

- ASSERT_EFI_ERROR (Status);

+ ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo,
0xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC



- Status = ReserveResourceInGcd (TRUE,
EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0,
ImageHandle); // HPET

- ASSERT_EFI_ERROR (Status);

+ ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo,
0xFED00000, SIZE_1KB, 0, ImageHandle); // HPET



//

// Find the frame buffer information and update PCDs

--
2.16.2.windows.1


Zhiguang Liu
 

Some boot loader may already reserve MMIO/IO resource for IOAPIC and HPET,
so remove the assert when reserve MMIO/IO resource for IOAPIC and HPET

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/Bl=
SupportDxe/BlSupportDxe.c
index ffd3427fb3..04e968a232 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
@@ -41,13 +41,12 @@ ReserveResourceInGcd (
);=0D
if (EFI_ERROR (Status)) {=0D
DEBUG ((=0D
- DEBUG_ERROR,=0D
+ DEBUG_WARN,=0D
"Failed to add memory space :0x%lx 0x%lx\n",=0D
BaseAddress,=0D
Length=0D
));=0D
}=0D
- ASSERT_EFI_ERROR (Status);=0D
Status =3D gDS->AllocateMemorySpace (=0D
EfiGcdAllocateAddress,=0D
GcdType,=0D
@@ -57,14 +56,20 @@ ReserveResourceInGcd (
ImageHandle,=0D
NULL=0D
);=0D
- ASSERT_EFI_ERROR (Status);=0D
} else {=0D
Status =3D gDS->AddIoSpace (=0D
GcdType,=0D
BaseAddress,=0D
Length=0D
);=0D
- ASSERT_EFI_ERROR (Status);=0D
+ if (EFI_ERROR (Status)) {=0D
+ DEBUG ((=0D
+ DEBUG_WARN,=0D
+ "Failed to add IO space :0x%lx 0x%lx\n",=0D
+ BaseAddress,=0D
+ Length=0D
+ ));=0D
+ }=0D
Status =3D gDS->AllocateIoSpace (=0D
EfiGcdAllocateAddress,=0D
GcdType,=0D
@@ -74,7 +79,6 @@ ReserveResourceInGcd (
ImageHandle,=0D
NULL=0D
);=0D
- ASSERT_EFI_ERROR (Status);=0D
}=0D
return Status;=0D
}=0D
@@ -106,11 +110,9 @@ BlDxeEntryPoint (
//=0D
// Report MMIO/IO Resources=0D
//=0D
- Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0=
xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC=0D
- ASSERT_EFI_ERROR (Status);=0D
+ ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, =
SIZE_4KB, 0, ImageHandle); // IOAPIC=0D
=0D
- Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0=
xFED00000, SIZE_1KB, 0, ImageHandle); // HPET=0D
- ASSERT_EFI_ERROR (Status);=0D
+ ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, =
SIZE_1KB, 0, ImageHandle); // HPET=0D
=0D
//=0D
// Find the frame buffer information and update PCDs=0D
--=20
2.16.2.windows.1