1 /**@file 2 3 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> 4 This program and the accompanying materials 5 are licensed and made available under the terms and conditions of the BSD License 6 which accompanies this distribution. The full text of the license may be found at 7 http://opensource.org/licenses/bsd-license.php 8 9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 12 Module Name: 13 14 CpuDriver.h 15 16 Abstract: 17 18 NT Emulation Architectural Protocol Driver as defined in Tiano. 19 20 **/ 21 22 #ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_ 23 #define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_ 24 25 26 #include <FrameworkDxe.h> 27 #include <IndustryStandard/SmBios.h> 28 #include <Protocol/Cpu.h> 29 #include <Protocol/Smbios.h> 30 #include <Protocol/FrameworkHii.h> 31 #include <Guid/DataHubRecords.h> 32 #include <Protocol/CpuIo2.h> 33 #include <Protocol/WinNtIo.h> 34 #include <Library/BaseLib.h> 35 #include <Library/DebugLib.h> 36 #include <Library/HiiLib.h> 37 #include <Library/UefiDriverEntryPoint.h> 38 #include <Library/BaseMemoryLib.h> 39 #include <Library/MemoryAllocationLib.h> 40 #include <Library/UefiBootServicesTableLib.h> 41 #include <Library/PcdLib.h> 42 #include <Library/WinNtLib.h> 43 44 45 extern UINT8 CpuStrings[]; 46 47 // 48 // Internal Data Structures 49 // 50 #define CPU_ARCH_PROT_PRIVATE_SIGNATURE SIGNATURE_32 ('c', 'a', 'p', 'd') 51 52 typedef struct { 53 UINTN Signature; 54 EFI_HANDLE Handle; 55 56 EFI_CPU_ARCH_PROTOCOL Cpu; 57 EFI_CPU_IO2_PROTOCOL CpuIo; 58 59 // 60 // Local Data for CPU interface goes here 61 // 62 CRITICAL_SECTION NtCriticalSection; 63 BOOLEAN InterruptState; 64 65 } CPU_ARCH_PROTOCOL_PRIVATE; 66 67 #define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \ 68 CR (a, \ 69 CPU_ARCH_PROTOCOL_PRIVATE, \ 70 Cpu, \ 71 CPU_ARCH_PROT_PRIVATE_SIGNATURE \ 72 ) 73 74 EFI_STATUS 75 EFIAPI 76 CpuMemoryServiceRead ( 77 IN EFI_CPU_IO2_PROTOCOL *This, 78 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 79 IN UINT64 Address, 80 IN UINTN Count, 81 IN OUT VOID *Buffer 82 ); 83 84 EFI_STATUS 85 EFIAPI 86 CpuMemoryServiceWrite ( 87 IN EFI_CPU_IO2_PROTOCOL *This, 88 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 89 IN UINT64 Address, 90 IN UINTN Count, 91 IN OUT VOID *Buffer 92 ); 93 94 EFI_STATUS 95 EFIAPI 96 CpuIoServiceRead ( 97 IN EFI_CPU_IO2_PROTOCOL *This, 98 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 99 IN UINT64 UserAddress, 100 IN UINTN Count, 101 IN OUT VOID *UserBuffer 102 ); 103 104 EFI_STATUS 105 EFIAPI 106 CpuIoServiceWrite ( 107 IN EFI_CPU_IO2_PROTOCOL *This, 108 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 109 IN UINT64 UserAddress, 110 IN UINTN Count, 111 IN OUT VOID *UserBuffer 112 ); 113 114 115 EFI_STATUS 116 EFIAPI 117 InitializeCpu ( 118 IN EFI_HANDLE ImageHandle, 119 IN EFI_SYSTEM_TABLE *SystemTable 120 ); 121 122 EFI_STATUS 123 EFIAPI 124 WinNtFlushCpuDataCache ( 125 IN EFI_CPU_ARCH_PROTOCOL *This, 126 IN EFI_PHYSICAL_ADDRESS Start, 127 IN UINT64 Length, 128 IN EFI_CPU_FLUSH_TYPE FlushType 129 ); 130 131 EFI_STATUS 132 EFIAPI 133 WinNtEnableInterrupt ( 134 IN EFI_CPU_ARCH_PROTOCOL *This 135 ); 136 137 EFI_STATUS 138 EFIAPI 139 WinNtDisableInterrupt ( 140 IN EFI_CPU_ARCH_PROTOCOL *This 141 ); 142 143 EFI_STATUS 144 EFIAPI 145 WinNtGetInterruptState ( 146 IN EFI_CPU_ARCH_PROTOCOL *This, 147 OUT BOOLEAN *State 148 ); 149 150 EFI_STATUS 151 EFIAPI 152 WinNtInit ( 153 IN EFI_CPU_ARCH_PROTOCOL *This, 154 IN EFI_CPU_INIT_TYPE InitType 155 ); 156 157 EFI_STATUS 158 EFIAPI 159 WinNtRegisterInterruptHandler ( 160 IN EFI_CPU_ARCH_PROTOCOL *This, 161 IN EFI_EXCEPTION_TYPE InterruptType, 162 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler 163 ); 164 165 EFI_STATUS 166 EFIAPI 167 WinNtGetTimerValue ( 168 IN EFI_CPU_ARCH_PROTOCOL *This, 169 IN UINT32 TimerIndex, 170 OUT UINT64 *TimerValue, 171 OUT UINT64 *TimerPeriod OPTIONAL 172 ); 173 174 EFI_STATUS 175 EFIAPI 176 WinNtSetMemoryAttributes ( 177 IN EFI_CPU_ARCH_PROTOCOL *This, 178 IN EFI_PHYSICAL_ADDRESS BaseAddress, 179 IN UINT64 Length, 180 IN UINT64 Attributes 181 ); 182 183 184 185 186 187 188 #endif 189