/** This function will connect all the console devices base on the console device variable ConIn, ConOut and ErrOut. **/ VOID EFIAPI EfiBootManagerConnectAllDefaultConsoles ( VOID ) { BOOLEAN SystemTableUpdated; EfiBootManagerConnectConsoleVariable (ConOut, TRUE); PERF_START (NULL, "ConOutReady", "BDS", 1); PERF_END (NULL, "ConOutReady", "BDS", 0); EfiBootManagerConnectConsoleVariable (ConIn, TRUE); PERF_START (NULL, "ConInReady", "BDS", 1); PERF_END (NULL, "ConInReady", "BDS", 0); // // The _ModuleEntryPoint err out var is legal. // EfiBootManagerConnectConsoleVariable (ErrOut, TRUE); PERF_START (NULL, "ErrOutReady", "BDS", 1); PERF_END (NULL, "ErrOutReady", "BDS", 0); SystemTableUpdated = FALSE; // // Fill console handles in System Table if no console device assignd. // if (UpdateSystemTableConsole (L"ConIn", &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **) &gST->ConIn)) { SystemTableUpdated = TRUE; } if (UpdateSystemTableConsole (L"ConOut", &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **) &gST->ConOut)) { SystemTableUpdated = TRUE; } if (UpdateSystemTableConsole (L"ErrOut", &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **) &gST->StdErr)) { SystemTableUpdated = TRUE; } if (SystemTableUpdated) { // // Update the CRC32 in the EFI System Table header // gST->Hdr.CRC32 = 0; gBS->CalculateCrc32 ( (UINT8 *) &gST->Hdr, gST->Hdr.HeaderSize, &gST->Hdr.CRC32 ); } }
/** Event to Connect ConIn. @param Event Event whose notification function is being invoked. @param Context Pointer to the notification function's context, which is implementation-dependent. **/ VOID EFIAPI BdsDxeOnConnectConInCallBack ( IN EFI_EVENT Event, IN VOID *Context ) { EFI_STATUS Status; // // When Osloader call ReadKeyStroke to signal this event // no driver dependency is assumed existing. So use a non-dispatch version // Status = EfiBootManagerConnectConsoleVariable (ConIn); if (EFI_ERROR (Status)) { // // Should not enter this case, if enter, the keyboard will not work. // May need platfrom policy to connect keyboard. // DEBUG ((EFI_D_WARN, "[Bds] Connect ConIn failed - %r!!!\n", Status)); } }
/** This function will connect all the console devices base on the console device variable ConIn, ConOut and ErrOut. @retval EFI_DEVICE_ERROR All the consoles were not connected due to an error. @retval EFI_SUCCESS Success connect any one instance of the console device path base on the variable ConVarName. **/ EFI_STATUS EFIAPI EfiBootManagerConnectAllDefaultConsoles ( VOID ) { EFI_STATUS Status; BOOLEAN OneConnected; BOOLEAN SystemTableUpdated; OneConnected = FALSE; Status = EfiBootManagerConnectConsoleVariable (ConOut); if (!EFI_ERROR (Status)) { OneConnected = TRUE; } PERF_START (NULL, "ConOutReady", "BDS", 1); PERF_END (NULL, "ConOutReady", "BDS", 0); Status = EfiBootManagerConnectConsoleVariable (ConIn); if (!EFI_ERROR (Status)) { OneConnected = TRUE; } PERF_START (NULL, "ConInReady", "BDS", 1); PERF_END (NULL, "ConInReady", "BDS", 0); Status = EfiBootManagerConnectConsoleVariable (ErrOut); if (!EFI_ERROR (Status)) { OneConnected = TRUE; } PERF_START (NULL, "ErrOutReady", "BDS", 1); PERF_END (NULL, "ErrOutReady", "BDS", 0); SystemTableUpdated = FALSE; // // Fill console handles in System Table if no console device assignd. // if (BmUpdateSystemTableConsole (L"ConIn", &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **) &gST->ConIn)) { SystemTableUpdated = TRUE; } if (BmUpdateSystemTableConsole (L"ConOut", &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **) &gST->ConOut)) { SystemTableUpdated = TRUE; } if (BmUpdateSystemTableConsole (L"ErrOut", &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **) &gST->StdErr)) { SystemTableUpdated = TRUE; } if (SystemTableUpdated) { // // Update the CRC32 in the EFI System Table header // gST->Hdr.CRC32 = 0; gBS->CalculateCrc32 ( (UINT8 *) &gST->Hdr, gST->Hdr.HeaderSize, &gST->Hdr.CRC32 ); } return OneConnected ? EFI_SUCCESS : EFI_DEVICE_ERROR; }