mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
SourceLevelDebugPkg: Check if PcdUsbEhciPciAddress is set correctly to avoid assertion
Signed-off-by: erictian Reviewed-by: niruiyu Reviewed-by: vanjeff git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12670 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
59b9d73e5f
commit
f98c268559
@ -164,9 +164,29 @@ CalculateUsbDebugPortBar (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT16 PciStatus;
|
UINT16 PciStatus;
|
||||||
|
UINT16 VendorId;
|
||||||
|
UINT16 DeviceId;
|
||||||
|
UINT8 ProgInterface;
|
||||||
|
UINT8 SubClassCode;
|
||||||
|
UINT8 BaseCode;
|
||||||
UINT8 CapabilityPtr;
|
UINT8 CapabilityPtr;
|
||||||
UINT8 CapabilityId;
|
UINT8 CapabilityId;
|
||||||
|
|
||||||
|
VendorId = PciRead16 (PcdGet32(PcdUsbEhciPciAddress) + PCI_VENDOR_ID_OFFSET);
|
||||||
|
DeviceId = PciRead16 (PcdGet32(PcdUsbEhciPciAddress) + PCI_DEVICE_ID_OFFSET);
|
||||||
|
|
||||||
|
if ((VendorId == 0xFFFF) || (DeviceId == 0xFFFF)) {
|
||||||
|
return RETURN_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgInterface = PciRead8 (PcdGet32(PcdUsbEhciPciAddress) + PCI_CLASSCODE_OFFSET);
|
||||||
|
SubClassCode = PciRead8 (PcdGet32(PcdUsbEhciPciAddress) + PCI_CLASSCODE_OFFSET + 1);
|
||||||
|
BaseCode = PciRead8 (PcdGet32(PcdUsbEhciPciAddress) + PCI_CLASSCODE_OFFSET + 2);
|
||||||
|
|
||||||
|
if ((ProgInterface != PCI_IF_EHCI) || (SubClassCode != PCI_CLASS_SERIAL_USB) || (BaseCode != PCI_CLASS_SERIAL)) {
|
||||||
|
return RETURN_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Enable Ehci Host Controller MMIO Space.
|
// Enable Ehci Host Controller MMIO Space.
|
||||||
//
|
//
|
||||||
@ -1068,7 +1088,7 @@ DebugPortInitialize (
|
|||||||
|
|
||||||
Status = CalculateUsbDebugPortBar(&Handle.DebugPortOffset, &Handle.DebugPortBarNumber);
|
Status = CalculateUsbDebugPortBar(&Handle.DebugPortOffset, &Handle.DebugPortBarNumber);
|
||||||
if (RETURN_ERROR (Status)) {
|
if (RETURN_ERROR (Status)) {
|
||||||
DEBUG ((EFI_D_ERROR, "USB Debug Port: EHCI host controller does not support debug port capability!\n"));
|
DEBUG ((EFI_D_ERROR, "USB Debug Port: the pci device pointed by PcdUsbEhciPciAddress is not EHCI host controller or does not support debug port capability!\n"));
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user