878ddf1f |
1 | /*++\r |
2 | \r |
3 | Copyright (c) 2006, Intel Corporation \r |
4 | All rights reserved. This program and the accompanying materials \r |
5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r |
7 | http://opensource.org/licenses/bsd-license.php \r |
8 | \r |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r |
11 | \r |
12 | Module Name:\r |
13 | \r |
14 | MiscOnboardDeviceFunction.c\r |
15 | \r |
16 | Abstract: \r |
17 | \r |
18 | Onboard device information boot time changes.\r |
19 | Misc. subclass type 8.\r |
20 | SMBIOS type 10.\r |
21 | \r |
22 | --*/\r |
23 | \r |
24 | #include "MiscSubclassDriver.h"\r |
25 | #include "winntio/winntio.h"\r |
26 | #include "winntthunk/winntthunk.h"\r |
27 | \r |
28 | #pragma pack(1)\r |
29 | \r |
30 | typedef struct _VENDOR_DEVICE {\r |
31 | EFI_DEVICE_PATH_PROTOCOL Platform;\r |
32 | EFI_GUID PlatformGuid;\r |
33 | EFI_DEVICE_PATH_PROTOCOL Device;\r |
34 | EFI_GUID DeviceGuid;\r |
35 | UINT8 DeviceData[4];\r |
36 | EFI_DEVICE_PATH_PROTOCOL End;\r |
37 | \r |
38 | } VENDOR_DEVICE;\r |
39 | #pragma pack()\r |
40 | \r |
41 | MISC_SUBCLASS_TABLE_FUNCTION (\r |
42 | MiscOnboardDeviceVideo\r |
43 | )\r |
44 | /*++\r |
45 | Description:\r |
46 | \r |
47 | This function makes boot time changes to the contents of the\r |
48 | MiscOnboardDevice structure.\r |
49 | \r |
50 | Parameters:\r |
51 | \r |
52 | RecordType\r |
53 | Type of record to be processed from the Data Table.\r |
54 | mMiscSubclassDataTable[].RecordType\r |
55 | \r |
56 | RecordLen\r |
57 | Size of static RecordData from the Data Table.\r |
58 | mMiscSubclassDataTable[].RecordLen\r |
59 | \r |
60 | RecordData\r |
61 | Pointer to copy of RecordData from the Data Table. Changes made\r |
62 | to this copy will be written to the Data Hub but will not alter\r |
63 | the contents of the static Data Table.\r |
64 | \r |
65 | LogRecordData\r |
66 | Set *LogRecordData to TRUE to log RecordData to Data Hub.\r |
67 | Set *LogRecordData to FALSE when there is no more data to log.\r |
68 | \r |
69 | Returns:\r |
70 | \r |
71 | EFI_SUCCESS\r |
72 | All parameters were valid and *RecordData and *LogRecordData have\r |
73 | been set.\r |
74 | \r |
75 | EFI_UNSUPPORTED\r |
76 | Unexpected RecordType value.\r |
77 | \r |
78 | EFI_INVALID_PARAMETER\r |
79 | One of the following parameter conditions was true:\r |
80 | RecordLen was zero.\r |
81 | RecordData was NULL.\r |
82 | LogRecordData was NULL.\r |
83 | --*/\r |
84 | {\r |
85 | STATIC VENDOR_DEVICE mVideoDevicePath = {\r |
86 | {\r |
87 | HARDWARE_DEVICE_PATH,\r |
88 | HW_VENDOR_DP,\r |
89 | 0x14\r |
90 | },\r |
91 | EFI_WIN_NT_THUNK_PROTOCOL_GUID,\r |
92 | {\r |
93 | HARDWARE_DEVICE_PATH,\r |
94 | HW_VENDOR_DP,\r |
95 | 0x18\r |
96 | },\r |
97 | EFI_WIN_NT_UGA_GUID,\r |
98 | 0,\r |
99 | 0,\r |
100 | 0,\r |
101 | 0,\r |
102 | END\r |
103 | };\r |
104 | \r |
105 | STATIC BOOLEAN Done = FALSE;\r |
106 | \r |
107 | //\r |
108 | // First check for invalid parameters.\r |
109 | //\r |
110 | if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {\r |
111 | return EFI_INVALID_PARAMETER;\r |
112 | }\r |
113 | //\r |
114 | // Then check for unsupported RecordType.\r |
115 | //\r |
116 | if (RecordType != EFI_MISC_ONBOARD_DEVICE_DATA_RECORD_NUMBER) {\r |
117 | return EFI_UNSUPPORTED;\r |
118 | }\r |
119 | //\r |
120 | // Is this the first time through this function?\r |
121 | //\r |
122 | if (!Done) {\r |
123 | //\r |
124 | // Yes, this is the first time. Inspect/Change the contents of the\r |
125 | // RecordData structure.\r |
126 | //\r |
127 | //\r |
128 | // Any time changes?\r |
129 | //\r |
130 | // %%TBD\r |
131 | //\r |
132 | // Set Done flag to TRUE for next pass through this function.\r |
133 | // Set *LogRecordData to TRUE so data will get logged to Data Hub.\r |
134 | //\r |
135 | switch (((EFI_MISC_ONBOARD_DEVICE_DATA *) RecordData)->OnBoardDeviceDescription) {\r |
136 | case STR_MISC_ONBOARD_DEVICE_VIDEO_DESCRIPTION:\r |
137 | {\r |
138 | CopyMem (\r |
139 | &((EFI_MISC_ONBOARD_DEVICE_DATA *) RecordData)->OnBoardDevicePath,\r |
140 | &mVideoDevicePath,\r |
141 | GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mVideoDevicePath)\r |
142 | );\r |
143 | *RecordLen = *RecordLen - sizeof (EFI_DEVICE_PATH_PROTOCOL) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mVideoDevicePath);\r |
144 | }\r |
145 | break;\r |
146 | }\r |
147 | \r |
148 | Done = TRUE;\r |
149 | *LogRecordData = TRUE;\r |
150 | } else {\r |
151 | //\r |
152 | // No, this is the second time. Reset the state of the Done flag\r |
153 | // to FALSE and tell the data logger that there is no more data\r |
154 | // to be logged for this record type. If any memory allocations\r |
155 | // were made by earlier passes, they must be released now.\r |
156 | //\r |
157 | Done = FALSE;\r |
158 | *LogRecordData = FALSE;\r |
159 | }\r |
160 | \r |
161 | return EFI_SUCCESS;\r |
162 | }\r |
163 | \r |
164 | /* eof - MiscOnboardDeviceFunction.c */\r |