1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
| /** @file
|
| @copyright
| Copyright 2018 - 2021 Intel Corporation. <BR>
|
| SPDX-License-Identifier: BSD-2-Clause-Patent
| **/
|
| #include "UsbOcUpdateDxe.h"
|
| #include <Library/UbaUsbOcUpdateLib.h>
| #include <PchLimits.h>
| #include <ConfigBlock/UsbConfig.h>
| #include <ConfigBlock/Usb2PhyConfig.h>
|
| USB_OVERCURRENT_PIN TypeWilsonCitySMTUsb20OverCurrentMappings[PCH_MAX_USB2_PORTS] = {
| UsbOverCurrentPinSkip, //Port00: BMC
| UsbOverCurrentPinSkip, //Port01: BMC
| UsbOverCurrentPin0, //Port02: Rear Panel
| UsbOverCurrentPin1, //Port03: Rear Panel
| UsbOverCurrentPin1, //Port04: Rear Panel
| UsbOverCurrentPinSkip, //Port05: NC
| UsbOverCurrentPinSkip, //Port06: NC
| UsbOverCurrentPin4, //Port07: Type A internal
| UsbOverCurrentPinSkip, //Port08: NC
| UsbOverCurrentPinSkip, //Port09: NC
| UsbOverCurrentPin6, //Port10: Front Panel
| UsbOverCurrentPinSkip, //Port11: NC
| UsbOverCurrentPin6, //Port12: Front Panel
| UsbOverCurrentPinSkip, //Port13: NC
| UsbOverCurrentPinSkip,
| UsbOverCurrentPinSkip
| };
|
| USB_OVERCURRENT_PIN TypeWilsonCitySMTUsb30OverCurrentMappings[PCH_MAX_USB3_PORTS] = {
| UsbOverCurrentPin6, //Port01: Front Panel
| UsbOverCurrentPin6, //Port02: Front Panel
| UsbOverCurrentPin0, //Port03: Rear Panel
| UsbOverCurrentPin1, //Port04: Rear Panel
| UsbOverCurrentPin1, //Port05: Rear Panel
| UsbOverCurrentPinSkip, //Port06: NC
| UsbOverCurrentPinSkip,
| UsbOverCurrentPinSkip,
| UsbOverCurrentPinSkip,
| UsbOverCurrentPinSkip
| };
|
| USB2_PHY_PARAMETERS TypeWilsonCitySMTUsb20AfeParams[PCH_H_XHCI_MAX_USB2_PHYSICAL_PORTS] = {
| {3, 0, 3, 1}, // PP0
| {5, 0, 3, 1}, // PP1
| {3, 0, 3, 1}, // PP2
| {0, 5, 1, 1}, // PP3
| {3, 0, 3, 1}, // PP4
| {3, 0, 3, 1}, // PP5
| {3, 0, 3, 1}, // PP6
| {3, 0, 3, 1}, // PP7
| {2, 2, 1, 0}, // PP8
| {6, 0, 2, 1}, // PP9
| {2, 2, 1, 0}, // PP10
| {6, 0, 2, 1}, // PP11
| {0, 5, 1, 1}, // PP12
| {7, 0, 2, 1}, // PP13
| };
|
| EFI_STATUS
| TypeWilsonCitySMTPlatformUsbOcUpdateCallback (
| IN OUT USB_OVERCURRENT_PIN **Usb20OverCurrentMappings,
| IN OUT USB_OVERCURRENT_PIN **Usb30OverCurrentMappings,
| IN OUT USB2_PHY_PARAMETERS **Usb20AfeParams
| )
| {
| *Usb20OverCurrentMappings = &TypeWilsonCitySMTUsb20OverCurrentMappings[0];
| *Usb30OverCurrentMappings = &TypeWilsonCitySMTUsb30OverCurrentMappings[0];
|
| *Usb20AfeParams = TypeWilsonCitySMTUsb20AfeParams;
| return EFI_SUCCESS;
| }
|
| PLATFORM_USBOC_UPDATE_TABLE TypeWilsonCitySMTUsbOcUpdate =
| {
| PLATFORM_USBOC_UPDATE_SIGNATURE,
| PLATFORM_USBOC_UPDATE_VERSION,
| TypeWilsonCitySMTPlatformUsbOcUpdateCallback
| };
|
| /**
| The Driver Entry Point.
|
| The function is the driver Entry point.
|
| @param ImageHandle A handle for the image that is initializing this driver
| @param SystemTable A pointer to the EFI system table
|
| @retval EFI_SUCCESS: Driver initialized successfully
| @retval EFI_LOAD_ERROR: Failed to Initialize or has been loaded
| @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
|
| **/
| EFI_STATUS
| EFIAPI
| UsbOcUpdateEntry (
| IN EFI_HANDLE ImageHandle,
| IN EFI_SYSTEM_TABLE *SystemTable
| )
| {
| EFI_STATUS Status;
| UBA_CONFIG_DATABASE_PROTOCOL *UbaConfigProtocol = NULL;
|
| DEBUG((DEBUG_INFO, "UBA:UsbOcUpdate-TypeWilsonCitySMT\n"));
| Status = gBS->LocateProtocol (
| &gUbaConfigDatabaseProtocolGuid,
| NULL,
| &UbaConfigProtocol
| );
| if (EFI_ERROR(Status)) {
| return Status;
| }
|
| Status = UbaConfigProtocol->AddData (
| UbaConfigProtocol,
| &gDxePlatformUbaOcConfigDataGuid,
| &TypeWilsonCitySMTUsbOcUpdate,
| sizeof(TypeWilsonCitySMTUsbOcUpdate)
| );
|
| return Status;
| }
|
|