]> git.proxmox.com Git - mirror_edk2.git/blame - Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c
add in MiscSubClassPlatformDxe
[mirror_edk2.git] / Nt32Pkg / MiscSubClassPlatformDxe / MiscPortInternalConnectorDesignatorFunction.c
CommitLineData
8879d432 1/*++\r
2 \r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 MiscPortInternalConnectorDesignatorFunction.c\r
15 \r
16Abstract: \r
17\r
18 This driver parses the mMiscSubclassDataTable structure and reports\r
19 any generated data to the DataHub.\r
20\r
21--*/\r
22\r
23//\r
24// Include common header file for this module.\r
25//\r
26#include "CommonHeader.h"\r
27\r
28#include "MiscSubclassDriver.h"\r
29\r
30//\r
31//\r
32//\r
33MISC_SUBCLASS_TABLE_FUNCTION (\r
34 MiscPortInternalConnectorDesignator\r
35 )\r
36/*++\r
37Description:\r
38\r
39 This function makes boot time changes to the contents of the\r
40 MiscPortConnectorInformation (Type 8).\r
41\r
42Parameters:\r
43\r
44 RecordType\r
45 Type of record to be processed from the Data Table.\r
46 mMiscSubclassDataTable[].RecordType\r
47\r
48 RecordLen\r
49 Size of static RecordData from the Data Table.\r
50 mMiscSubclassDataTable[].RecordLen\r
51\r
52 RecordData\r
53 Pointer to copy of RecordData from the Data Table. Changes made\r
54 to this copy will be written to the Data Hub but will not alter\r
55 the contents of the static Data Table.\r
56\r
57 LogRecordData\r
58 Set *LogRecordData to TRUE to log RecordData to Data Hub.\r
59 Set *LogRecordData to FALSE when there is no more data to log.\r
60\r
61Returns:\r
62\r
63 EFI_SUCCESS\r
64 All parameters were valid and *RecordData and *LogRecordData have\r
65 been set.\r
66\r
67 EFI_UNSUPPORTED\r
68 Unexpected RecordType value.\r
69\r
70 EFI_INVALID_PARAMETER\r
71 One of the following parameter conditions was true:\r
72 RecordLen was zero.\r
73 RecordData was NULL.\r
74 LogRecordData was NULL.\r
75--*/\r
76{\r
77 STATIC BOOLEAN Done = FALSE;\r
78 STATIC PS2_CONN_DEVICE_PATH mPs2KeyboardDevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0303, 0), DP_END };\r
79 STATIC PS2_CONN_DEVICE_PATH mPs2MouseDevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0303, 1), DP_END };\r
80 STATIC SERIAL_CONN_DEVICE_PATH mCom1DevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0501, 0), DP_END };\r
81 STATIC SERIAL_CONN_DEVICE_PATH mCom2DevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0501, 1), DP_END };\r
82 STATIC PARALLEL_CONN_DEVICE_PATH mLpt1DevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0401, 0), DP_END };\r
83 STATIC FLOOPY_CONN_DEVICE_PATH mFloopyADevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0604, 0), DP_END };\r
84 STATIC FLOOPY_CONN_DEVICE_PATH mFloopyBDevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0604, 1), DP_END };\r
85 STATIC USB_PORT_DEVICE_PATH mUsb0DevicePath = { DP_ACPI, DP_PCI (0x1d, 0x00), DP_END };\r
86 STATIC USB_PORT_DEVICE_PATH mUsb1DevicePath = { DP_ACPI, DP_PCI (0x1d, 0x01), DP_END };\r
87 STATIC USB_PORT_DEVICE_PATH mUsb2DevicePath = { DP_ACPI, DP_PCI (0x1d, 0x02), DP_END };\r
88 STATIC USB_PORT_DEVICE_PATH mUsb3DevicePath = { DP_ACPI, DP_PCI (0x1d, 0x07), DP_END };\r
89 STATIC IDE_DEVICE_PATH mIdeDevicePath = { DP_ACPI, DP_PCI (0x1F, 0x01), DP_END };\r
90 STATIC GB_NIC_DEVICE_PATH mGbNicDevicePath = { DP_ACPI, DP_PCI( 0x03,0x00 ),DP_PCI( 0x1F,0x00 ),DP_PCI( 0x07,0x00 ), DP_END };\r
91 EFI_DEVICE_PATH_PROTOCOL EndDevicePath = DP_END;\r
92\r
93 //\r
94 // First check for invalid parameters.\r
95 //\r
96 // Shanmu >> to fix the Device Path Issue...\r
97 // if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {\r
98 //\r
99 if (*RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {\r
100 //\r
101 // End Shanmu\r
102 //\r
103 return EFI_INVALID_PARAMETER;\r
104 }\r
105 //\r
106 // Then check for unsupported RecordType.\r
107 //\r
108 if (RecordType != EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER) {\r
109 return EFI_UNSUPPORTED;\r
110 }\r
111 //\r
112 // Is this the first time through this function?\r
113 //\r
114 if (!Done) {\r
115 //\r
116 // Yes, this is the first time. Inspect/Change the contents of the\r
117 // RecordData structure.\r
118 //\r
119 //\r
120 // Device path is only updated here as it was not taking that in static data\r
121 //\r
122 // Shanmu >> to fix the Device Path Issue...\r
123 //\r
124\r
125 /*\r
126 switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortInternalConnectorDesignator) \r
127 {\r
128 case STR_MISC_PORT_INTERNAL_MOUSE:\r
129 {\r
130 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2MouseDevicePath); \r
131 }break;\r
132 case STR_MISC_PORT_INTERNAL_KEYBOARD:\r
133 {\r
134 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2KeyboardDevicePath); \r
135 }break;\r
136 case STR_MISC_PORT_INTERNAL_COM1:\r
137 {\r
138 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom1DevicePath); \r
139 }break;\r
140 case STR_MISC_PORT_INTERNAL_COM2:\r
141 {\r
142 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom2DevicePath); \r
143 }break;\r
144 case STR_MISC_PORT_INTERNAL_LPT1:\r
145 {\r
146 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mLpt1DevicePath); \r
147 }break;\r
148 case STR_MISC_PORT_INTERNAL_USB1:\r
149 {\r
150 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb0DevicePath); \r
151 }break;\r
152 case STR_MISC_PORT_INTERNAL_USB2:\r
153 {\r
154 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb1DevicePath); \r
155 }break;\r
156 case STR_MISC_PORT_INTERNAL_USB3:\r
157 {\r
158 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb2DevicePath); \r
159 }break;\r
160 case STR_MISC_PORT_INTERNAL_NETWORK:\r
161 {\r
162 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mGbNicDevicePath); \r
163 }break;\r
164 case STR_MISC_PORT_INTERNAL_FLOPPY:\r
165 {\r
166 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mFloopyADevicePath); \r
167 }break;\r
168 case STR_MISC_PORT_INTERNAL_IDE1:\r
169 {\r
170 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath); \r
171 }break;\r
172 case STR_MISC_PORT_INTERNAL_IDE2:\r
173 {\r
174 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath); \r
175 }break;\r
176 default:\r
177 {\r
178 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = EndDevicePath;\r
179 }break; \r
180 }\r
181 */\r
182 switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortInternalConnectorDesignator) {\r
183 case STR_MISC_PORT_INTERNAL_MOUSE:\r
184 {\r
185 CopyMem (\r
186 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,\r
187 &mPs2MouseDevicePath,\r
188 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2MouseDevicePath)\r
189 );\r
190 *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2MouseDevicePath);\r
191 }\r
192 break;\r
193\r
194 case STR_MISC_PORT_INTERNAL_KEYBOARD:\r
195 {\r
196 CopyMem (\r
197 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,\r
198 &mPs2KeyboardDevicePath,\r
199 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2KeyboardDevicePath)\r
200 );\r
201 *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2KeyboardDevicePath);\r
202 }\r
203 break;\r
204\r
205 case STR_MISC_PORT_INTERNAL_COM1:\r
206 {\r
207 CopyMem (\r
208 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,\r
209 &mCom1DevicePath,\r
210 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom1DevicePath)\r
211 );\r
212 *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom1DevicePath);\r
213 }\r
214 break;\r
215\r
216 case STR_MISC_PORT_INTERNAL_COM2:\r
217 {\r
218 CopyMem (\r
219 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,\r
220 &mCom2DevicePath,\r
221 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom2DevicePath)\r
222 );\r
223 *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom2DevicePath);\r
224 }\r
225 break;\r
226\r
227 case STR_MISC_PORT_INTERNAL_FLOPPY:\r
228 {\r
229 CopyMem (\r
230 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,\r
231 &mFloopyADevicePath,\r
232 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mFloopyADevicePath)\r
233 );\r
234 *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mFloopyADevicePath);\r
235 }\r
236 break;\r
237\r
238 default:\r
239 {\r
240 CopyMem (\r
241 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,\r
242 &EndDevicePath,\r
243 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &EndDevicePath)\r
244 );\r
245 *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &EndDevicePath);\r
246 }\r
247 break;\r
248 }\r
249 //\r
250 // End Shanmu\r
251 //\r
252 // Set Done flag to TRUE for next pass through this function.\r
253 // Set *LogRecordData to TRUE so data will get logged to Data Hub.\r
254 //\r
255 Done = TRUE;\r
256 *LogRecordData = TRUE;\r
257 } else {\r
258 //\r
259 // No, this is the second time. Reset the state of the Done flag\r
260 // to FALSE and tell the data logger that there is no more data\r
261 // to be logged for this record type. If any memory allocations\r
262 // were made by earlier passes, they must be released now.\r
263 //\r
264 Done = FALSE;\r
265 *LogRecordData = FALSE;\r
266 }\r
267\r
268 return EFI_SUCCESS;\r
269}\r
270\r
271/* eof - MiscSystemManufacturerFunction.c */\r