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