• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
7 
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions
10 of the BSD License which accompanies this distribution.  The
11 full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13 
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 
17 **/
18 
19 #include "LegacyBiosInterface.h"
20 
21 /**
22   Fill in the standard BDA and EBDA stuff before Legacy16 load
23 
24   @param  Private     Legacy BIOS Instance data
25 
26   @retval EFI_SUCCESS It should always work.
27 
28 **/
29 EFI_STATUS
LegacyBiosInitBda(IN LEGACY_BIOS_INSTANCE * Private)30 LegacyBiosInitBda (
31   IN  LEGACY_BIOS_INSTANCE    *Private
32   )
33 {
34   BDA_STRUC *Bda;
35   UINT8     *Ebda;
36 
37   Bda   = (BDA_STRUC *) ((UINTN) 0x400);
38   Ebda  = (UINT8 *) ((UINTN) 0x9fc00);
39 
40   ZeroMem (Bda, 0x100);
41   ZeroMem (Ebda, 0x400);
42   //
43   // 640k-1k for EBDA
44   //
45   Bda->MemSize        = 0x27f;
46   Bda->KeyHead        = 0x1e;
47   Bda->KeyTail        = 0x1e;
48   Bda->FloppyData     = 0x00;
49   Bda->FloppyTimeout  = 0xff;
50 
51   Bda->KeyStart       = 0x001E;
52   Bda->KeyEnd         = 0x003E;
53   Bda->KeyboardStatus = 0x10;
54   Bda->Ebda           = 0x9fc0;
55 
56   //
57   // Move LPT time out here and zero out LPT4 since some SCSI OPROMS
58   // use this as scratch pad (LPT4 is Reserved)
59   //
60   Bda->Lpt1_2Timeout  = 0x1414;
61   Bda->Lpt3_4Timeout  = 0x1400;
62 
63   *Ebda               = 0x01;
64 
65   return EFI_SUCCESS;
66 }
67