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