]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBda.c
c6670febeea4fca52dca96a41640983476636c65
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / LegacyBiosDxe / LegacyBda.c
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
30 LegacyBiosInitBda (
31 IN LEGACY_BIOS_INSTANCE *Private
32 )
33 {
34 BDA_STRUC *Bda;
35 UINT8 *Ebda;
36
37 DisableNullDetection ();
38
39 Bda = (BDA_STRUC *) ((UINTN) 0x400);
40 Ebda = (UINT8 *) ((UINTN) 0x9fc00);
41
42 ZeroMem (Bda, 0x100);
43 ZeroMem (Ebda, 0x400);
44 //
45 // 640k-1k for EBDA
46 //
47 Bda->MemSize = 0x27f;
48 Bda->KeyHead = 0x1e;
49 Bda->KeyTail = 0x1e;
50 Bda->FloppyData = 0x00;
51 Bda->FloppyTimeout = 0xff;
52
53 Bda->KeyStart = 0x001E;
54 Bda->KeyEnd = 0x003E;
55 Bda->KeyboardStatus = 0x10;
56 Bda->Ebda = 0x9fc0;
57
58 //
59 // Move LPT time out here and zero out LPT4 since some SCSI OPROMS
60 // use this as scratch pad (LPT4 is Reserved)
61 //
62 Bda->Lpt1_2Timeout = 0x1414;
63 Bda->Lpt3_4Timeout = 0x1400;
64
65 *Ebda = 0x01;
66
67 EnableNullDetection ();
68
69 return EFI_SUCCESS;
70 }