1 | /* $Id: InternalBdsLib.h 29125 2010-05-06 09:43:05Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * InternalBdsLib.h - BDS library definition, include the file and data structure
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /*
|
---|
19 |
|
---|
20 | This code is based on:
|
---|
21 |
|
---|
22 | Copyright (c) 2004 - 2009, Intel Corporation. <BR>
|
---|
23 | All rights reserved. This program and the accompanying materials
|
---|
24 | are licensed and made available under the terms and conditions of the BSD License
|
---|
25 | which accompanies this distribution. The full text of the license may be found at
|
---|
26 | http://opensource.org/licenses/bsd-license.php
|
---|
27 |
|
---|
28 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
29 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
30 |
|
---|
31 | */
|
---|
32 |
|
---|
33 | #ifndef _INTERNAL_BDS_LIB_H_
|
---|
34 | #define _INTERNAL_BDS_LIB_H_
|
---|
35 |
|
---|
36 | #include <FrameworkDxe.h>
|
---|
37 |
|
---|
38 | #include <IndustryStandard/Pci.h>
|
---|
39 | #include <IndustryStandard/PeImage.h>
|
---|
40 |
|
---|
41 | #include <Protocol/BlockIo.h>
|
---|
42 | #include <Protocol/LoadedImage.h>
|
---|
43 | #include <Protocol/Cpu.h>
|
---|
44 | #include <Protocol/SimpleFileSystem.h>
|
---|
45 | #include <Protocol/DebugPort.h>
|
---|
46 | #include <Protocol/DevicePath.h>
|
---|
47 | #include <Protocol/SimpleTextIn.h>
|
---|
48 | #include <Protocol/LegacyBios.h>
|
---|
49 | #include <Protocol/SimpleTextOut.h>
|
---|
50 | #include <Protocol/SimpleNetwork.h>
|
---|
51 | #include <Protocol/DevicePathToText.h>
|
---|
52 | #include <Protocol/FirmwareVolume2.h>
|
---|
53 | #include <Protocol/PciIo.h>
|
---|
54 | #include <Protocol/AcpiS3Save.h>
|
---|
55 | #include <Protocol/OEMBadging.h>
|
---|
56 | #include <Protocol/GraphicsOutput.h>
|
---|
57 | #include <Protocol/UgaDraw.h>
|
---|
58 | #include <Protocol/HiiFont.h>
|
---|
59 | #include <Protocol/HiiImage.h>
|
---|
60 | #include <Protocol/Security.h>
|
---|
61 |
|
---|
62 | #include <Guid/MemoryTypeInformation.h>
|
---|
63 | #include <Guid/FileInfo.h>
|
---|
64 | #include <Guid/GlobalVariable.h>
|
---|
65 | #include <Guid/PcAnsi.h>
|
---|
66 | #include <Guid/Performance.h>
|
---|
67 |
|
---|
68 | #include <Library/PrintLib.h>
|
---|
69 | #include <Library/DebugLib.h>
|
---|
70 | #include <Library/BaseMemoryLib.h>
|
---|
71 | #include <Library/UefiBootServicesTableLib.h>
|
---|
72 | #include <Library/UefiLib.h>
|
---|
73 | #include <Library/MemoryAllocationLib.h>
|
---|
74 | #include <Library/DxeServicesTableLib.h>
|
---|
75 | #include <Library/UefiRuntimeServicesTableLib.h>
|
---|
76 | #include <Library/HobLib.h>
|
---|
77 | #include <Library/BaseLib.h>
|
---|
78 | #include <Library/DevicePathLib.h>
|
---|
79 | #include <Library/PerformanceLib.h>
|
---|
80 | #include <Library/PcdLib.h>
|
---|
81 | #include <Library/PeCoffGetEntryPointLib.h>
|
---|
82 | #include <Library/GenericBdsLib.h>
|
---|
83 | #include <Library/TimerLib.h>
|
---|
84 | #include <Library/PcdLib.h>
|
---|
85 | #include <Library/DxeServicesLib.h>
|
---|
86 |
|
---|
87 | #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
|
---|
88 | #if defined (MDE_CPU_EBC)
|
---|
89 | //
|
---|
90 | // Uefi specification only defines the default boot file name for IA32, X64
|
---|
91 | // and IPF processor, so need define boot file name for EBC architecture here.
|
---|
92 | //
|
---|
93 | #define EFI_REMOVABLE_MEDIA_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"
|
---|
94 | #else
|
---|
95 | #error "Can not determine the default boot file name for unknown processor type!"
|
---|
96 | #endif
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | /**
|
---|
100 |
|
---|
101 | Allocates a block of memory and writes performance data of booting into it.
|
---|
102 | OS can processing these record.
|
---|
103 |
|
---|
104 | **/
|
---|
105 | VOID
|
---|
106 | WriteBootToOsPerformanceData (
|
---|
107 | VOID
|
---|
108 | );
|
---|
109 |
|
---|
110 | /**
|
---|
111 | Get the headers (dos, image, optional header) from an image
|
---|
112 |
|
---|
113 | @param Device SimpleFileSystem device handle
|
---|
114 | @param FileName File name for the image
|
---|
115 | @param DosHeader Pointer to dos header
|
---|
116 | @param Hdr The buffer in which to return the PE32, PE32+, or TE header.
|
---|
117 |
|
---|
118 | @retval EFI_SUCCESS Successfully get the machine type.
|
---|
119 | @retval EFI_NOT_FOUND The file is not found.
|
---|
120 | @retval EFI_LOAD_ERROR File is not a valid image file.
|
---|
121 |
|
---|
122 | **/
|
---|
123 | EFI_STATUS
|
---|
124 | EFIAPI
|
---|
125 | BdsLibGetImageHeader (
|
---|
126 | IN EFI_HANDLE Device,
|
---|
127 | IN CHAR16 *FileName,
|
---|
128 | OUT EFI_IMAGE_DOS_HEADER *DosHeader,
|
---|
129 | OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr,
|
---|
130 | IN OUT CHAR16 **NewFileName
|
---|
131 | );
|
---|
132 |
|
---|
133 | #endif // _BDS_LIB_H_
|
---|