LegacyBda.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /** @file
  2. This code fills in BDA (0x400) and EBDA (pointed to by 0x4xx)
  3. information. There is support for doing initializeation before
  4. Legacy16 is loaded and before a legacy boot is attempted.
  5. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. #include "LegacyBiosInterface.h"
  9. /**
  10. Fill in the standard BDA and EBDA stuff before Legacy16 load
  11. @param Private Legacy BIOS Instance data
  12. @retval EFI_SUCCESS It should always work.
  13. **/
  14. EFI_STATUS
  15. LegacyBiosInitBda (
  16. IN LEGACY_BIOS_INSTANCE *Private
  17. )
  18. {
  19. BDA_STRUC *Bda;
  20. UINT8 *Ebda;
  21. Bda = (BDA_STRUC *)((UINTN)0x400);
  22. Ebda = (UINT8 *)((UINTN)0x9fc00);
  23. ACCESS_PAGE0_CODE (
  24. ZeroMem (Bda, 0x100);
  25. //
  26. // 640k-1k for EBDA
  27. //
  28. Bda->MemSize = 0x27f;
  29. Bda->KeyHead = 0x1e;
  30. Bda->KeyTail = 0x1e;
  31. Bda->FloppyData = 0x00;
  32. Bda->FloppyTimeout = 0xff;
  33. Bda->KeyStart = 0x001E;
  34. Bda->KeyEnd = 0x003E;
  35. Bda->KeyboardStatus = 0x10;
  36. Bda->Ebda = 0x9fc0;
  37. //
  38. // Move LPT time out here and zero out LPT4 since some SCSI OPROMS
  39. // use this as scratch pad (LPT4 is Reserved)
  40. //
  41. Bda->Lpt1_2Timeout = 0x1414;
  42. Bda->Lpt3_4Timeout = 0x1400;
  43. );
  44. ZeroMem (Ebda, 0x400);
  45. *Ebda = 0x01;
  46. return EFI_SUCCESS;
  47. }