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