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
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.
14 MiscPortInternalConnectorDesignatorFunction.c
18 This driver parses the mMiscSubclassDataTable structure and reports
19 any generated data to the DataHub.
23 #include "MiscSubclassDriver.h"
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
};
43 MISC_SUBCLASS_TABLE_FUNCTION (
44 MiscPortInternalConnectorDesignator
49 This function makes boot time changes to the contents of the
50 MiscPortConnectorInformation (Type 8).
55 Type of record to be processed from the Data Table.
56 mMiscSubclassDataTable[].RecordType
59 Size of static RecordData from the Data Table.
60 mMiscSubclassDataTable[].RecordLen
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.
68 Set *LogRecordData to TRUE to log RecordData to Data Hub.
69 Set *LogRecordData to FALSE when there is no more data to log.
74 All parameters were valid and *RecordData and *LogRecordData have
78 Unexpected RecordType value.
81 One of the following parameter conditions was true:
84 LogRecordData was NULL.
87 EFI_DEVICE_PATH_PROTOCOL EndDevicePath
= DP_END
;
90 // First check for invalid parameters.
92 // Shanmu >> to fix the Device Path Issue...
93 // if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
95 if (*RecordLen
== 0 || RecordData
== NULL
|| LogRecordData
== NULL
) {
99 return EFI_INVALID_PARAMETER
;
102 // Then check for unsupported RecordType.
104 if (RecordType
!= EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER
) {
105 return EFI_UNSUPPORTED
;
108 // Is this the first time through this function?
112 // Yes, this is the first time. Inspect/Change the contents of the
113 // RecordData structure.
116 // Device path is only updated here as it was not taking that in static data
118 // Shanmu >> to fix the Device Path Issue...
122 switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortInternalConnectorDesignator)
124 case STR_MISC_PORT_INTERNAL_MOUSE:
126 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2MouseDevicePath);
128 case STR_MISC_PORT_INTERNAL_KEYBOARD:
130 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2KeyboardDevicePath);
132 case STR_MISC_PORT_INTERNAL_COM1:
134 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom1DevicePath);
136 case STR_MISC_PORT_INTERNAL_COM2:
138 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom2DevicePath);
140 case STR_MISC_PORT_INTERNAL_LPT1:
142 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mLpt1DevicePath);
144 case STR_MISC_PORT_INTERNAL_USB1:
146 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb0DevicePath);
148 case STR_MISC_PORT_INTERNAL_USB2:
150 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb1DevicePath);
152 case STR_MISC_PORT_INTERNAL_USB3:
154 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb2DevicePath);
156 case STR_MISC_PORT_INTERNAL_NETWORK:
158 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mGbNicDevicePath);
160 case STR_MISC_PORT_INTERNAL_FLOPPY:
162 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mFloopyADevicePath);
164 case STR_MISC_PORT_INTERNAL_IDE1:
166 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);
168 case STR_MISC_PORT_INTERNAL_IDE2:
170 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);
174 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = EndDevicePath;
178 switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortInternalConnectorDesignator
) {
179 case STR_MISC_PORT_INTERNAL_MOUSE
:
182 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
183 &mPs2MouseDevicePath
,
184 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mPs2MouseDevicePath
)
186 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mPs2MouseDevicePath
);
190 case STR_MISC_PORT_INTERNAL_KEYBOARD
:
193 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
194 &mPs2KeyboardDevicePath
,
195 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mPs2KeyboardDevicePath
)
197 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mPs2KeyboardDevicePath
);
201 case STR_MISC_PORT_INTERNAL_COM1
:
204 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
206 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mCom1DevicePath
)
208 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mCom1DevicePath
);
212 case STR_MISC_PORT_INTERNAL_COM2
:
215 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
217 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mCom2DevicePath
)
219 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mCom2DevicePath
);
223 case STR_MISC_PORT_INTERNAL_FLOPPY
:
226 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
228 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mFloopyADevicePath
)
230 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mFloopyADevicePath
);
237 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
239 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &EndDevicePath
)
241 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &EndDevicePath
);
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.
252 *LogRecordData
= TRUE
;
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.
261 *LogRecordData
= FALSE
;
267 /* eof - MiscSystemManufacturerFunction.c */