1 /** @file
2 Platform init DXE driver for this platform.
3 
4 Copyright (c) 2013 Intel Corporation.
5 
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution.  The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 //
17 // Statements that include other files
18 //
19 #include "PlatformInitDxe.h"
20 #include <Library/PciLib.h>
21 #include <IndustryStandard/Pci.h>
22 
23 VOID
GetQncName(VOID)24 GetQncName (
25   VOID
26   )
27 {
28   DEBUG  ((EFI_D_INFO, "QNC Name: "));
29   switch (PciRead16 (PCI_LIB_ADDRESS (MC_BUS, MC_DEV, MC_FUN, PCI_DEVICE_ID_OFFSET))) {
30   case QUARK_MC_DEVICE_ID:
31     DEBUG  ((EFI_D_INFO, "Quark"));
32     break;
33   case QUARK2_MC_DEVICE_ID:
34     DEBUG  ((EFI_D_INFO, "Quark2"));
35     break;
36   default:
37     DEBUG  ((EFI_D_INFO, "Unknown"));
38   }
39 
40   //
41   // Revision
42   //
43   switch (PciRead8 (PCI_LIB_ADDRESS (MC_BUS, MC_DEV, MC_FUN, PCI_REVISION_ID_OFFSET))) {
44   case QNC_MC_REV_ID_A0:
45     DEBUG  ((EFI_D_INFO, " - A0 stepping\n"));
46     break;
47   default:
48     DEBUG  ((EFI_D_INFO, " - xx\n"));
49   }
50 
51   return;
52 }
53 
54 EFI_STATUS
55 EFIAPI
PlatformInit(IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE * SystemTable)56 PlatformInit (
57   IN EFI_HANDLE                         ImageHandle,
58   IN EFI_SYSTEM_TABLE                   *SystemTable
59   )
60 /*++
61 
62 Routine Description:
63   Entry point for the driver.
64 
65 Arguments:
66 
67   ImageHandle  -  Image Handle.
68   SystemTable  -  EFI System Table.
69 
70 Returns:
71 
72   EFI_SUCCESS  -  Function has completed successfully.
73 
74 --*/
75 {
76   EFI_STATUS  Status;
77 
78   GetQncName();
79 
80   //
81   // Create events for configuration callbacks.
82   //
83   CreateConfigEvents ();
84 
85   //
86   // Init Platform LEDs.
87   //
88   Status = PlatformLedInit ((EFI_PLATFORM_TYPE)PcdGet16 (PcdPlatformType));
89   ASSERT_EFI_ERROR (Status);
90 
91   return EFI_SUCCESS;
92 }
93 
94