420fc8e5 |
1 | /*++\r |
2 | \r |
3 | Copyright (c) 2006, Intel Corporation \r |
4 | All rights reserved. This program and the accompanying materials \r |
5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r |
7 | http://opensource.org/licenses/bsd-license.php \r |
8 | \r |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r |
11 | \r |
12 | Module Name:\r |
13 | \r |
14 | WinNtBusDriver.h\r |
15 | \r |
16 | Abstract:\r |
17 | \r |
18 | This following section documents the envirnoment variables for the Win NT \r |
19 | build. These variables are used to define the (virtual) hardware \r |
20 | configuration of the NT environment\r |
21 | \r |
22 | A ! can be used to seperate multiple instances in a variable. Each \r |
23 | instance represents a seperate hardware device. \r |
24 | \r |
25 | EFI_WIN_NT_PHYSICAL_DISKS - maps to drives on your system\r |
26 | EFI_WIN_NT_VIRTUAL_DISKS - maps to a device emulated by a file\r |
27 | EFI_WIN_NT_FILE_SYSTEM - mouts a directory as a file system\r |
28 | EFI_WIN_NT_CONSOLE - make a logical comand line window (only one!)\r |
29 | EFI_WIN_NT_UGA - Builds UGA Windows of Width and Height\r |
30 | EFI_WIN_NT_SERIAL_PORT - maps physical serial ports\r |
31 | EFI_WIN_NT_PASS_THRU - associates a device with our PCI support\r |
32 | \r |
33 | <F>ixed - Fixed disk like a hard drive.\r |
34 | <R>emovable - Removable media like a floppy or CD-ROM.\r |
35 | Read <O>nly - Write protected device.\r |
36 | Read <W>rite - Read write device.\r |
37 | <block count> - Decimal number of blocks a device supports.\r |
38 | <block size> - Decimal number of bytes per block.\r |
39 | \r |
40 | NT envirnonment variable contents. '<' and '>' are not part of the variable, \r |
41 | they are just used to make this help more readable. There should be no \r |
42 | spaces between the ';'. Extra spaces will break the variable. A '!' is \r |
43 | used to seperate multiple devices in a variable.\r |
44 | \r |
45 | EFI_WIN_NT_VIRTUAL_DISKS = \r |
46 | <F | R><O | W>;<block count>;<block size>[!...]\r |
47 | \r |
48 | EFI_WIN_NT_PHYSICAL_DISKS =\r |
49 | <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]\r |
50 | \r |
51 | Virtual Disks: These devices use a file to emulate a hard disk or removable\r |
52 | media device. \r |
53 | \r |
54 | Thus a 20 MB emulated hard drive would look like:\r |
55 | EFI_WIN_NT_VIRTUAL_DISKS=FW;40960;512\r |
56 | \r |
57 | A 1.44MB emulated floppy with a block size of 1024 would look like:\r |
58 | EFI_WIN_NT_VIRTUAL_DISKS=RW;1440;1024\r |
59 | \r |
60 | Physical Disks: These devices use NT to open a real device in your system\r |
61 | \r |
62 | Thus a 120 MB floppy would look like:\r |
63 | EFI_WIN_NT_PHYSICAL_DISKS=B:RW;245760;512\r |
64 | \r |
65 | Thus a standard CD-ROM floppy would look like:\r |
66 | EFI_WIN_NT_PHYSICAL_DISKS=Z:RO;307200;2048\r |
67 | \r |
68 | EFI_WIN_NT_FILE_SYSTEM = \r |
69 | <directory path>[!...]\r |
70 | \r |
71 | Mounting the two directories C:\FOO and C:\BAR would look like:\r |
72 | EFI_WIN_NT_FILE_SYSTEM=c:\foo!c:\bar\r |
73 | \r |
74 | EFI_WIN_NT_CONSOLE = \r |
75 | <window title>\r |
76 | \r |
77 | Declaring a text console window with the title "My EFI Console" woild look like:\r |
78 | EFI_WIN_NT_CONSOLE=My EFI Console\r |
79 | \r |
80 | EFI_WIN_NT_UGA = \r |
81 | <width> <height>[!...]\r |
82 | \r |
83 | Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:\r |
84 | Example : EFI_WIN_NT_UGA=800 600!1024 768\r |
85 | \r |
86 | EFI_WIN_NT_SERIAL_PORT = \r |
87 | <port name>[!...]\r |
88 | \r |
89 | Declaring two serial ports on COM1 and COM2 would look like:\r |
90 | Example : EFI_WIN_NT_SERIAL_PORT=COM1!COM2\r |
91 | \r |
92 | EFI_WIN_NT_PASS_THROUGH =\r |
93 | <BaseAddress>;<Bus#>;<Device#>;<Function#>\r |
94 | \r |
95 | Declaring a base address of 0xE0000000 (used for PCI Express devices)\r |
96 | and having NT32 talk to a device located at bus 0, device 1, function 0:\r |
97 | Example : EFI_WIN_NT_PASS_THROUGH=E000000;0;1;0\r |
98 | \r |
99 | ---*/\r |
100 | \r |
101 | #ifndef __NT_BUS_DRIVER_H__\r |
102 | #define __NT_BUS_DRIVER_H__\r |
103 | \r |
104 | \r |
105 | //\r |
106 | // The package level header files this module uses\r |
107 | //\r |
108 | #include <Uefi.h>\r |
109 | #include <WinNtDxe.h>\r |
110 | //\r |
111 | // The protocols, PPI and GUID defintions for this module\r |
112 | //\r |
113 | #include <Protocol/WinNtIo.h>\r |
114 | #include <Protocol/ComponentName.h>\r |
115 | #include <Protocol/WinNtThunk.h>\r |
116 | #include <Protocol/DriverBinding.h>\r |
117 | #include <Protocol/DevicePath.h>\r |
118 | //\r |
119 | // The Library classes this module consumes\r |
120 | //\r |
121 | #include <Library/DebugLib.h>\r |
122 | #include <Library/BaseLib.h>\r |
123 | #include <Library/UefiDriverEntryPoint.h>\r |
124 | #include <Library/UefiLib.h>\r |
125 | #include <Library/PcdLib.h>\r |
126 | #include <Library/BaseMemoryLib.h>\r |
127 | #include <Library/UefiBootServicesTableLib.h>\r |
128 | #include <Library/DevicePathLib.h>\r |
129 | #include <Library/MemoryAllocationLib.h>\r |
130 | \r |
131 | //\r |
132 | // WinNt Bus Driver Global Variables\r |
133 | //\r |
134 | extern EFI_DRIVER_BINDING_PROTOCOL gWinNtBusDriverBinding;\r |
135 | extern EFI_COMPONENT_NAME_PROTOCOL gWinNtBusDriverComponentName;\r |
136 | \r |
137 | //\r |
138 | // WinNt Bus Controller Structure\r |
139 | //\r |
140 | #define WIN_NT_BUS_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'B', 'D')\r |
141 | \r |
142 | typedef struct {\r |
143 | UINT64 Signature;\r |
144 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r |
145 | } WIN_NT_BUS_DEVICE;\r |
146 | \r |
147 | //\r |
148 | // WinNt Child Device Controller Structure\r |
149 | //\r |
150 | #define WIN_NT_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'V', 'D')\r |
151 | \r |
152 | typedef struct {\r |
153 | UINT64 Signature;\r |
154 | EFI_HANDLE Handle;\r |
155 | EFI_WIN_NT_IO_PROTOCOL WinNtIo;\r |
156 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r |
157 | \r |
158 | //\r |
159 | // Private data about the parent\r |
160 | //\r |
161 | EFI_HANDLE ControllerHandle;\r |
162 | EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r |
163 | \r |
164 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r |
165 | \r |
166 | } WIN_NT_IO_DEVICE;\r |
167 | \r |
168 | #define WIN_NT_IO_DEVICE_FROM_THIS(a) \\r |
169 | CR(a, WIN_NT_IO_DEVICE, WinNtIo, WIN_NT_IO_DEVICE_SIGNATURE)\r |
170 | \r |
171 | //\r |
172 | // This is the largest env variable we can parse\r |
173 | //\r |
174 | #define MAX_NT_ENVIRNMENT_VARIABLE_LENGTH 512\r |
175 | \r |
176 | typedef struct {\r |
177 | UINTN Token;\r |
178 | EFI_GUID *DevicePathGuid;\r |
179 | } NT_PCD_ENTRY;\r |
180 | \r |
181 | typedef struct {\r |
182 | VENDOR_DEVICE_PATH VendorDevicePath;\r |
183 | UINT32 Instance;\r |
184 | } WIN_NT_VENDOR_DEVICE_PATH_NODE;\r |
185 | \r |
186 | EFI_STATUS\r |
187 | EFIAPI\r |
188 | CpuIoInitialize (\r |
189 | IN EFI_HANDLE ImageHandle,\r |
190 | IN EFI_SYSTEM_TABLE *SystemTable\r |
191 | )\r |
192 | /*++\r |
193 | \r |
194 | Routine Description:\r |
195 | \r |
196 | TODO: Add function description\r |
197 | \r |
198 | Arguments:\r |
199 | \r |
200 | ImageHandle - TODO: add argument description\r |
201 | SystemTable - TODO: add argument description\r |
202 | \r |
203 | Returns:\r |
204 | \r |
205 | TODO: add return values\r |
206 | \r |
207 | --*/\r |
208 | ;\r |
209 | \r |
210 | //\r |
211 | // Driver Binding Protocol function prototypes\r |
212 | //\r |
213 | EFI_STATUS\r |
214 | EFIAPI\r |
215 | WinNtBusDriverBindingSupported (\r |
216 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r |
217 | IN EFI_HANDLE Handle,\r |
218 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r |
219 | )\r |
220 | /*++\r |
221 | \r |
222 | Routine Description:\r |
223 | \r |
224 | TODO: Add function description\r |
225 | \r |
226 | Arguments:\r |
227 | \r |
228 | This - TODO: add argument description\r |
229 | Handle - TODO: add argument description\r |
230 | RemainingDevicePath - TODO: add argument description\r |
231 | \r |
232 | Returns:\r |
233 | \r |
234 | TODO: add return values\r |
235 | \r |
236 | --*/\r |
237 | ;\r |
238 | \r |
239 | EFI_STATUS\r |
240 | EFIAPI\r |
241 | WinNtBusDriverBindingStart (\r |
242 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r |
243 | IN EFI_HANDLE ParentHandle,\r |
244 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r |
245 | )\r |
246 | /*++\r |
247 | \r |
248 | Routine Description:\r |
249 | \r |
250 | TODO: Add function description\r |
251 | \r |
252 | Arguments:\r |
253 | \r |
254 | This - TODO: add argument description\r |
255 | ParentHandle - TODO: add argument description\r |
256 | RemainingDevicePath - TODO: add argument description\r |
257 | \r |
258 | Returns:\r |
259 | \r |
260 | TODO: add return values\r |
261 | \r |
262 | --*/\r |
263 | ;\r |
264 | \r |
265 | EFI_STATUS\r |
266 | EFIAPI\r |
267 | WinNtBusDriverBindingStop (\r |
268 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r |
269 | IN EFI_HANDLE Handle,\r |
270 | IN UINTN NumberOfChildren,\r |
271 | IN EFI_HANDLE *ChildHandleBuffer\r |
272 | )\r |
273 | /*++\r |
274 | \r |
275 | Routine Description:\r |
276 | \r |
277 | TODO: Add function description\r |
278 | \r |
279 | Arguments:\r |
280 | \r |
281 | This - TODO: add argument description\r |
282 | Handle - TODO: add argument description\r |
283 | NumberOfChildren - TODO: add argument description\r |
284 | ChildHandleBuffer - TODO: add argument description\r |
285 | \r |
286 | Returns:\r |
287 | \r |
288 | TODO: add return values\r |
289 | \r |
290 | --*/\r |
291 | ;\r |
292 | \r |
293 | //\r |
294 | // WinNt Bus Driver private worker functions\r |
295 | //\r |
296 | EFI_DEVICE_PATH_PROTOCOL *\r |
297 | WinNtBusCreateDevicePath (\r |
298 | IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,\r |
299 | IN EFI_GUID *Guid,\r |
300 | IN UINT16 InstanceNumber\r |
301 | )\r |
302 | /*++\r |
303 | \r |
304 | Routine Description:\r |
305 | \r |
306 | TODO: Add function description\r |
307 | \r |
308 | Arguments:\r |
309 | \r |
310 | RootDevicePath - TODO: add argument description\r |
311 | Guid - TODO: add argument description\r |
312 | InstanceNumber - TODO: add argument description\r |
313 | \r |
314 | Returns:\r |
315 | \r |
316 | TODO: add return values\r |
317 | \r |
318 | --*/\r |
319 | ;\r |
320 | \r |
321 | \r |
322 | #endif\r |