From e5653d946d3e9ade00365950826268a9d4afdf91 Mon Sep 17 00:00:00 2001 From: klu2 Date: Wed, 30 Apr 2008 09:08:49 +0000 Subject: [PATCH] Fix some bugs in FSVariable and BdsPlatform for duet platform. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5155 6f19259b-4bc3-4df7-8a09-765794883524 --- DuetPkg/DuetPkg.dsc | 20 ++++--- DuetPkg/DuetPkg.fdf | 18 +++++- DuetPkg/FSVariable/FSVariable.c | 27 +-------- DuetPkg/FSVariable/FSVariable.inf | 1 + DuetPkg/Library/DuetBdsLib/BdsPlatform.c | 76 ++++++++++++++---------- 5 files changed, 77 insertions(+), 65 deletions(-) diff --git a/DuetPkg/DuetPkg.dsc b/DuetPkg/DuetPkg.dsc index ba0460ba41..71766c01eb 100644 --- a/DuetPkg/DuetPkg.dsc +++ b/DuetPkg/DuetPkg.dsc @@ -112,10 +112,6 @@ MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf - IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf { - - DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf - } IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf @@ -126,14 +122,14 @@ MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf - + + DuetPkg/DataHubGenDxe/DataHubGen.inf DuetPkg/FvbRuntimeService/DUETFwh.inf DuetPkg/EfiLdr/EfiLdr.inf MdeModulePkg/Universal/BdsDxe/BdsDxe.inf DuetPkg/CpuIoDxe/CpuIo.inf DuetPkg/CpuDxe/Cpu.inf - IntelFrameworkModulePkg/Universal/Legacy8259Dxe/8259.inf DuetPkg/KbcResetDxe/Reset.inf DuetPkg/LegacyMetronome/Metronome.inf @@ -141,8 +137,10 @@ DuetPkg/PcRtc/RealTimeClock.inf DuetPkg/8254TimerDxe/8254Timer.inf DuetPkg/PciRootBridgeNoEnumerationDxe/PciRootBridgeNoEnumeration.inf + DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf + IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/VgaMiniPortDxe.inf IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf - + # IDE Support #IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf @@ -155,6 +153,14 @@ # ISA Support DuetPkg/IsaAcpiDxe/IsaAcpi.inf + IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf + IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf + IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf + + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + DuetPkg/BootSector/BootSector.inf [BuildOptions.common] diff --git a/DuetPkg/DuetPkg.fdf b/DuetPkg/DuetPkg.fdf index eaa2fdfb91..52de06a344 100644 --- a/DuetPkg/DuetPkg.fdf +++ b/DuetPkg/DuetPkg.fdf @@ -73,7 +73,6 @@ INF DuetPkg/FSVariable/FSVariable.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf -INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf INF IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf @@ -97,6 +96,8 @@ INF DuetPkg/LegacyMetronome/Metronome.inf INF DuetPkg/8254TimerDxe/8254Timer.inf INF DuetPkg/PcRtc/RealTimeClock.inf INF DuetPkg/PciRootBridgeNoEnumerationDxe/PciRootBridgeNoEnumeration.inf +INF DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf +INF IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/VgaMiniPortDxe.inf INF IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf # IDE Support @@ -111,6 +112,21 @@ INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf # ISA Support INF DuetPkg/IsaAcpiDxe/IsaAcpi.inf +INF IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf +INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf +INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf + +INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf +INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf +INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + +FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F { + SECTION PE32 = FatBinPkg/EnhancedFatDxe/Ia32/Fat.efi + } + +FILE FREEFORM = 7BB28B99-61BB-11D5-9A5D-0090273FC14D { + SECTION RAW = MdeModulePkg/Logo/Logo.bmp + } [Rule.Common.PEI_CORE] FILE PEI_CORE = $(NAMED_GUID) { diff --git a/DuetPkg/FSVariable/FSVariable.c b/DuetPkg/FSVariable/FSVariable.c index cfe76ccc95..0977887818 100644 --- a/DuetPkg/FSVariable/FSVariable.c +++ b/DuetPkg/FSVariable/FSVariable.c @@ -743,7 +743,6 @@ Returns: return EFI_INVALID_PARAMETER; } -#if (EFI_SPECIFICATION_VERSION >= 0x0002000A) // // The size of the VariableName, including the Unicode Null in bytes plus // the DataSize is limited to maximum size of MAX_HARDWARE_ERROR_VARIABLE_SIZE (32K) @@ -760,16 +759,7 @@ Returns: return EFI_INVALID_PARAMETER; } } -#else - // - // The size of the VariableName, including the Unicode Null in bytes plus - // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes. - // - if ((DataSize > MAX_VARIABLE_SIZE) || - (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE)) { - return EFI_INVALID_PARAMETER; - } -#endif + // // Check whether the input variable is already existed // @@ -984,7 +974,6 @@ Returns: return EFI_SUCCESS; } -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) EFI_STATUS EFIAPI QueryVariableInfo ( @@ -1028,21 +1017,12 @@ Returns: return EFI_INVALID_PARAMETER; } -#if (EFI_SPECIFICATION_VERSION >= 0x0002000A) if((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) == 0) { // // Make sure the Attributes combination is supported by the platform. // return EFI_UNSUPPORTED; } -#else - if((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)) == 0) { - // - // Make sure the Attributes combination is supported by the platform. - // - return EFI_UNSUPPORTED; - } -#endif else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) { // // Make sure if runtime bit is set, boot service bit is set also. @@ -1070,14 +1050,12 @@ Returns: // *MaximumVariableSize = MAX_VARIABLE_SIZE - sizeof (VARIABLE_HEADER); -#if (EFI_SPECIFICATION_VERSION >= 0x0002000A) // // Harware error record variable needs larger size. // if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) { *MaximumVariableSize = MAX_HARDWARE_ERROR_VARIABLE_SIZE - sizeof (VARIABLE_HEADER); } -#endif // // Point to the starting address of the variables. @@ -1124,7 +1102,6 @@ Returns: return EFI_SUCCESS; } -#endif EFI_STATUS EFIAPI @@ -1299,9 +1276,7 @@ Returns: SystemTable->RuntimeServices->GetNextVariableName = GetNextVariableName; SystemTable->RuntimeServices->SetVariable = SetVariable; -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) SystemTable->RuntimeServices->QueryVariableInfo = QueryVariableInfo; -#endif // // Now install the Variable Runtime Architectural Protocol on a new handle diff --git a/DuetPkg/FSVariable/FSVariable.inf b/DuetPkg/FSVariable/FSVariable.inf index d2c29e926c..52a805d036 100644 --- a/DuetPkg/FSVariable/FSVariable.inf +++ b/DuetPkg/FSVariable/FSVariable.inf @@ -66,6 +66,7 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize [Depex] TRUE diff --git a/DuetPkg/Library/DuetBdsLib/BdsPlatform.c b/DuetPkg/Library/DuetBdsLib/BdsPlatform.c index 71e9b5db50..f73f824f2d 100644 --- a/DuetPkg/Library/DuetBdsLib/BdsPlatform.c +++ b/DuetPkg/Library/DuetBdsLib/BdsPlatform.c @@ -48,9 +48,8 @@ Returns: --*/ { - EFI_STATUS Status; - EFI_HOB_HANDOFF_INFO_TABLE *HobList; - EFI_HOB_HANDOFF_INFO_TABLE *HobStart; + EFI_PEI_HOB_POINTERS GuidHob; + EFI_PEI_HOB_POINTERS HobStart; EFI_PHYSICAL_ADDRESS *Table; UINTN Index; EFI_GUID *TableGuidArray[] = { @@ -60,19 +59,14 @@ Returns: // // Get Hob List // - Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, (VOID *) &HobList); - if (EFI_ERROR (Status)) { - return; - } - + HobStart.Raw = GetHobList (); // // Iteratively add ACPI Table, SMBIOS Table, MPS Table to EFI System Table // for (Index = 0; Index < sizeof (TableGuidArray) / sizeof (*TableGuidArray); ++Index) { - HobStart = HobList; - Table = NULL; - Table = GetNextGuidHob (TableGuidArray[Index], &HobStart); - if (!EFI_ERROR (Status)) { + GuidHob.Raw = GetNextGuidHob (TableGuidArray[Index], HobStart.Raw); + if (GuidHob.Raw != NULL) { + Table = GET_GUID_HOB_DATA (GuidHob.Guid); if (Table != NULL) { // // Check if Mps Table/Smbios Table/Acpi Table exists in E/F seg, @@ -152,7 +146,7 @@ UpdateMemoryMap ( ) { EFI_STATUS Status; - EFI_HOB_HANDOFF_INFO_TABLE *HobList; + EFI_PEI_HOB_POINTERS GuidHob; VOID *Table; MEMORY_DESC_HOB MemoryDescHob; UINTN Index; @@ -161,12 +155,18 @@ UpdateMemoryMap ( // // Get Hob List // - Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, (VOID *) &HobList); - if (EFI_ERROR (Status)) { + GuidHob.Raw = GetHobList(); + + GuidHob.Raw = GetNextGuidHob (&gEfiLdrMemoryDescriptorGuid, GuidHob.Raw); + if (GuidHob.Raw == NULL) { + DEBUG ((EFI_D_ERROR, "Fail to get gEfiLdrMemoryDescriptorGuid from GUID HOB LIST!\n")); + return; + } + Table = GET_GUID_HOB_DATA (GuidHob.Guid); + if (Table == NULL) { + DEBUG ((EFI_D_ERROR, "Fail to get gEfiLdrMemoryDescriptorGuid from GUID HOB LIST!\n")); return; } - - Table = GetNextGuidHob (&gEfiLdrMemoryDescriptorGuid, &HobList); MemoryDescHob.MemDescCount = *(UINTN *)Table; MemoryDescHob.MemDesc = *(EFI_MEMORY_DESCRIPTOR **)((UINTN)Table + sizeof(UINTN)); @@ -382,6 +382,19 @@ Returns: // Fixup Tasble CRC after we updated Firmware Vendor and Revision // gBS->CalculateCrc32 ((VOID *) gST, sizeof (EFI_SYSTEM_TABLE), &gST->Hdr.CRC32); + + GetSystemTablesFromHob (); + + UpdateMemoryMap (); + + // + // Append Usb Keyboard short form DevicePath into "ConInDev" + // + BdsLibUpdateConsoleVariable ( + VarConsoleInpDev, + (EFI_DEVICE_PATH_PROTOCOL *) &gUsbClassKeyboardDevicePath, + NULL + ); } UINT64 @@ -407,23 +420,27 @@ Returns: UINTN BufferSize; UINT32 Index; UINT32 Number; - VOID *HobList; - EFI_STATUS Status; + EFI_PEI_HOB_POINTERS GuidHob; BufferSize = 0; // // Get Hob List from configuration table // - Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &HobList); - if (EFI_ERROR (Status)) { - return 0; - } + GuidHob.Raw = GetHobList (); // // Get PciExpressAddressInfo Hob // - PciExpressBaseAddressInfo = NULL; - PciExpressBaseAddressInfo = GetNextGuidHob (&gEfiPciExpressBaseAddressGuid, &HobList); + GuidHob.Raw = GetNextGuidHob (&gEfiPciExpressBaseAddressGuid, GuidHob.Raw); + if (GuidHob.Raw == NULL) { + DEBUG ((EFI_D_ERROR, "Fail to get gEfiPciExpressBaseAddressGuid from GUID HOB\n")); + return 0; + } + PciExpressBaseAddressInfo = (EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION *) GET_GUID_HOB_DATA (GuidHob.Guid); + if (PciExpressBaseAddressInfo == NULL) { + DEBUG ((EFI_D_ERROR, "Fail to get gEfiPciExpressBaseAddressGuid from GUID HOB\n")); + return 0; + } // // Search the PciExpress Base Address in the Hob for current RootBridge @@ -585,7 +602,6 @@ Returns: return EFI_SUCCESS; } -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) EFI_STATUS GetGopDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL *PciDevicePath, @@ -670,7 +686,6 @@ GetGopDevicePath ( return EFI_SUCCESS; } -#endif EFI_STATUS PreparePciVgaDevicePath ( @@ -696,9 +711,7 @@ Returns: { EFI_STATUS Status; EFI_DEVICE_PATH_PROTOCOL *DevicePath; -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) EFI_DEVICE_PATH_PROTOCOL *GopDevicePath; -#endif DevicePath = NULL; Status = gBS->HandleProtocol ( @@ -710,10 +723,8 @@ Returns: return Status; } -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) GetGopDevicePath (DevicePath, &GopDevicePath); DevicePath = GopDevicePath; -#endif BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL); @@ -839,6 +850,7 @@ Returns: // Add IsaKeyboard to ConIn, // add IsaSerial to ConOut, ConIn, ErrOut // + DEBUG ((EFI_D_INFO, "Find the LPC Bridge device\n")); PrepareLpcBridgeDevicePath (HandleBuffer[Index]); continue; } @@ -849,6 +861,7 @@ Returns: // // Add them to ConOut, ConIn, ErrOut. // + DEBUG ((EFI_D_INFO, "Find the 16550 SERIAL device\n")); PreparePciSerialDevicePath (HandleBuffer[Index]); continue; } @@ -861,6 +874,7 @@ Returns: // // Add them to ConOut. // + DEBUG ((EFI_D_INFO, "Find the VGA device\n")); PreparePciVgaDevicePath (HandleBuffer[Index]); continue; } -- 2.39.2