]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
OvmfPkg: BDS: drop custom boot timeout, revert to IntelFrameworkModulePkg's
[mirror_edk2.git] / OvmfPkg / Library / PlatformBdsLib / BdsPlatform.c
CommitLineData
49ba9447 1/** @file\r
2 Platform BDS customizations.\r
3\r
ea5396f3 4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
56d7640a 5 This program and the accompanying materials\r
49ba9447 6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "BdsPlatform.h"\r
2cd086a6 16#include "QemuBootOrder.h"\r
49ba9447 17\r
18\r
40f2c454 19//\r
20// Global data\r
21//\r
22\r
23VOID *mEfiDevPathNotifyReg;\r
24EFI_EVENT mEfiDevPathEvent;\r
9607962d 25VOID *mEmuVariableEventReg;\r
26EFI_EVENT mEmuVariableEvent;\r
e955462b 27BOOLEAN mDetectVgaOnly;\r
28\r
29\r
30//\r
31// Type definitions\r
32//\r
33\r
34typedef\r
35EFI_STATUS\r
36(EFIAPI *PROTOCOL_INSTANCE_CALLBACK)(\r
37 IN EFI_HANDLE Handle,\r
38 IN VOID *Instance,\r
39 IN VOID *Context\r
40 );\r
41\r
42/**\r
43 @param[in] Handle - Handle of PCI device instance\r
44 @param[in] PciIo - PCI IO protocol instance\r
45 @param[in] Pci - PCI Header register block\r
46**/\r
47typedef\r
48EFI_STATUS\r
49(EFIAPI *VISIT_PCI_INSTANCE_CALLBACK)(\r
50 IN EFI_HANDLE Handle,\r
51 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
52 IN PCI_TYPE00 *Pci\r
53 );\r
40f2c454 54\r
55\r
56//\r
57// Function prototypes\r
58//\r
59\r
e955462b 60EFI_STATUS\r
61VisitAllInstancesOfProtocol (\r
62 IN EFI_GUID *Id,\r
63 IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction,\r
64 IN VOID *Context\r
65 );\r
66\r
67EFI_STATUS\r
68VisitAllPciInstancesOfProtocol (\r
69 IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction\r
70 );\r
71\r
40f2c454 72VOID\r
73InstallDevicePathCallback (\r
74 VOID\r
75 );\r
76\r
49ba9447 77//\r
78// BDS Platform Functions\r
79//\r
80VOID\r
81EFIAPI\r
82PlatformBdsInit (\r
370ec7f1 83 VOID\r
49ba9447 84 )\r
85/*++\r
86\r
87Routine Description:\r
88\r
89 Platform Bds init. Incude the platform firmware vendor, revision\r
90 and so crc check.\r
91\r
92Arguments:\r
93\r
49ba9447 94Returns:\r
95\r
96 None.\r
97\r
98--*/\r
99{\r
100 DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));\r
40f2c454 101 InstallDevicePathCallback ();\r
49ba9447 102}\r
103\r
104\r
105EFI_STATUS\r
106ConnectRootBridge (\r
107 VOID\r
108 )\r
109/*++\r
110\r
111Routine Description:\r
112\r
113 Connect RootBridge\r
114\r
115Arguments:\r
116\r
117 None.\r
118\r
119Returns:\r
120\r
121 EFI_SUCCESS - Connect RootBridge successfully.\r
122 EFI_STATUS - Connect RootBridge fail.\r
123\r
124--*/\r
125{\r
126 EFI_STATUS Status;\r
127 EFI_HANDLE RootHandle;\r
128\r
129 //\r
130 // Make all the PCI_IO protocols on PCI Seg 0 show up\r
131 //\r
132 BdsLibConnectDevicePath (gPlatformRootBridges[0]);\r
133\r
134 Status = gBS->LocateDevicePath (\r
135 &gEfiDevicePathProtocolGuid,\r
136 &gPlatformRootBridges[0],\r
137 &RootHandle\r
138 );\r
139 if (EFI_ERROR (Status)) {\r
140 return Status;\r
141 }\r
142\r
143 Status = gBS->ConnectController (RootHandle, NULL, NULL, FALSE);\r
144 if (EFI_ERROR (Status)) {\r
145 return Status;\r
146 }\r
147\r
148 return EFI_SUCCESS;\r
149}\r
150\r
151\r
152EFI_STATUS\r
153PrepareLpcBridgeDevicePath (\r
154 IN EFI_HANDLE DeviceHandle\r
155 )\r
156/*++\r
157\r
158Routine Description:\r
159\r
160 Add IsaKeyboard to ConIn,\r
161 add IsaSerial to ConOut, ConIn, ErrOut.\r
162 LPC Bridge: 06 01 00\r
163\r
164Arguments:\r
165\r
166 DeviceHandle - Handle of PCIIO protocol.\r
167\r
168Returns:\r
169\r
170 EFI_SUCCESS - LPC bridge is added to ConOut, ConIn, and ErrOut.\r
171 EFI_STATUS - No LPC bridge is added.\r
172\r
173--*/\r
174{\r
175 EFI_STATUS Status;\r
176 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
177 EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;\r
178 CHAR16 *DevPathStr;\r
179\r
180 DevicePath = NULL;\r
181 Status = gBS->HandleProtocol (\r
182 DeviceHandle,\r
183 &gEfiDevicePathProtocolGuid,\r
184 (VOID*)&DevicePath\r
185 );\r
186 if (EFI_ERROR (Status)) {\r
187 return Status;\r
188 }\r
189 TempDevicePath = DevicePath;\r
190\r
191 //\r
192 // Register Keyboard\r
193 //\r
194 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode);\r
195\r
196 BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);\r
197\r
198 //\r
199 // Register COM1\r
200 //\r
201 DevicePath = TempDevicePath;\r
202 gPnp16550ComPortDeviceNode.UID = 0;\r
203\r
204 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);\r
205 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);\r
206 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);\r
207\r
208 //\r
209 // Print Device Path\r
210 //\r
211 DevPathStr = DevicePathToStr(DevicePath);\r
863986b3
RN
212 if (DevPathStr != NULL) {\r
213 DEBUG((\r
214 EFI_D_INFO,\r
215 "BdsPlatform.c+%d: COM%d DevPath: %s\n",\r
216 __LINE__,\r
217 gPnp16550ComPortDeviceNode.UID + 1,\r
218 DevPathStr\r
219 ));\r
220 FreePool(DevPathStr);\r
221 }\r
49ba9447 222\r
223 BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);\r
224 BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);\r
225 BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);\r
226\r
227 //\r
228 // Register COM2\r
229 //\r
230 DevicePath = TempDevicePath;\r
231 gPnp16550ComPortDeviceNode.UID = 1;\r
232\r
233 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);\r
234 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);\r
235 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);\r
236\r
237 //\r
238 // Print Device Path\r
239 //\r
240 DevPathStr = DevicePathToStr(DevicePath);\r
863986b3
RN
241 if (DevPathStr != NULL) {\r
242 DEBUG((\r
243 EFI_D_INFO,\r
244 "BdsPlatform.c+%d: COM%d DevPath: %s\n",\r
245 __LINE__,\r
246 gPnp16550ComPortDeviceNode.UID + 1,\r
247 DevPathStr\r
248 ));\r
249 FreePool(DevPathStr);\r
250 }\r
49ba9447 251\r
252 BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);\r
253 BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);\r
254 BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);\r
255\r
256 return EFI_SUCCESS;\r
257}\r
258\r
259EFI_STATUS\r
260GetGopDevicePath (\r
261 IN EFI_DEVICE_PATH_PROTOCOL *PciDevicePath,\r
262 OUT EFI_DEVICE_PATH_PROTOCOL **GopDevicePath\r
263 )\r
264{\r
265 UINTN Index;\r
266 EFI_STATUS Status;\r
267 EFI_HANDLE PciDeviceHandle;\r
268 EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;\r
269 EFI_DEVICE_PATH_PROTOCOL *TempPciDevicePath;\r
270 UINTN GopHandleCount;\r
271 EFI_HANDLE *GopHandleBuffer;\r
272\r
273 if (PciDevicePath == NULL || GopDevicePath == NULL) {\r
274 return EFI_INVALID_PARAMETER;\r
275 }\r
276\r
277 //\r
278 // Initialize the GopDevicePath to be PciDevicePath\r
279 //\r
280 *GopDevicePath = PciDevicePath;\r
281 TempPciDevicePath = PciDevicePath;\r
282\r
283 Status = gBS->LocateDevicePath (\r
284 &gEfiDevicePathProtocolGuid,\r
285 &TempPciDevicePath,\r
286 &PciDeviceHandle\r
287 );\r
288 if (EFI_ERROR (Status)) {\r
289 return Status;\r
290 }\r
291\r
292 //\r
293 // Try to connect this handle, so that GOP dirver could start on this\r
294 // device and create child handles with GraphicsOutput Protocol installed\r
295 // on them, then we get device paths of these child handles and select\r
296 // them as possible console device.\r
297 //\r
298 gBS->ConnectController (PciDeviceHandle, NULL, NULL, FALSE);\r
299\r
300 Status = gBS->LocateHandleBuffer (\r
301 ByProtocol,\r
302 &gEfiGraphicsOutputProtocolGuid,\r
303 NULL,\r
304 &GopHandleCount,\r
305 &GopHandleBuffer\r
306 );\r
307 if (!EFI_ERROR (Status)) {\r
308 //\r
309 // Add all the child handles as possible Console Device\r
310 //\r
311 for (Index = 0; Index < GopHandleCount; Index++) {\r
312 Status = gBS->HandleProtocol (GopHandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID*)&TempDevicePath);\r
313 if (EFI_ERROR (Status)) {\r
314 continue;\r
315 }\r
316 if (CompareMem (\r
317 PciDevicePath,\r
318 TempDevicePath,\r
319 GetDevicePathSize (PciDevicePath) - END_DEVICE_PATH_LENGTH\r
320 ) == 0) {\r
321 //\r
322 // In current implementation, we only enable one of the child handles\r
323 // as console device, i.e. sotre one of the child handle's device\r
324 // path to variable "ConOut"\r
325 // In futhure, we could select all child handles to be console device\r
326 //\r
327\r
328 *GopDevicePath = TempDevicePath;\r
329\r
330 //\r
331 // Delete the PCI device's path that added by GetPlugInPciVgaDevicePath()\r
332 // Add the integrity GOP device path.\r
333 //\r
334 BdsLibUpdateConsoleVariable (VarConsoleOutDev, NULL, PciDevicePath);\r
335 BdsLibUpdateConsoleVariable (VarConsoleOutDev, TempDevicePath, NULL);\r
336 }\r
337 }\r
338 gBS->FreePool (GopHandleBuffer);\r
339 }\r
340\r
341 return EFI_SUCCESS;\r
342}\r
343\r
344EFI_STATUS\r
345PreparePciVgaDevicePath (\r
346 IN EFI_HANDLE DeviceHandle\r
347 )\r
348/*++\r
349\r
350Routine Description:\r
351\r
352 Add PCI VGA to ConOut.\r
353 PCI VGA: 03 00 00\r
354\r
355Arguments:\r
356\r
357 DeviceHandle - Handle of PCIIO protocol.\r
358\r
359Returns:\r
360\r
361 EFI_SUCCESS - PCI VGA is added to ConOut.\r
362 EFI_STATUS - No PCI VGA device is added.\r
363\r
364--*/\r
365{\r
366 EFI_STATUS Status;\r
367 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
368 EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;\r
369\r
ea5396f3
RN
370 DevicePath = NULL;\r
371 GopDevicePath = NULL;\r
49ba9447 372 Status = gBS->HandleProtocol (\r
373 DeviceHandle,\r
374 &gEfiDevicePathProtocolGuid,\r
375 (VOID*)&DevicePath\r
376 );\r
377 if (EFI_ERROR (Status)) {\r
378 return Status;\r
379 }\r
380\r
381 GetGopDevicePath (DevicePath, &GopDevicePath);\r
382 DevicePath = GopDevicePath;\r
383\r
384 BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);\r
385\r
386 return EFI_SUCCESS;\r
387}\r
388\r
389EFI_STATUS\r
390PreparePciSerialDevicePath (\r
391 IN EFI_HANDLE DeviceHandle\r
392 )\r
393/*++\r
394\r
395Routine Description:\r
396\r
397 Add PCI Serial to ConOut, ConIn, ErrOut.\r
398 PCI Serial: 07 00 02\r
399\r
400Arguments:\r
401\r
402 DeviceHandle - Handle of PCIIO protocol.\r
403\r
404Returns:\r
405\r
406 EFI_SUCCESS - PCI Serial is added to ConOut, ConIn, and ErrOut.\r
407 EFI_STATUS - No PCI Serial device is added.\r
408\r
409--*/\r
410{\r
411 EFI_STATUS Status;\r
412 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
413\r
414 DevicePath = NULL;\r
415 Status = gBS->HandleProtocol (\r
416 DeviceHandle,\r
417 &gEfiDevicePathProtocolGuid,\r
418 (VOID*)&DevicePath\r
419 );\r
420 if (EFI_ERROR (Status)) {\r
421 return Status;\r
422 }\r
423\r
424 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);\r
425 DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);\r
426\r
427 BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);\r
428 BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);\r
429 BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);\r
430\r
431 return EFI_SUCCESS;\r
432}\r
433\r
434EFI_STATUS\r
e955462b 435VisitAllInstancesOfProtocol (\r
436 IN EFI_GUID *Id,\r
437 IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction,\r
438 IN VOID *Context\r
49ba9447 439 )\r
49ba9447 440{\r
441 EFI_STATUS Status;\r
442 UINTN HandleCount;\r
443 EFI_HANDLE *HandleBuffer;\r
444 UINTN Index;\r
e955462b 445 VOID *Instance;\r
49ba9447 446\r
447 //\r
448 // Start to check all the PciIo to find all possible device\r
449 //\r
450 HandleCount = 0;\r
451 HandleBuffer = NULL;\r
452 Status = gBS->LocateHandleBuffer (\r
453 ByProtocol,\r
e955462b 454 Id,\r
49ba9447 455 NULL,\r
456 &HandleCount,\r
457 &HandleBuffer\r
458 );\r
459 if (EFI_ERROR (Status)) {\r
460 return Status;\r
461 }\r
462\r
463 for (Index = 0; Index < HandleCount; Index++) {\r
e955462b 464 Status = gBS->HandleProtocol (HandleBuffer[Index], Id, &Instance);\r
49ba9447 465 if (EFI_ERROR (Status)) {\r
466 continue;\r
467 }\r
468\r
e955462b 469 Status = (*CallBackFunction) (\r
470 HandleBuffer[Index],\r
471 Instance,\r
472 Context\r
473 );\r
474 }\r
49ba9447 475\r
e955462b 476 gBS->FreePool (HandleBuffer);\r
607ca510 477\r
e955462b 478 return EFI_SUCCESS;\r
479}\r
480\r
481\r
482EFI_STATUS\r
483EFIAPI\r
484VisitingAPciInstance (\r
485 IN EFI_HANDLE Handle,\r
486 IN VOID *Instance,\r
487 IN VOID *Context\r
488 )\r
489{\r
490 EFI_STATUS Status;\r
491 EFI_PCI_IO_PROTOCOL *PciIo;\r
492 PCI_TYPE00 Pci;\r
493\r
494 PciIo = (EFI_PCI_IO_PROTOCOL*) Instance;\r
495\r
496 //\r
497 // Check for all PCI device\r
498 //\r
499 Status = PciIo->Pci.Read (\r
500 PciIo,\r
501 EfiPciIoWidthUint32,\r
502 0,\r
503 sizeof (Pci) / sizeof (UINT32),\r
504 &Pci\r
505 );\r
506 if (EFI_ERROR (Status)) {\r
507 return Status;\r
508 }\r
509\r
7d9cf3f2 510 return (*(VISIT_PCI_INSTANCE_CALLBACK)(UINTN) Context) (\r
e955462b 511 Handle,\r
512 PciIo,\r
513 &Pci\r
514 );\r
515\r
516}\r
517\r
518\r
519\r
520EFI_STATUS\r
521VisitAllPciInstances (\r
522 IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction\r
523 )\r
524{\r
525 return VisitAllInstancesOfProtocol (\r
526 &gEfiPciIoProtocolGuid,\r
527 VisitingAPciInstance,\r
7d9cf3f2 528 (VOID*)(UINTN) CallBackFunction\r
e955462b 529 );\r
530}\r
531\r
532\r
533/**\r
534 Do platform specific PCI Device check and add them to\r
535 ConOut, ConIn, ErrOut.\r
536\r
537 @param[in] Handle - Handle of PCI device instance\r
538 @param[in] PciIo - PCI IO protocol instance\r
539 @param[in] Pci - PCI Header register block\r
540\r
541 @retval EFI_SUCCESS - PCI Device check and Console variable update successfully.\r
542 @retval EFI_STATUS - PCI Device check or Console variable update fail.\r
543\r
544**/\r
545EFI_STATUS\r
8861fc79 546EFIAPI\r
e955462b 547DetectAndPreparePlatformPciDevicePath (\r
548 IN EFI_HANDLE Handle,\r
549 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
550 IN PCI_TYPE00 *Pci\r
551 )\r
552{\r
553 EFI_STATUS Status;\r
554\r
555 Status = PciIo->Attributes (\r
556 PciIo,\r
557 EfiPciIoAttributeOperationEnable,\r
558 EFI_PCI_DEVICE_ENABLE,\r
559 NULL\r
560 );\r
561 ASSERT_EFI_ERROR (Status);\r
562\r
563 if (!mDetectVgaOnly) {\r
564 //\r
565 // Here we decide whether it is LPC Bridge\r
566 //\r
567 if ((IS_PCI_LPC (Pci)) ||\r
568 ((IS_PCI_ISA_PDECODE (Pci)) &&\r
569 (Pci->Hdr.VendorId == 0x8086) &&\r
570 (Pci->Hdr.DeviceId == 0x7000)\r
571 )\r
572 ) {\r
49ba9447 573 //\r
e955462b 574 // Add IsaKeyboard to ConIn,\r
575 // add IsaSerial to ConOut, ConIn, ErrOut\r
49ba9447 576 //\r
e955462b 577 DEBUG ((EFI_D_INFO, "Found LPC Bridge device\n"));\r
578 PrepareLpcBridgeDevicePath (Handle);\r
579 return EFI_SUCCESS;\r
49ba9447 580 }\r
49ba9447 581 //\r
e955462b 582 // Here we decide which Serial device to enable in PCI bus\r
49ba9447 583 //\r
e955462b 584 if (IS_PCI_16550SERIAL (Pci)) {\r
49ba9447 585 //\r
e955462b 586 // Add them to ConOut, ConIn, ErrOut.\r
49ba9447 587 //\r
e955462b 588 DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device\n"));\r
589 PreparePciSerialDevicePath (Handle);\r
590 return EFI_SUCCESS;\r
49ba9447 591 }\r
592 }\r
593\r
e955462b 594 //\r
595 // Here we decide which VGA device to enable in PCI bus\r
596 //\r
597 if (IS_PCI_VGA (Pci)) {\r
598 //\r
599 // Add them to ConOut.\r
600 //\r
601 DEBUG ((EFI_D_INFO, "Found PCI VGA device\n"));\r
602 PreparePciVgaDevicePath (Handle);\r
603 return EFI_SUCCESS;\r
604 }\r
49ba9447 605\r
e955462b 606 return Status;\r
607}\r
608\r
609\r
610/**\r
611 Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut\r
612\r
613 @param[in] DetectVgaOnly - Only detect VGA device if it's TRUE.\r
614\r
615 @retval EFI_SUCCESS - PCI Device check and Console variable update successfully.\r
616 @retval EFI_STATUS - PCI Device check or Console variable update fail.\r
617\r
618**/\r
619EFI_STATUS\r
620DetectAndPreparePlatformPciDevicePaths (\r
621 BOOLEAN DetectVgaOnly\r
622 )\r
623{\r
624 mDetectVgaOnly = DetectVgaOnly;\r
625 return VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);\r
49ba9447 626}\r
627\r
628\r
629EFI_STATUS\r
630PlatformBdsConnectConsole (\r
631 IN BDS_CONSOLE_CONNECT_ENTRY *PlatformConsole\r
632 )\r
633/*++\r
634\r
635Routine Description:\r
636\r
637 Connect the predefined platform default console device. Always try to find\r
638 and enable the vga device if have.\r
639\r
640Arguments:\r
641\r
642 PlatformConsole - Predfined platform default console device array.\r
643\r
644Returns:\r
645\r
646 EFI_SUCCESS - Success connect at least one ConIn and ConOut\r
647 device, there must have one ConOut device is\r
648 active vga device.\r
649\r
650 EFI_STATUS - Return the status of\r
651 BdsLibConnectAllDefaultConsoles ()\r
652\r
653--*/\r
654{\r
655 EFI_STATUS Status;\r
656 UINTN Index;\r
657 EFI_DEVICE_PATH_PROTOCOL *VarConout;\r
658 EFI_DEVICE_PATH_PROTOCOL *VarConin;\r
659 UINTN DevicePathSize;\r
660\r
661 //\r
662 // Connect RootBridge\r
663 //\r
49ba9447 664 VarConout = BdsLibGetVariableAndSize (\r
665 VarConsoleOut,\r
666 &gEfiGlobalVariableGuid,\r
667 &DevicePathSize\r
668 );\r
669 VarConin = BdsLibGetVariableAndSize (\r
670 VarConsoleInp,\r
671 &gEfiGlobalVariableGuid,\r
672 &DevicePathSize\r
673 );\r
674\r
675 if (VarConout == NULL || VarConin == NULL) {\r
676 //\r
677 // Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut\r
678 //\r
e955462b 679 DetectAndPreparePlatformPciDevicePaths (FALSE);\r
49ba9447 680\r
681 //\r
682 // Have chance to connect the platform default console,\r
683 // the platform default console is the minimue device group\r
684 // the platform should support\r
685 //\r
686 for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) {\r
687 //\r
688 // Update the console variable with the connect type\r
689 //\r
690 if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {\r
691 BdsLibUpdateConsoleVariable (VarConsoleInp, PlatformConsole[Index].DevicePath, NULL);\r
692 }\r
693 if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {\r
694 BdsLibUpdateConsoleVariable (VarConsoleOut, PlatformConsole[Index].DevicePath, NULL);\r
695 }\r
696 if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {\r
697 BdsLibUpdateConsoleVariable (VarErrorOut, PlatformConsole[Index].DevicePath, NULL);\r
698 }\r
699 }\r
700 } else {\r
701 //\r
702 // Only detect VGA device and add them to ConOut\r
703 //\r
e955462b 704 DetectAndPreparePlatformPciDevicePaths (TRUE);\r
49ba9447 705 }\r
706\r
707 //\r
708 // Connect the all the default console with current cosole variable\r
709 //\r
710 Status = BdsLibConnectAllDefaultConsoles ();\r
711 if (EFI_ERROR (Status)) {\r
712 return Status;\r
713 }\r
714\r
715 return EFI_SUCCESS;\r
716}\r
717\r
718\r
719VOID\r
720PciInitialization (\r
721 )\r
722{\r
723 //\r
40f2c454 724 // Bus 0, Device 0, Function 0 - Host to PCI Bridge\r
725 //\r
726 PciWrite8 (PCI_LIB_ADDRESS (0, 0, 0, 0x3c), 0x00);\r
727\r
728 //\r
729 // Bus 0, Device 1, Function 0 - PCI to ISA Bridge\r
49ba9447 730 //\r
40f2c454 731 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x3c), 0x00);\r
05c89c7f 732 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x60), 0x0b); // LNKA routing target\r
733 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x61), 0x0b); // LNKB routing target\r
734 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x62), 0x0a); // LNKC routing target\r
735 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x63), 0x0a); // LNKD routing target\r
49ba9447 736\r
737 //\r
40f2c454 738 // Bus 0, Device 1, Function 1 - IDE Controller\r
49ba9447 739 //\r
40f2c454 740 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 1, 0x3c), 0x00);\r
741 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 1, 0x0d), 0x40);\r
49ba9447 742\r
743 //\r
40f2c454 744 // Bus 0, Device 1, Function 3 - Power Managment Controller\r
49ba9447 745 //\r
05c89c7f 746 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3c), 0x09);\r
747 PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3d), 0x01); // INTA\r
49ba9447 748\r
749 //\r
40f2c454 750 // Bus 0, Device 2, Function 0 - Video Controller\r
49ba9447 751 //\r
40f2c454 752 PciWrite8 (PCI_LIB_ADDRESS (0, 2, 0, 0x3c), 0x00);\r
49ba9447 753\r
754 //\r
40f2c454 755 // Bus 0, Device 3, Function 0 - Network Controller\r
49ba9447 756 //\r
05c89c7f 757 PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3c), 0x0a);\r
758 PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3d), 0x01); // INTA (-> LNKC)\r
49ba9447 759\r
760 //\r
a5595b1e 761 // Bus 0, Device 5, Function 0 - RAM Memory\r
49ba9447 762 //\r
05c89c7f 763 PciWrite8 (PCI_LIB_ADDRESS (0, 5, 0, 0x3c), 0x0b);\r
764 PciWrite8 (PCI_LIB_ADDRESS (0, 5, 0, 0x3d), 0x01); // INTA (-> LNKA)\r
49ba9447 765}\r
766\r
767\r
9b167857 768VOID\r
769AcpiInitialization (\r
770 VOID\r
771 )\r
772{\r
773 //\r
774 // Set ACPI SCI_EN bit in PMCNTRL\r
775 //\r
776 IoOr16 ((PciRead32 (PCI_LIB_ADDRESS (0, 1, 3, 0x40)) & ~BIT0) + 4, BIT0);\r
777}\r
778\r
779\r
14b21de9 780EFI_STATUS\r
781EFIAPI\r
782ConnectRecursivelyIfPciMassStorage (\r
783 IN EFI_HANDLE Handle,\r
784 IN EFI_PCI_IO_PROTOCOL *Instance,\r
785 IN PCI_TYPE00 *PciHeader\r
786 )\r
787{\r
788 EFI_STATUS Status;\r
789 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
790 CHAR16 *DevPathStr;\r
791\r
792 if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) {\r
793 DevicePath = NULL;\r
794 Status = gBS->HandleProtocol (\r
795 Handle,\r
796 &gEfiDevicePathProtocolGuid,\r
797 (VOID*)&DevicePath\r
798 );\r
799 if (EFI_ERROR (Status)) {\r
800 return Status;\r
801 }\r
802\r
803 //\r
804 // Print Device Path\r
805 //\r
806 DevPathStr = DevicePathToStr (DevicePath);\r
863986b3
RN
807 if (DevPathStr != NULL) {\r
808 DEBUG((\r
809 EFI_D_INFO,\r
810 "Found Mass Storage device: %s\n",\r
811 DevPathStr\r
812 ));\r
813 FreePool(DevPathStr);\r
814 }\r
14b21de9 815\r
816 Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);\r
817 if (EFI_ERROR (Status)) {\r
818 return Status;\r
819 }\r
820\r
821 }\r
822\r
823 return EFI_SUCCESS;\r
824}\r
825\r
826\r
9607962d 827/**\r
828 This notification function is invoked when the\r
829 EMU Variable FVB has been changed.\r
830\r
831 @param Event The event that occured\r
832 @param Context For EFI compatiblity. Not used.\r
833\r
834**/\r
835VOID\r
836EFIAPI\r
837EmuVariablesUpdatedCallback (\r
838 IN EFI_EVENT Event,\r
839 IN VOID *Context\r
840 )\r
841{\r
842 DEBUG ((EFI_D_INFO, "EmuVariablesUpdatedCallback\n"));\r
843 UpdateNvVarsOnFileSystem ();\r
844}\r
845\r
846\r
14b21de9 847EFI_STATUS\r
848EFIAPI\r
849VisitingFileSystemInstance (\r
850 IN EFI_HANDLE Handle,\r
851 IN VOID *Instance,\r
852 IN VOID *Context\r
853 )\r
854{\r
855 EFI_STATUS Status;\r
856 STATIC BOOLEAN ConnectedToFileSystem = FALSE;\r
857\r
858 if (ConnectedToFileSystem) {\r
859 return EFI_ALREADY_STARTED;\r
860 }\r
861\r
862 Status = ConnectNvVarsToFileSystem (Handle);\r
863 if (EFI_ERROR (Status)) {\r
864 return Status;\r
865 }\r
866\r
867 ConnectedToFileSystem = TRUE;\r
9607962d 868 mEmuVariableEvent =\r
869 EfiCreateProtocolNotifyEvent (\r
870 &gEfiDevicePathProtocolGuid,\r
871 TPL_CALLBACK,\r
872 EmuVariablesUpdatedCallback,\r
873 NULL,\r
874 &mEmuVariableEventReg\r
875 );\r
876 PcdSet64 (PcdEmuVariableEvent, (UINT64)(UINTN) mEmuVariableEvent);\r
877\r
14b21de9 878 return EFI_SUCCESS;\r
879}\r
880\r
881\r
882VOID\r
883PlatformBdsRestoreNvVarsFromHardDisk (\r
884 )\r
885{\r
886 VisitAllPciInstances (ConnectRecursivelyIfPciMassStorage);\r
887 VisitAllInstancesOfProtocol (\r
888 &gEfiSimpleFileSystemProtocolGuid,\r
889 VisitingFileSystemInstance,\r
890 NULL\r
891 );\r
3d131d1a 892\r
14b21de9 893}\r
894\r
895\r
49ba9447 896VOID\r
897PlatformBdsConnectSequence (\r
898 VOID\r
899 )\r
900/*++\r
901\r
902Routine Description:\r
903\r
904 Connect with predeined platform connect sequence,\r
905 the OEM/IBV can customize with their own connect sequence.\r
906\r
907Arguments:\r
908\r
909 None.\r
910\r
911Returns:\r
912\r
913 None.\r
914\r
915--*/\r
916{\r
917 UINTN Index;\r
918\r
919 DEBUG ((EFI_D_INFO, "PlatformBdsConnectSequence\n"));\r
920\r
921 Index = 0;\r
922\r
923 //\r
924 // Here we can get the customized platform connect sequence\r
925 // Notes: we can connect with new variable which record the\r
926 // last time boots connect device path sequence\r
927 //\r
928 while (gPlatformConnectSequence[Index] != NULL) {\r
929 //\r
930 // Build the platform boot option\r
931 //\r
932 BdsLibConnectDevicePath (gPlatformConnectSequence[Index]);\r
933 Index++;\r
934 }\r
935\r
936 //\r
937 // Just use the simple policy to connect all devices\r
938 //\r
939 BdsLibConnectAll ();\r
940\r
941 PciInitialization ();\r
9b167857 942 AcpiInitialization ();\r
40f2c454 943\r
944 //\r
945 // Clear the logo after all devices are connected.\r
946 //\r
947 gST->ConOut->ClearScreen (gST->ConOut);\r
49ba9447 948}\r
949\r
950VOID\r
951PlatformBdsGetDriverOption (\r
952 IN OUT LIST_ENTRY *BdsDriverLists\r
953 )\r
954/*++\r
955\r
956Routine Description:\r
957\r
958 Load the predefined driver option, OEM/IBV can customize this\r
959 to load their own drivers\r
960\r
961Arguments:\r
962\r
963 BdsDriverLists - The header of the driver option link list.\r
964\r
965Returns:\r
966\r
967 None.\r
968\r
969--*/\r
970{\r
971 DEBUG ((EFI_D_INFO, "PlatformBdsGetDriverOption\n"));\r
972 return;\r
973}\r
974\r
975VOID\r
976PlatformBdsDiagnostics (\r
977 IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,\r
d18476d0 978 IN BOOLEAN QuietBoot,\r
979 IN BASEM_MEMORY_TEST BaseMemoryTest\r
49ba9447 980 )\r
981/*++\r
982\r
983Routine Description:\r
984\r
985 Perform the platform diagnostic, such like test memory. OEM/IBV also\r
986 can customize this fuction to support specific platform diagnostic.\r
987\r
988Arguments:\r
989\r
990 MemoryTestLevel - The memory test intensive level\r
991\r
992 QuietBoot - Indicate if need to enable the quiet boot\r
993\r
d18476d0 994 BaseMemoryTest - A pointer to BaseMemoryTest()\r
995\r
49ba9447 996Returns:\r
997\r
998 None.\r
999\r
1000--*/\r
1001{\r
1002 EFI_STATUS Status;\r
1003\r
1004 DEBUG ((EFI_D_INFO, "PlatformBdsDiagnostics\n"));\r
1005\r
1006 //\r
1007 // Here we can decide if we need to show\r
1008 // the diagnostics screen\r
1009 // Notes: this quiet boot code should be remove\r
1010 // from the graphic lib\r
1011 //\r
1012 if (QuietBoot) {\r
d46f3632 1013 EnableQuietBoot (PcdGetPtr(PcdLogoFile));\r
49ba9447 1014 //\r
1015 // Perform system diagnostic\r
1016 //\r
d18476d0 1017 Status = BaseMemoryTest (MemoryTestLevel);\r
49ba9447 1018 if (EFI_ERROR (Status)) {\r
1019 DisableQuietBoot ();\r
1020 }\r
1021\r
1022 return ;\r
1023 }\r
1024 //\r
1025 // Perform system diagnostic\r
1026 //\r
d18476d0 1027 Status = BaseMemoryTest (MemoryTestLevel);\r
49ba9447 1028}\r
1029\r
1030\r
1031VOID\r
1032EFIAPI\r
1033PlatformBdsPolicyBehavior (\r
49ba9447 1034 IN OUT LIST_ENTRY *DriverOptionList,\r
d18476d0 1035 IN OUT LIST_ENTRY *BootOptionList,\r
1036 IN PROCESS_CAPSULES ProcessCapsules,\r
1037 IN BASEM_MEMORY_TEST BaseMemoryTest\r
49ba9447 1038 )\r
1039/*++\r
1040\r
1041Routine Description:\r
1042\r
1043 The function will excute with as the platform policy, current policy\r
1044 is driven by boot mode. IBV/OEM can customize this code for their specific\r
1045 policy action.\r
1046\r
1047Arguments:\r
1048\r
49ba9447 1049 DriverOptionList - The header of the driver option link list\r
1050\r
1051 BootOptionList - The header of the boot option link list\r
1052\r
d18476d0 1053 ProcessCapsules - A pointer to ProcessCapsules()\r
1054\r
1055 BaseMemoryTest - A pointer to BaseMemoryTest()\r
1056\r
49ba9447 1057Returns:\r
1058\r
1059 None.\r
1060\r
1061--*/\r
1062{\r
1063 EFI_STATUS Status;\r
1064 UINT16 Timeout;\r
370ec7f1 1065 EFI_BOOT_MODE BootMode;\r
49ba9447 1066\r
1067 DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));\r
1068\r
14b21de9 1069 ConnectRootBridge ();\r
1070\r
2590861a
LE
1071 if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {\r
1072 DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "\r
1073 "from disk since flash variables appear to be supported.\n"));\r
1074 } else {\r
1075 //\r
1076 // Try to restore variables from the hard disk early so\r
1077 // they can be used for the other BDS connect operations.\r
1078 //\r
1079 PlatformBdsRestoreNvVarsFromHardDisk ();\r
1080 }\r
14b21de9 1081\r
49ba9447 1082 //\r
1083 // Init the time out value\r
1084 //\r
1085 Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
1086\r
1087 //\r
1088 // Load the driver option as the driver option list\r
1089 //\r
1090 PlatformBdsGetDriverOption (DriverOptionList);\r
1091\r
1092 //\r
1093 // Get current Boot Mode\r
1094 //\r
370ec7f1 1095 Status = BdsLibGetBootMode (&BootMode);\r
1096 DEBUG ((EFI_D_ERROR, "Boot Mode:%x\n", BootMode));\r
49ba9447 1097\r
1098 //\r
1099 // Go the different platform policy with different boot mode\r
1100 // Notes: this part code can be change with the table policy\r
1101 //\r
370ec7f1 1102 ASSERT (BootMode == BOOT_WITH_FULL_CONFIGURATION);\r
49ba9447 1103 //\r
1104 // Connect platform console\r
1105 //\r
1106 Status = PlatformBdsConnectConsole (gPlatformConsole);\r
1107 if (EFI_ERROR (Status)) {\r
1108 //\r
1109 // Here OEM/IBV can customize with defined action\r
1110 //\r
1111 PlatformBdsNoConsoleAction ();\r
1112 }\r
b1220e28 1113\r
49ba9447 1114 //\r
1115 // Memory test and Logo show\r
1116 //\r
d18476d0 1117 PlatformBdsDiagnostics (IGNORE, TRUE, BaseMemoryTest);\r
49ba9447 1118\r
1119 //\r
1120 // Perform some platform specific connect sequence\r
1121 //\r
1122 PlatformBdsConnectSequence ();\r
1123\r
52fba289 1124 //\r
1125 // Process QEMU's -kernel command line option\r
1126 //\r
1127 TryRunningQemuKernel ();\r
1128\r
49ba9447 1129 DEBUG ((EFI_D_INFO, "BdsLibConnectAll\n"));\r
1130 BdsLibConnectAll ();\r
1131 BdsLibEnumerateAllBootOption (BootOptionList);\r
1132\r
2cd086a6 1133 SetBootOrderFromQemu (BootOptionList);\r
49ba9447 1134 //\r
de5ae37b
LE
1135 // The BootOrder variable may have changed, reload the in-memory list with\r
1136 // it.\r
49ba9447 1137 //\r
de5ae37b 1138 BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");\r
49ba9447 1139\r
b1220e28 1140 PlatformBdsEnterFrontPage (Timeout, TRUE);\r
49ba9447 1141}\r
1142\r
1143VOID\r
1144EFIAPI\r
1145PlatformBdsBootSuccess (\r
1146 IN BDS_COMMON_OPTION *Option\r
1147 )\r
1148/*++\r
1149\r
1150Routine Description:\r
1151\r
1152 Hook point after a boot attempt succeeds. We don't expect a boot option to\r
1153 return, so the EFI 1.0 specification defines that you will default to an\r
1154 interactive mode and stop processing the BootOrder list in this case. This\r
1155 is alos a platform implementation and can be customized by IBV/OEM.\r
1156\r
1157Arguments:\r
1158\r
1159 Option - Pointer to Boot Option that succeeded to boot.\r
1160\r
1161Returns:\r
1162\r
1163 None.\r
1164\r
1165--*/\r
1166{\r
1167 CHAR16 *TmpStr;\r
1168\r
1169 DEBUG ((EFI_D_INFO, "PlatformBdsBootSuccess\n"));\r
1170 //\r
1171 // If Boot returned with EFI_SUCCESS and there is not in the boot device\r
1172 // select loop then we need to pop up a UI and wait for user input.\r
1173 //\r
1174 TmpStr = Option->StatusString;\r
1175 if (TmpStr != NULL) {\r
1176 BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);\r
1177 FreePool (TmpStr);\r
1178 }\r
1179}\r
1180\r
1181VOID\r
1182EFIAPI\r
1183PlatformBdsBootFail (\r
1184 IN BDS_COMMON_OPTION *Option,\r
1185 IN EFI_STATUS Status,\r
1186 IN CHAR16 *ExitData,\r
1187 IN UINTN ExitDataSize\r
1188 )\r
1189/*++\r
1190\r
1191Routine Description:\r
1192\r
1193 Hook point after a boot attempt fails.\r
1194\r
1195Arguments:\r
1196\r
1197 Option - Pointer to Boot Option that failed to boot.\r
1198\r
1199 Status - Status returned from failed boot.\r
1200\r
1201 ExitData - Exit data returned from failed boot.\r
1202\r
1203 ExitDataSize - Exit data size returned from failed boot.\r
1204\r
1205Returns:\r
1206\r
1207 None.\r
1208\r
1209--*/\r
1210{\r
1211 CHAR16 *TmpStr;\r
1212\r
1213 DEBUG ((EFI_D_INFO, "PlatformBdsBootFail\n"));\r
1214\r
1215 //\r
1216 // If Boot returned with failed status then we need to pop up a UI and wait\r
1217 // for user input.\r
1218 //\r
1219 TmpStr = Option->StatusString;\r
1220 if (TmpStr != NULL) {\r
1221 BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);\r
1222 FreePool (TmpStr);\r
1223 }\r
1224}\r
1225\r
1226EFI_STATUS\r
1227PlatformBdsNoConsoleAction (\r
1228 VOID\r
1229 )\r
1230/*++\r
1231\r
1232Routine Description:\r
1233\r
1234 This function is remained for IBV/OEM to do some platform action,\r
1235 if there no console device can be connected.\r
1236\r
1237Arguments:\r
1238\r
1239 None.\r
1240\r
1241Returns:\r
1242\r
1243 EFI_SUCCESS - Direct return success now.\r
1244\r
1245--*/\r
1246{\r
1247 DEBUG ((EFI_D_INFO, "PlatformBdsNoConsoleAction\n"));\r
1248 return EFI_SUCCESS;\r
1249}\r
1250\r
24cdd14e 1251VOID\r
49ba9447 1252EFIAPI\r
1253PlatformBdsLockNonUpdatableFlash (\r
1254 VOID\r
1255 )\r
1256{\r
1257 DEBUG ((EFI_D_INFO, "PlatformBdsLockNonUpdatableFlash\n"));\r
24cdd14e 1258 return;\r
49ba9447 1259}\r
40f2c454 1260\r
1261\r
1262/**\r
1263 This notification function is invoked when an instance of the\r
1264 EFI_DEVICE_PATH_PROTOCOL is produced.\r
1265\r
1266 @param Event The event that occured\r
1267 @param Context For EFI compatiblity. Not used.\r
1268\r
1269**/\r
1270VOID\r
1271EFIAPI\r
1272NotifyDevPath (\r
1273 IN EFI_EVENT Event,\r
1274 IN VOID *Context\r
1275 )\r
1276{\r
1277 EFI_HANDLE Handle;\r
1278 EFI_STATUS Status;\r
1279 UINTN BufferSize;\r
1280 EFI_DEVICE_PATH_PROTOCOL *DevPathNode;\r
1281 ATAPI_DEVICE_PATH *Atapi;\r
1282\r
1283 //\r
1284 // Examine all new handles\r
1285 //\r
1286 for (;;) {\r
1287 //\r
1288 // Get the next handle\r
1289 //\r
1290 BufferSize = sizeof (Handle);\r
1291 Status = gBS->LocateHandle (\r
1292 ByRegisterNotify,\r
1293 NULL,\r
1294 mEfiDevPathNotifyReg,\r
1295 &BufferSize,\r
1296 &Handle\r
1297 );\r
1298\r
1299 //\r
1300 // If not found, we're done\r
1301 //\r
1302 if (EFI_NOT_FOUND == Status) {\r
1303 break;\r
1304 }\r
1305\r
1306 if (EFI_ERROR (Status)) {\r
1307 continue;\r
1308 }\r
1309\r
1310 //\r
1311 // Get the DevicePath protocol on that handle\r
1312 //\r
1313 Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevPathNode);\r
1314 ASSERT_EFI_ERROR (Status);\r
1315\r
1316 while (!IsDevicePathEnd (DevPathNode)) {\r
1317 //\r
1318 // Find the handler to dump this device path node\r
1319 //\r
1320 if (\r
1321 (DevicePathType(DevPathNode) == MESSAGING_DEVICE_PATH) &&\r
1322 (DevicePathSubType(DevPathNode) == MSG_ATAPI_DP)\r
1323 ) {\r
1324 Atapi = (ATAPI_DEVICE_PATH*) DevPathNode;\r
1325 PciOr16 (\r
1326 PCI_LIB_ADDRESS (\r
1327 0,\r
1328 1,\r
1329 1,\r
1330 (Atapi->PrimarySecondary == 1) ? 0x42: 0x40\r
1331 ),\r
1332 BIT15\r
1333 );\r
1334 }\r
1335\r
1336 //\r
1337 // Next device path node\r
1338 //\r
1339 DevPathNode = NextDevicePathNode (DevPathNode);\r
1340 }\r
1341 }\r
1342\r
1343 return;\r
1344}\r
1345\r
1346\r
1347VOID\r
1348InstallDevicePathCallback (\r
1349 VOID\r
1350 )\r
1351{\r
1352 DEBUG ((EFI_D_INFO, "Registered NotifyDevPath Event\n"));\r
1353 mEfiDevPathEvent = EfiCreateProtocolNotifyEvent (\r
1354 &gEfiDevicePathProtocolGuid,\r
1355 TPL_CALLBACK,\r
1356 NotifyDevPath,\r
1357 NULL,\r
1358 &mEfiDevPathNotifyReg\r
1359 );\r
1360}\r
1361\r
24cdd14e
LG
1362/**\r
1363 Lock the ConsoleIn device in system table. All key\r
1364 presses will be ignored until the Password is typed in. The only way to\r
1365 disable the password is to type it in to a ConIn device.\r
1366\r
1367 @param Password Password used to lock ConIn device.\r
1368\r
1369 @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.\r
1370 @retval EFI_UNSUPPORTED Password not found\r
1371\r
1372**/\r
1373EFI_STATUS\r
1374EFIAPI\r
1375LockKeyboards (\r
1376 IN CHAR16 *Password\r
1377 )\r
1378{\r
1379 return EFI_UNSUPPORTED;\r
1380}\r
5106d422 1381\r