/** Do the platform init, can be customized by OEM/IBV Possible things that can be done in PlatformBootManagerBeforeConsole: > Update console variable: 1. include hot-plug devices; > 2. Clear ConIn and add SOL for AMT > Register new Driver#### or Boot#### > Register new Key####: e.g.: F12 > Signal ReadyToLock event > Authentication action: 1. connect Auth devices; > 2. Identify auto logon user. **/ VOID EFIAPI PlatformBootManagerBeforeConsole ( VOID ) { // // Signal EndOfDxe PI Event // EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid); // // Locate the PCI root bridges and make the PCI bus driver connect each, // non-recursively. This will produce a number of child handles with PciIo on // them. // FilterAndProcess (&gEfiPciRootBridgeIoProtocolGuid, NULL, Connect); // // Find all display class PCI devices (using the handles from the previous // step), and connect them non-recursively. This should produce a number of // child handles with GOPs on them. // FilterAndProcess (&gEfiPciIoProtocolGuid, IsPciDisplay, Connect); // // Now add the device path of all handles with GOP on them to ConOut and // ErrOut. // FilterAndProcess (&gEfiGraphicsOutputProtocolGuid, NULL, AddOutput); // // Add the hardcoded short-form USB keyboard device path to ConIn. // EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard, NULL); // // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut. // ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4); CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid); EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); // // Register platform-specific boot options and keyboard shortcuts. // PlatformRegisterOptionsAndKeys (); }
/** Do the platform specific action before the console is connected. Such as: Update console variable; Register new Driver#### or Boot####; Signal ReadyToLock event. **/ VOID EFIAPI PlatformBootManagerBeforeConsole ( VOID ) { UINTN Index; EFI_STATUS Status; WIN_NT_SYSTEM_CONFIGURATION *Configuration; GetVariable2 (L"Setup", &gEfiWinNtSystemConfigGuid, (VOID **) &Configuration, NULL); if (Configuration != NULL) { // // SetupVariable is corrupt // Configuration->ConOutRow = PcdGet32 (PcdConOutColumn); Configuration->ConOutColumn = PcdGet32 (PcdConOutRow); Status = gRT->SetVariable ( L"Setup", &gEfiWinNtSystemConfigGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, sizeof (WIN_NT_SYSTEM_CONFIGURATION), Configuration ); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Failed to save Setup Variable to non-volatile storage, Status = %r\n", Status)); } FreePool (Configuration); } // // Update the ocnsole variables. // for (Index = 0; gPlatformConsole[Index].DevicePath != NULL; Index++) { if ((gPlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) { EfiBootManagerUpdateConsoleVariable (ConIn, gPlatformConsole[Index].DevicePath, NULL); } if ((gPlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) { EfiBootManagerUpdateConsoleVariable (ConOut, gPlatformConsole[Index].DevicePath, NULL); } if ((gPlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) { EfiBootManagerUpdateConsoleVariable (ErrOut, gPlatformConsole[Index].DevicePath, NULL); } } // // From PI spec vol2: // Prior to invoking any UEFI drivers, applications, or connecting consoles, // the platform should signal the event EFI_END_OF_DXE_EVENT_GUID // EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid); }
/** Platform Bds init. Include the platform firmware vendor, revision and so crc check. **/ VOID EFIAPI PlatformBdsInit ( VOID ) { // // Signal EndOfDxe PI Event // EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid); }
/** Do the platform init, can be customized by OEM/IBV Possible things that can be done in PlatformBootManagerBeforeConsole: > Update console variable: 1. include hot-plug devices; > 2. Clear ConIn and add SOL for AMT > Register new Driver#### or Boot#### > Register new Key####: e.g.: F12 > Signal ReadyToLock event > Authentication action: 1. connect Auth devices; > 2. Identify auto logon user. **/ VOID EFIAPI PlatformBootManagerBeforeConsole ( VOID ) { // // Signal EndOfDxe PI Event // EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid); // // Locate the PCI root bridges and make the PCI bus driver connect each, // non-recursively. This will produce a number of child handles with PciIo on // them. // FilterAndProcess (&gEfiPciRootBridgeIoProtocolGuid, NULL, Connect); // // Signal the ACPI platform driver that it can download QEMU ACPI tables. // EfiEventGroupSignal (&gRootBridgesConnectedEventGroupGuid); // // Find all display class PCI devices (using the handles from the previous // step), and connect them non-recursively. This should produce a number of // child handles with GOPs on them. // FilterAndProcess (&gEfiPciIoProtocolGuid, IsPciDisplay, Connect); // // Now add the device path of all handles with GOP on them to ConOut and // ErrOut. // FilterAndProcess (&gEfiGraphicsOutputProtocolGuid, NULL, AddOutput); // // Add the hardcoded short-form USB keyboard device path to ConIn. // EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard, NULL); // // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut. // CopyGuid (&mSerialConsole.TermType.Guid, PcdGetPtr (PcdTerminalTypeGuidBuffer)); EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); // // Set the front page timeout from the QEMU configuration. // PcdSet16 (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ()); // // Register platform-specific boot options and keyboard shortcuts. // PlatformRegisterOptionsAndKeys (); }
/** The function will execute with as the platform policy, current policy is driven by boot mode. IBV/OEM can customize this code for their specific policy action. @param DriverOptionList The header of the driver option link list @param BootOptionList The header of the boot option link list @param ProcessCapsules A pointer to ProcessCapsules() @param BaseMemoryTest A pointer to BaseMemoryTest() **/ VOID EFIAPI PlatformBdsPolicyBehavior ( IN LIST_ENTRY *DriverOptionList, IN LIST_ENTRY *BootOptionList, IN PROCESS_CAPSULES ProcessCapsules, IN BASEM_MEMORY_TEST BaseMemoryTest ) { // // Locate the PCI root bridges and make the PCI bus driver connect each, // non-recursively. This will produce a number of child handles with PciIo on // them. // FilterAndProcess (&gEfiPciRootBridgeIoProtocolGuid, NULL, Connect); // // Signal the ACPI platform driver that it can download QEMU ACPI tables. // EfiEventGroupSignal (&gRootBridgesConnectedEventGroupGuid); // // Find all display class PCI devices (using the handles from the previous // step), and connect them non-recursively. This should produce a number of // child handles with GOPs on them. // FilterAndProcess (&gEfiPciIoProtocolGuid, IsPciDisplay, Connect); // // Now add the device path of all handles with GOP on them to ConOut and // ErrOut. // FilterAndProcess (&gEfiGraphicsOutputProtocolGuid, NULL, AddOutput); // // Add the hardcoded short-form USB keyboard device path to ConIn. // BdsLibUpdateConsoleVariable (L"ConIn", (EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard, NULL); // // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut. // CopyGuid (&mSerialConsole.TermType.Guid, PcdGetPtr (PcdTerminalTypeGuidBuffer)); BdsLibUpdateConsoleVariable (L"ConIn", (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); BdsLibUpdateConsoleVariable (L"ConOut", (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); BdsLibUpdateConsoleVariable (L"ErrOut", (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL); // // Connect the consoles based on the above variables. // BdsLibConnectAllDefaultConsoles (); // // Show the splash screen. // EnableQuietBoot (PcdGetPtr (PcdLogoFile)); // // Connect the rest of the devices. // BdsLibConnectAll (); // // Process QEMU's -kernel command line option. Note that the kernel booted // this way should receive ACPI tables, which is why we connect all devices // first (see above) -- PCI enumeration blocks ACPI table installation, if // there is a PCI host. // TryRunningQemuKernel (); BdsLibEnumerateAllBootOption (BootOptionList); SetBootOrderFromQemu (BootOptionList); // // The BootOrder variable may have changed, reload the in-memory list with // it. // BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder"); PlatformBdsEnterFrontPage (GetFrontPageTimeoutFromQemu(), TRUE); }