3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 Sets platform/SKU specific clock routing information.
27 #include "PlatformDxe.h"
28 #include <Protocol/CK505ClockPlatformInfo.h>
31 // Default clock routing informtion (All On)
33 EFI_CLOCK_PLATFORM_INFO mDefClockPolicy
= {NULL
, 0, NULL
, 0, NULL
, 0};
38 // Static clock table.
39 // This should be used to define any clock settings that are static
40 // (Always On or Always Off). Dynamic clocks should be set to enabled
43 EFI_STATIC_SIGNALS mAtxStaticClocks
[] = {
44 {SrcClk8
, Enabled
, All
},
45 {SrcClk7
, Enabled
, All
},
46 {SrcClk6
, Enabled
, All
},
47 {SrcClk5
, Enabled
, All
},
48 {SrcClk4
, Enabled
, All
},
49 {SrcClk3
, Enabled
, All
},
50 {SrcClk2
, Enabled
, All
},
51 {SrcClk1
, Enabled
, All
},
52 {SrcClk0
, Enabled
, All
},
54 {Dot96
, Enabled
, All
},
55 {Usb48
, Enabled
, All
},
56 {PciClkF5
, Enabled
, All
},
57 {PciClk0
, Enabled
, All
},
58 {PciClk2
, Enabled
, All
},
59 {PciClk3
, Enabled
, All
},
60 {PciClk4
, Disabled
, All
},
61 {Cr_B
, EnabledWithSwitch
, All
},
66 // This is a list of clocks that need to be set to a known state when the
67 // system enters S4 or S5.
69 EFI_STATIC_SIGNALS mAtxSxClocks
[] = {
70 {SaveClockConfiguration
, Disabled
, All
}
74 // ATX settings structure
76 EFI_CLOCK_PLATFORM_INFO mAtxClockSettings
= {
78 sizeof(mAtxStaticClocks
) / sizeof(mAtxStaticClocks
[0]),
80 sizeof(mAtxSxClocks
) / sizeof(mAtxSxClocks
[0])
83 #if defined( RVP_SUPPORT ) && RVP_SUPPORT
87 // Static clock table.
88 // This should be used to define any clock settings that are static
89 // (Always On or Always Off). Dynamic clocks should be set to enabled
92 //UPSD_TBD Check with Jan if any porting required.
94 EFI_STATIC_SIGNALS mRvpStaticClocks
[] = {
95 {SrcClk11
, Enabled
, All
}, // Not used/not present but leave coding enabled
96 {SrcClk10
, Enabled
, All
}, // Not used/not present but leave coding enabled
97 {SrcClk9
, Enabled
, All
}, // Not used/not present but leave coding enabled
98 {SrcClk8
, Enabled
, All
}, // ICHSATAII
99 {SrcClk7
, Enabled
, All
}, // DPL_REFSSCLKIN
100 {SrcClk6
, Enabled
, All
}, // 100M_MCH
101 {SrcClk5
, Enabled
, All
}, // Mini-PCIe //TODO PNV: Need to check ICH GPIO38:
102 // 0: turn on; 1: turn off
103 {SrcClk4
, Enabled
, All
}, // ICHSATA
104 {SrcClk3
, Enabled
, All
}, // 100M_ICH
105 {SrcClk2
, Enabled
, All
}, // 100M_LAN
106 {SrcClk1
, Enabled
, All
}, // 25M_LAN
107 {SrcClk0
, Enabled
, All
}, // 96M_DREF
108 {Ref0
, Enabled
, All
},
109 {Dot96
, Enabled
, All
},
110 {Usb48
, Enabled
, All
},
111 {PciClkF5
, Enabled
, All
}, // 33M_ICH
112 {PciClk0
, Enabled
, All
}, // 33M_RISER
113 {PciClk1
, Enabled
, All
}, // 33M_RISER
114 {PciClk2
, Enabled
, All
}, // VDD_Clock
115 {PciClk3
, Enabled
, All
}, // 33M_S1
116 {PciClk4
, Enabled
, All
}, // 33M_PA
120 // Dynamic clock table
121 // This is used to determine if a clock should be left on or turned off based
122 // on the presence of a device. The bridge information is used so the bus
123 // number for the device to be detected can be found.
128 // This is a list of clocks that need to be set to a known state when the
129 // system enters S4 or S5.
131 EFI_STATIC_SIGNALS mRvpSxClocks
[] = {
132 {SaveClockConfiguration
, Disabled
, All
}
136 // RVP settings structure
138 EFI_CLOCK_PLATFORM_INFO mRvpClockSettings
= {
140 sizeof(mRvpStaticClocks
) / sizeof(mRvpStaticClocks
[0]),
141 0, // No clocks will be turned off mRvpDynamicClocks,
142 0, // No clocks will be turned off sizeof(mRvpDynamicClocks) / sizeof(mRvpDynamicClocks[0]),
144 sizeof(mRvpSxClocks
) / sizeof(mRvpSxClocks
[0])
149 InitializeClockRouting(
153 UINTN BoardIdVarSize
;
154 EFI_BOARD_FEATURES BoardIdVar
;
155 EFI_CLOCK_PLATFORM_INFO
*ClockPolicy
;
158 ClockPolicy
= &mDefClockPolicy
;
161 // Do modifications based on board type
163 BoardIdVarSize
= sizeof (EFI_BOARD_FEATURES
);
164 Status
= gRT
->GetVariable (
166 &gEfiBoardFeaturesGuid
,
171 if (!EFI_ERROR (Status
)) {
173 #if defined( RVP_SUPPORT ) && RVP_SUPPORT
174 if (BoardIdVar
& B_BOARD_FEATURES_RVP
) {
175 ClockPolicy
= &mRvpClockSettings
;
180 // Isolate board type information
182 BoardIdVar
= BoardIdVar
& (B_BOARD_FEATURES_FORM_FACTOR_ATX
|
183 B_BOARD_FEATURES_FORM_FACTOR_BTX
|
184 B_BOARD_FEATURES_FORM_FACTOR_MICRO_ATX
|
185 B_BOARD_FEATURES_FORM_FACTOR_MICRO_BTX
);
187 if (BoardIdVar
== B_BOARD_FEATURES_FORM_FACTOR_ATX
||
188 BoardIdVar
== B_BOARD_FEATURES_FORM_FACTOR_MICRO_ATX
) {
189 ClockPolicy
= &mAtxClockSettings
;
197 Status
= gBS
->InstallProtocolInterface (
199 &gEfiCk505ClockPlatformInfoGuid
,
200 EFI_NATIVE_INTERFACE
,
203 ASSERT_EFI_ERROR(Status
);