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