VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxSysTables/VBoxSysTables.c@ 35072

最後變更 在這個檔案從35072是 29081,由 vboxsync 提交於 15 年 前

more EFI exports to OSE

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.7 KB
 
1/* $Id: VBoxSysTables.c 29081 2010-05-05 13:32:04Z vboxsync $ */
2/** @file
3 * VBoxSysTables.c - VirtualBox system tables
4 */
5
6/*
7 * Copyright (C) 2009-2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.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* Header Files *
21*******************************************************************************/
22#include <Library/BaseMemoryLib.h>
23#include <Library/DebugLib.h>
24#include <Library/UefiBootServicesTableLib.h>
25#include <Library/UefiLib.h>
26
27#include <Protocol/DevicePathToText.h>
28
29#include <IndustryStandard/Acpi10.h>
30#include <IndustryStandard/Acpi20.h>
31#include <IndustryStandard/SmBios.h>
32
33#include <Guid/SmBios.h>
34#include <Guid/Acpi.h>
35#include <Guid/Mps.h>
36
37#include "VBoxPkg.h"
38#include "DevEFI.h"
39#include "iprt/asm.h"
40
41/*******************************************************************************
42* Internal Functions *
43*******************************************************************************/
44
45
46EFI_STATUS EFIAPI
47ConvertSystemTable (
48 IN EFI_GUID *TableGuid,
49 IN OUT VOID **Table
50 );
51
52#define MPS_PTR SIGNATURE_32('_','M','P','_')
53#define SMBIOS_PTR SIGNATURE_32('_','S','M','_')
54
55#define EBDA_BASE (0x9FC0 << 4)
56
57VOID *
58FindSMBIOSPtr (
59 VOID
60 )
61{
62 UINTN Address;
63
64 //
65 // First Search 0x0f0000 - 0x0fffff for SMBIOS Ptr
66 //
67 for (Address = 0xf0000; Address < 0xfffff; Address += 0x10) {
68 if (*(UINT32 *)(Address) == SMBIOS_PTR) {
69 return (VOID *)Address;
70 }
71 }
72 return NULL;
73}
74
75VOID *
76FindMPSPtr (
77 VOID
78 )
79{
80 UINTN Address;
81 UINTN Index;
82
83 //
84 // First Search 0x0e0000 - 0x0fffff for MPS Ptr
85 //
86 for (Address = 0xe0000; Address < 0xfffff; Address += 0x10) {
87 if (*(UINT32 *)(Address) == MPS_PTR) {
88 return (VOID *)Address;
89 }
90 }
91
92 //
93 // Search EBDA
94 //
95
96 Address = EBDA_BASE;
97 for (Index = 0; Index < 0x400 ; Index += 16) {
98 if (*(UINT32 *)(Address + Index) == MPS_PTR) {
99 return (VOID *)(Address + Index);
100 }
101 }
102 return NULL;
103}
104
105EFI_STATUS EFIAPI
106ConvertAndInstallTable(EFI_GUID* Guid, VOID* Ptr)
107{
108 EFI_STATUS rc = EFI_SUCCESS;
109
110 rc = ConvertSystemTable(Guid, &Ptr);
111 ASSERT_EFI_ERROR (rc);
112
113 rc = gBS->InstallConfigurationTable(Guid, Ptr);
114 ASSERT_EFI_ERROR (rc);
115
116 return rc;
117}
118
119
120/**
121 * VBoxSysTablesDxe entry point.
122 *
123 * @returns EFI status code.
124 *
125 * @param ImageHandle The image handle.
126 * @param SystemTable The system table pointer.
127 */
128EFI_STATUS EFIAPI
129DxeInitializeVBoxSysTables(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
130{
131 EFI_STATUS rc;
132 VOID* Ptr;
133
134 DEBUG((DEBUG_INFO, "DxeInitializeVBoxSysTables\n"));
135
136 Ptr = FindSMBIOSPtr();
137 DEBUG((DEBUG_INFO, "SMBIOS=%p\n", Ptr));
138 ASSERT(Ptr != NULL);
139 if (Ptr)
140 rc = ConvertAndInstallTable(&gEfiSmbiosTableGuid, Ptr);
141
142 Ptr = FindMPSPtr();
143 DEBUG((DEBUG_INFO, "MPS=%p\n", Ptr));
144 // MPS can be null in non IO-APIC configs
145 if (Ptr)
146 rc = ConvertAndInstallTable(&gEfiMpsTableGuid, Ptr);
147
148 return EFI_SUCCESS;
149}
150
151EFI_STATUS EFIAPI
152DxeUninitializeVBoxSysTables(IN EFI_HANDLE ImageHandle)
153{
154 return EFI_SUCCESS;
155}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette