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