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.
24 // Include common header file for this module.
26 #include "CommonHeader.h"
28 #include "MiscSubclassDriver.h"
33 MISC_SUBCLASS_TABLE_FUNCTION (
34 MiscPortInternalConnectorDesignator
39 This function makes boot time changes to the contents of the
40 MiscPortConnectorInformation (Type 8).
45 Type of record to be processed from the Data Table.
46 mMiscSubclassDataTable[].RecordType
49 Size of static RecordData from the Data Table.
50 mMiscSubclassDataTable[].RecordLen
53 Pointer to copy of RecordData from the Data Table. Changes made
54 to this copy will be written to the Data Hub but will not alter
55 the contents of the static Data Table.
58 Set *LogRecordData to TRUE to log RecordData to Data Hub.
59 Set *LogRecordData to FALSE when there is no more data to log.
64 All parameters were valid and *RecordData and *LogRecordData have
68 Unexpected RecordType value.
71 One of the following parameter conditions was true:
74 LogRecordData was NULL.
77 STATIC BOOLEAN Done
= FALSE
;
78 STATIC PS2_CONN_DEVICE_PATH mPs2KeyboardDevicePath
= { DP_ACPI
, DP_PCI (0x1F, 0x00), DP_LPC (0x0303, 0), DP_END
};
79 STATIC PS2_CONN_DEVICE_PATH mPs2MouseDevicePath
= { DP_ACPI
, DP_PCI (0x1F, 0x00), DP_LPC (0x0303, 1), DP_END
};
80 STATIC SERIAL_CONN_DEVICE_PATH mCom1DevicePath
= { DP_ACPI
, DP_PCI (0x1F, 0x00), DP_LPC (0x0501, 0), DP_END
};
81 STATIC SERIAL_CONN_DEVICE_PATH mCom2DevicePath
= { DP_ACPI
, DP_PCI (0x1F, 0x00), DP_LPC (0x0501, 1), DP_END
};
82 STATIC PARALLEL_CONN_DEVICE_PATH mLpt1DevicePath
= { DP_ACPI
, DP_PCI (0x1F, 0x00), DP_LPC (0x0401, 0), DP_END
};
83 STATIC FLOOPY_CONN_DEVICE_PATH mFloopyADevicePath
= { DP_ACPI
, DP_PCI (0x1F, 0x00), DP_LPC (0x0604, 0), DP_END
};
84 STATIC FLOOPY_CONN_DEVICE_PATH mFloopyBDevicePath
= { DP_ACPI
, DP_PCI (0x1F, 0x00), DP_LPC (0x0604, 1), DP_END
};
85 STATIC USB_PORT_DEVICE_PATH mUsb0DevicePath
= { DP_ACPI
, DP_PCI (0x1d, 0x00), DP_END
};
86 STATIC USB_PORT_DEVICE_PATH mUsb1DevicePath
= { DP_ACPI
, DP_PCI (0x1d, 0x01), DP_END
};
87 STATIC USB_PORT_DEVICE_PATH mUsb2DevicePath
= { DP_ACPI
, DP_PCI (0x1d, 0x02), DP_END
};
88 STATIC USB_PORT_DEVICE_PATH mUsb3DevicePath
= { DP_ACPI
, DP_PCI (0x1d, 0x07), DP_END
};
89 STATIC IDE_DEVICE_PATH mIdeDevicePath
= { DP_ACPI
, DP_PCI (0x1F, 0x01), DP_END
};
90 STATIC GB_NIC_DEVICE_PATH mGbNicDevicePath
= { DP_ACPI
, DP_PCI( 0x03,0x00 ),DP_PCI( 0x1F,0x00 ),DP_PCI( 0x07,0x00 ), DP_END
};
91 EFI_DEVICE_PATH_PROTOCOL EndDevicePath
= DP_END
;
94 // First check for invalid parameters.
96 // Shanmu >> to fix the Device Path Issue...
97 // if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
99 if (*RecordLen
== 0 || RecordData
== NULL
|| LogRecordData
== NULL
) {
103 return EFI_INVALID_PARAMETER
;
106 // Then check for unsupported RecordType.
108 if (RecordType
!= EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER
) {
109 return EFI_UNSUPPORTED
;
112 // Is this the first time through this function?
116 // Yes, this is the first time. Inspect/Change the contents of the
117 // RecordData structure.
120 // Device path is only updated here as it was not taking that in static data
122 // Shanmu >> to fix the Device Path Issue...
126 switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortInternalConnectorDesignator)
128 case STR_MISC_PORT_INTERNAL_MOUSE:
130 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2MouseDevicePath);
132 case STR_MISC_PORT_INTERNAL_KEYBOARD:
134 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2KeyboardDevicePath);
136 case STR_MISC_PORT_INTERNAL_COM1:
138 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom1DevicePath);
140 case STR_MISC_PORT_INTERNAL_COM2:
142 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom2DevicePath);
144 case STR_MISC_PORT_INTERNAL_LPT1:
146 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mLpt1DevicePath);
148 case STR_MISC_PORT_INTERNAL_USB1:
150 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb0DevicePath);
152 case STR_MISC_PORT_INTERNAL_USB2:
154 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb1DevicePath);
156 case STR_MISC_PORT_INTERNAL_USB3:
158 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb2DevicePath);
160 case STR_MISC_PORT_INTERNAL_NETWORK:
162 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mGbNicDevicePath);
164 case STR_MISC_PORT_INTERNAL_FLOPPY:
166 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mFloopyADevicePath);
168 case STR_MISC_PORT_INTERNAL_IDE1:
170 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);
172 case STR_MISC_PORT_INTERNAL_IDE2:
174 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);
178 (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = EndDevicePath;
182 switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortInternalConnectorDesignator
) {
183 case STR_MISC_PORT_INTERNAL_MOUSE
:
186 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
187 &mPs2MouseDevicePath
,
188 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mPs2MouseDevicePath
)
190 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mPs2MouseDevicePath
);
194 case STR_MISC_PORT_INTERNAL_KEYBOARD
:
197 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
198 &mPs2KeyboardDevicePath
,
199 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mPs2KeyboardDevicePath
)
201 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mPs2KeyboardDevicePath
);
205 case STR_MISC_PORT_INTERNAL_COM1
:
208 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
210 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mCom1DevicePath
)
212 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mCom1DevicePath
);
216 case STR_MISC_PORT_INTERNAL_COM2
:
219 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
221 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mCom2DevicePath
)
223 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mCom2DevicePath
);
227 case STR_MISC_PORT_INTERNAL_FLOPPY
:
230 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
232 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mFloopyADevicePath
)
234 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &mFloopyADevicePath
);
241 &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA
*) RecordData
)->PortPath
,
243 GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &EndDevicePath
)
245 *RecordLen
= *RecordLen
- sizeof (EFI_MISC_PORT_DEVICE_PATH
) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL
*) &EndDevicePath
);
252 // Set Done flag to TRUE for next pass through this function.
253 // Set *LogRecordData to TRUE so data will get logged to Data Hub.
256 *LogRecordData
= TRUE
;
259 // No, this is the second time. Reset the state of the Done flag
260 // to FALSE and tell the data logger that there is no more data
261 // to be logged for this record type. If any memory allocations
262 // were made by earlier passes, they must be released now.
265 *LogRecordData
= FALSE
;
271 /* eof - MiscSystemManufacturerFunction.c */