--- /dev/null
+/** @file\r
+ DiskIo driver that lays on every BlockIo protocol in the system.\r
+ DiskIo converts a block oriented device to a byte oriented device.\r
+\r
+ Disk access may have to handle unaligned request about sector boundaries.\r
+ There are three cases:\r
+ UnderRun - The first byte is not on a sector boundary or the read request is\r
+ less than a sector in length.\r
+ Aligned - A read of N contiguous sectors.\r
+ OverRun - The last byte is not on a sector boundary.\r
+\r
+Copyright (c) 2006 - 2009, Intel Corporation. <BR>\r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#include "DriverHealthDxe.h"\r
+\r
+#undef STRING_TOKEN\r
+#define STRING_TOKEN(x) 0\r
+\r
+extern EFI_GUID gEfiCallerIdGuid;\r
+\r
+CHAR16 VariableName[] = L"Config";\r
+UINTN mNumNotHealthy = 0;\r
+UINT8 ControllerIndex = 0;\r
+\r
+//\r
+// Link used to store the controller health status\r
+//\r
+LIST_ENTRY mControllerList = {NULL, NULL};\r
+\r
+//\r
+// 0 - Healthy -> {0}\r
+// 1 - Health with warning messages -> {1}\r
+// 2 - Failed -> {2}\r
+// 3 - Failed with error messages -> {3}\r
+// 4 - RebootRequired -> {4}\r
+// 5 - RebootRequired with messages -> {5}\r
+// 6 - ReconnectRequired -> {6}\r
+// 7 - ReconnectRequired with messages -> {7}\r
+// 100..103 - RepairRequired -> {0..3}\r
+// 104..107 - RepairRequired with error messages -> {0..3}\r
+// 108..111 - RepairRequired with progress notifications -> {0..3}\r
+// 112..115 - RepairRequired with error messages and progress notifications -> {0..3}\r
+// 132..163 - RepairRequired -> {300..331}\r
+// 164..195 - RepairRequired with error messages -> {300..331}\r
+// 196..227 - RepairRequired with progress notifications -> {300..331}\r
+// 228..259 - RepairRequired with error messages and progress notifications -> {300..331}\r
+// 300..307 - ConfigRequired -> {0..7}\r
+// 308..315 - ConfigRequired with error messages -> {0..7}\r
+// 316..323 - ConfigRequired with forms -> {0..7}\r
+// 324..331 - ConfigRequired with forms and error messages -> {0..7}\r
+// 332..347 - ConfigRequired -> {100..115}\r
+// 348..363 - ConfigRequired with error messages -> {100..115}\r
+// 364..379 - ConfigRequired with forms -> {100.115}\r
+// 380..395 - ConfigRequired with forms and error messages -> {100..115}\r
+\r
+DEVICE_STATE mDeviceState[] = {\r
+ { TRUE, 308, 000, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 309, 001, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 310, 002, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 311, 003, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 312, 004, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 313, 005, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 314, 006, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 315, 007, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 000, 000, 0, FALSE, EfiDriverHealthStatusHealthy },\r
+ { TRUE, 001, 001, STRING_TOKEN (STR_HEALTHY_WARNING), FALSE, EfiDriverHealthStatusHealthy },\r
+\r
+ { TRUE, 002, 002, 0, FALSE, EfiDriverHealthStatusFailed },\r
+ { TRUE, 003, 003, STRING_TOKEN (STR_FAILED_ERROR), FALSE, EfiDriverHealthStatusFailed },\r
+\r
+ { FALSE, 004, 004, 0, FALSE, EfiDriverHealthStatusRebootRequired },\r
+ { FALSE, 005, 005, STRING_TOKEN (STR_REBOOT_REQUIRED), FALSE, EfiDriverHealthStatusRebootRequired },\r
+\r
+ { FALSE, 006, 006, 0, FALSE, EfiDriverHealthStatusReconnectRequired },\r
+ { FALSE, 007, 007, STRING_TOKEN (STR_RECONNECT_REQUIRED), FALSE, EfiDriverHealthStatusReconnectRequired },\r
+\r
+ { TRUE, 100, 000, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 101, 001, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 102, 002, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 103, 003, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+\r
+ { TRUE, 104, 000, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 105, 001, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 106, 002, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 107, 003, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+\r
+ { TRUE, 108, 000, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 109, 001, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 110, 002, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 111, 003, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+\r
+ { TRUE, 112, 000, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 113, 001, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 114, 002, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 115, 003, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+\r
+ { TRUE, 132, 300, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 133, 301, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 134, 302, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 135, 303, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 136, 304, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 137, 305, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 138, 306, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 139, 307, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 140, 308, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 141, 309, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 142, 310, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 143, 311, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 144, 312, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 145, 313, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 146, 314, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 147, 315, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 148, 316, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 149, 317, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 150, 318, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 151, 319, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 152, 320, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 153, 321, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 154, 322, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 155, 323, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 156, 324, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 157, 325, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 158, 326, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 159, 327, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 160, 328, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 161, 329, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 162, 330, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 163, 331, 0, FALSE, EfiDriverHealthStatusRepairRequired },\r
+\r
+ { TRUE, 164, 300, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 165, 301, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 166, 302, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 167, 303, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 168, 304, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 169, 305, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 170, 306, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 171, 307, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 172, 308, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 173, 309, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 174, 310, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 175, 311, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 176, 312, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 177, 313, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 178, 314, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 179, 315, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 180, 316, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 181, 317, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 182, 318, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 183, 319, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 184, 320, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 185, 321, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 186, 322, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 187, 323, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 188, 324, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 189, 325, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 190, 326, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 191, 327, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 192, 328, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 193, 329, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 194, 330, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 195, 331, STRING_TOKEN (STR_REPAIR_REQUIRED), FALSE, EfiDriverHealthStatusRepairRequired },\r
+\r
+ { TRUE, 196, 300, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 197, 301, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 198, 302, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 199, 303, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 200, 304, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 201, 305, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 202, 306, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 203, 307, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 204, 308, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 205, 309, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 206, 310, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 207, 311, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 208, 312, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 209, 313, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 210, 314, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 211, 315, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 212, 316, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 213, 317, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 214, 318, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 215, 319, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 216, 320, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 217, 321, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 218, 322, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 219, 323, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 220, 324, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 221, 325, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 222, 326, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 223, 327, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 224, 328, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 225, 329, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 226, 330, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 227, 331, 0, TRUE, EfiDriverHealthStatusRepairRequired },\r
+\r
+ { TRUE, 228, 300, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 229, 301, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 230, 302, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 231, 303, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 232, 304, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 233, 305, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 234, 306, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 235, 307, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 236, 308, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 237, 309, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 238, 310, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 239, 311, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 240, 312, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 241, 313, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 242, 314, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 243, 315, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 244, 316, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 245, 317, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 246, 318, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 247, 319, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 248, 320, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 249, 321, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 250, 322, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 251, 323, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 252, 324, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 253, 325, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 254, 326, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 255, 327, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 256, 328, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 257, 329, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 258, 330, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+ { TRUE, 259, 331, STRING_TOKEN (STR_REPAIR_REQUIRED), TRUE, EfiDriverHealthStatusRepairRequired },\r
+\r
+ { TRUE, 300, 000, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 301, 001, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 302, 002, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 303, 003, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 304, 004, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 305, 005, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 306, 006, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 307, 007, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 308, 000, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 309, 001, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 310, 002, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 311, 003, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 312, 004, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 313, 005, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 314, 006, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 315, 007, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 316, 000, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 317, 001, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 318, 002, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 319, 003, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 320, 004, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 321, 005, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 322, 006, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 323, 007, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 324, 000, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 325, 001, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 326, 002, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 327, 003, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 328, 004, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 329, 005, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 330, 006, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 331, 007, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 332, 100, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 333, 101, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 334, 102, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 335, 103, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 336, 104, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 337, 105, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 338, 106, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 339, 107, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 340, 108, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 341, 109, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 342, 110, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 343, 111, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 344, 112, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 345, 113, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 346, 114, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 347, 115, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 348, 100, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 349, 101, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 350, 102, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 351, 103, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 352, 104, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 353, 105, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 354, 106, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 355, 107, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 356, 108, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 357, 109, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 358, 110, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 359, 111, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 360, 112, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 361, 113, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 362, 114, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 363, 115, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 364, 100, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 365, 101, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 366, 102, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 367, 103, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 368, 104, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 369, 105, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 370, 106, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 371, 107, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 372, 108, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 373, 109, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 374, 110, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 375, 111, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 376, 112, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 377, 113, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 378, 114, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 379, 115, 0, FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 380, 100, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 381, 101, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 382, 102, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 383, 103, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 384, 104, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 385, 105, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 386, 106, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 387, 107, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 388, 108, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 389, 109, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 390, 110, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 391, 111, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 392, 112, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 393, 113, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 394, 114, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+ { TRUE, 395, 115, STRING_TOKEN (STR_CONFIG_WARNING), FALSE, EfiDriverHealthStatusConfigurationRequired },\r
+\r
+ { TRUE, 999, 999, 0, FALSE }\r
+};\r
+\r
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePathDiskIoDummy = {\r
+ {\r
+ {\r
+ HARDWARE_DEVICE_PATH,\r
+ HW_VENDOR_DP,\r
+ {\r
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
+ }\r
+ },\r
+ //\r
+ // {C153B68E-EBFC-488e-B110-662867745BBE}\r
+ //\r
+ { 0xc153b68e, 0xebfc, 0x488e, { 0xb1, 0x10, 0x66, 0x28, 0x67, 0x74, 0x5b, 0xbe} }\r
+ },\r
+ {\r
+ END_DEVICE_PATH_TYPE,\r
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
+ { \r
+ (UINT8) (END_DEVICE_PATH_LENGTH),\r
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
+ }\r
+ }\r
+};\r
+\r
+EFI_HII_HANDLE mHiiHandle = NULL;\r
+\r
+EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {\r
+ DiskIoDriverBindingSupported,\r
+ DiskIoDriverBindingStart,\r
+ DiskIoDriverBindingStop,\r
+ 0xaa,\r
+ NULL,\r
+ NULL\r
+};\r
+\r
+EFI_DRIVER_HEALTH_PROTOCOL gDiskIoDriverHealth = {\r
+ DiskIoDriverHealthGetHealthStatus,\r
+ DiskIoDriverHealthRepair\r
+};\r
+//\r
+// Template for DiskIo private data structure.\r
+// The pointer to BlockIo protocol interface is assigned dynamically.\r
+//\r
+DISK_IO_PRIVATE_DATA gDiskIoPrivateDataTemplate = {\r
+ DISK_IO_PRIVATE_DATA_SIGNATURE,\r
+ {\r
+ EFI_DISK_IO_PROTOCOL_REVISION,\r
+ DiskIoReadDisk,\r
+ DiskIoWriteDisk\r
+ },\r
+ NULL,\r
+ NULL, // Handle\r
+ NULL, // Consumed Protocol\r
+ NULL,\r
+ //\r
+ // Produced Protocol\r
+ //\r
+ {\r
+ DummyExtractConfig,\r
+ DummyRouteConfig,\r
+ DummyDriverCallback\r
+ },\r
+ //\r
+ // NVdata\r
+ //\r
+ { 0x0 },\r
+ //\r
+ // Controller Name\r
+ //\r
+ NULL,\r
+ //\r
+ // Controller Index\r
+ //\r
+ 0\r
+};\r
+\r
+DEVICE_STATE *\r
+GetDeviceState (\r
+ UINTN DeviceStateNumber\r
+ )\r
+{\r
+ UINTN Index;\r
+\r
+ for (Index = 0; mDeviceState[Index].CurrentState != 999 && mDeviceState[Index].CurrentState != DeviceStateNumber; Index++);\r
+ ASSERT (mDeviceState[Index].CurrentState != 999);\r
+\r
+ return &mDeviceState[Index];\r
+}\r
+\r
+\r
+/**\r
+ Test to see if this driver supports ControllerHandle. \r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to test\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver supports this device\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoDriverBindingSupported (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
+\r
+ //\r
+ // Open the IO Abstraction(s) needed to perform the supported test.\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ ControllerHandle,\r
+ &gEfiBlockIoProtocolGuid,\r
+ (VOID **) &BlockIo,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Close the I/O Abstraction(s) used to perform the supported test.\r
+ //\r
+ gBS->CloseProtocol (\r
+ ControllerHandle,\r
+ &gEfiBlockIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+/**\r
+ Start this driver on ControllerHandle by opening a Block IO protocol and\r
+ installing a Disk IO protocol on ControllerHandle.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to bind driver to\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver is added to ControllerHandle\r
+ @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoDriverBindingStart (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ DISK_IO_PRIVATE_DATA *Private;\r
+ DEVICE_STATE *DeviceState;\r
+ UINTN DataSize;\r
+ UINT32 StartCount;\r
+ CONTROLLER_STATE *ControllerState;\r
+\r
+ Private = NULL;\r
+ ControllerState = NULL;\r
+\r
+ //\r
+ // Connect to the Block IO interface on ControllerHandle.\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ ControllerHandle,\r
+ &gEfiBlockIoProtocolGuid,\r
+ (VOID **) &gDiskIoPrivateDataTemplate.BlockIo,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ \r
+ //\r
+ // Initialize the Disk IO device instance.\r
+ //\r
+ Private = AllocateCopyPool (sizeof (DISK_IO_PRIVATE_DATA), &gDiskIoPrivateDataTemplate);\r
+ if (Private == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto ErrorExit;\r
+ }\r
+ \r
+ //\r
+ // Begin Driver Health Protocol Support\r
+ //\r
+ DataSize = sizeof (StartCount);\r
+ Status = gRT->GetVariable (\r
+ L"StartCount",\r
+ &gEfiCallerIdGuid,\r
+ NULL,\r
+ &DataSize,\r
+ &StartCount\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // If the configuration can not be read, then set the default config value of 0\r
+ //\r
+ StartCount = 0;\r
+ }\r
+\r
+ ControllerIndex++;\r
+\r
+ DeviceState = GetDeviceState (mDeviceState[StartCount].CurrentState);\r
+ ASSERT (DeviceState != NULL);\r
+\r
+ ControllerState = AllocateZeroPool (sizeof (CONTROLLER_STATE));\r
+ if (ControllerState == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ \r
+ ControllerState->ControllerHandle = ControllerHandle;\r
+ ControllerState->Signature = DISK_IO_CONTROLLER_STATE_SIGNATURE;\r
+ ControllerState->DeviceStateNum = DeviceState->CurrentState;\r
+ ControllerState->ChildHandle = NULL;\r
+ ControllerState->ControllerIndex = ControllerIndex; \r
+\r
+ InsertTailList (&mControllerList, &ControllerState->Link);\r
+\r
+ if (DeviceState->HealthStatus != EfiDriverHealthStatusHealthy || DeviceState->StringId != 0) {\r
+ mNumNotHealthy++;\r
+ }\r
+\r
+ StartCount++;\r
+ while (!mDeviceState[StartCount].StartState) {\r
+ if (mDeviceState[StartCount].CurrentState == 999) {\r
+ StartCount = 0;\r
+ } else {\r
+ StartCount++;\r
+ }\r
+ }\r
+ if (mDeviceState[StartCount].CurrentState == 999) {\r
+ StartCount = 0;\r
+ }\r
+\r
+ Status = gRT->SetVariable (\r
+ L"StartCount",\r
+ &gEfiCallerIdGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ sizeof (StartCount),\r
+ &StartCount\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ if (DeviceState->HealthStatus == EfiDriverHealthStatusConfigurationRequired) {\r
+ Private->NVdata.ConfigGood = 0;\r
+ } else {\r
+ Private->NVdata.ConfigGood = 1;\r
+ }\r
+ Status = gRT->SetVariable (\r
+ L"Config",\r
+ &gEfiCallerIdGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ sizeof (Private->NVdata.ConfigGood),\r
+ &Private->NVdata.ConfigGood\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // End Driver Health Protocol Support\r
+ //\r
+\r
+ //\r
+ // Install protocol interfaces for the Disk IO device.\r
+ //\r
+ Status = gBS->InstallProtocolInterface (\r
+ &ControllerHandle,\r
+ &gEfiDiskIoProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ &Private->DiskIo\r
+ );\r
+ \r
+ Private->ControllerIndex = ControllerIndex;\r
+ AddName (Private);\r
+\r
+ErrorExit:\r
+ if (EFI_ERROR (Status)) {\r
+\r
+ if (Private != NULL) {\r
+ FreeUnicodeStringTable (Private->ControllerNameTable);\r
+ FreePool (Private);\r
+ }\r
+\r
+ gBS->CloseProtocol (\r
+ ControllerHandle,\r
+ &gEfiBlockIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle\r
+ );\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+\r
+/**\r
+ Stop this driver on ControllerHandle by removing Disk IO protocol and closing\r
+ the Block IO protocol on ControllerHandle.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to stop driver on\r
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
+ children is zero stop the entire bus driver.\r
+ @param ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+ @retval EFI_SUCCESS This driver is removed ControllerHandle\r
+ @retval other This driver was not removed from this device\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoDriverBindingStop (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN UINTN NumberOfChildren,\r
+ IN EFI_HANDLE *ChildHandleBuffer\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_DISK_IO_PROTOCOL *DiskIo;\r
+ DISK_IO_PRIVATE_DATA *Private;\r
+ DEVICE_STATE *DeviceState;\r
+ CONTROLLER_STATE *ControllerState;\r
+ LIST_ENTRY *Link;\r
+\r
+ ControllerState = NULL;\r
+ DeviceState = NULL;\r
+\r
+ //\r
+ // Get our context back.\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ ControllerHandle,\r
+ &gEfiDiskIoProtocolGuid,\r
+ (VOID **) &DiskIo,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ Private = DISK_IO_PRIVATE_DATA_FROM_THIS (DiskIo);\r
+\r
+ Status = gBS->UninstallProtocolInterface (\r
+ ControllerHandle,\r
+ &gEfiDiskIoProtocolGuid,\r
+ &Private->DiskIo\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+\r
+ Status = gBS->CloseProtocol (\r
+ ControllerHandle,\r
+ &gEfiBlockIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle\r
+ );\r
+ //\r
+ // Get the Controller State from global list\r
+ //\r
+ Link = GetFirstNode (&mControllerList);\r
+\r
+ while (!IsNull (&mControllerList, Link)) {\r
+ ControllerState = DISK_IO_CONTROLLER_STATE_FROM_LINK (Link);\r
+\r
+ if (ControllerState->ControllerHandle == ControllerHandle) {\r
+ DeviceState = GetDeviceState (ControllerState->DeviceStateNum);\r
+ break;\r
+ }\r
+ Link = GetNextNode (&mControllerList, Link);\r
+ }\r
+\r
+ ASSERT (DeviceState != NULL);\r
+\r
+ if (DeviceState->HealthStatus != EfiDriverHealthStatusHealthy || DeviceState->StringId != 0) {\r
+ mNumNotHealthy--;\r
+ }\r
+ \r
+ RemoveEntryList (Link);\r
+\r
+ if (ControllerState != NULL) {\r
+ FreePool (ControllerState);\r
+ } \r
+ }\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ FreeUnicodeStringTable (Private->ControllerNameTable);\r
+ FreePool (Private);\r
+ }\r
+\r
+ ControllerIndex = 0;\r
+ return Status;\r
+}\r
+\r
+\r
+\r
+/**\r
+ Read BufferSize bytes from Offset into Buffer.\r
+ Reads may support reads that are not aligned on\r
+ sector boundaries. There are three cases:\r
+ UnderRun - The first byte is not on a sector boundary or the read request is\r
+ less than a sector in length.\r
+ Aligned - A read of N contiguous sectors.\r
+ OverRun - The last byte is not on a sector boundary.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param MediaId Id of the media, changes every time the media is replaced.\r
+ @param Offset The starting byte offset to read from\r
+ @param BufferSize Size of Buffer\r
+ @param Buffer Buffer containing read data\r
+\r
+ @retval EFI_SUCCESS The data was read correctly from the device.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
+ @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not\r
+ valid for the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoReadDisk (\r
+ IN EFI_DISK_IO_PROTOCOL *This,\r
+ IN UINT32 MediaId,\r
+ IN UINT64 Offset,\r
+ IN UINTN BufferSize,\r
+ OUT VOID *Buffer\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ DISK_IO_PRIVATE_DATA *Private;\r
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
+ EFI_BLOCK_IO_MEDIA *Media;\r
+ UINT32 BlockSize;\r
+ UINT64 Lba;\r
+ UINT64 OverRunLba;\r
+ UINT32 UnderRun;\r
+ UINT32 OverRun;\r
+ BOOLEAN TransactionComplete;\r
+ UINTN WorkingBufferSize;\r
+ UINT8 *WorkingBuffer;\r
+ UINTN Length;\r
+ UINT8 *Data;\r
+ UINT8 *PreData;\r
+ UINTN IsBufferAligned;\r
+ UINTN DataBufferSize;\r
+ BOOLEAN LastRead;\r
+\r
+ Private = DISK_IO_PRIVATE_DATA_FROM_THIS (This);\r
+\r
+ BlockIo = Private->BlockIo;\r
+ Media = BlockIo->Media;\r
+ BlockSize = Media->BlockSize;\r
+\r
+ if (Media->MediaId != MediaId) {\r
+ return EFI_MEDIA_CHANGED;\r
+ }\r
+\r
+ WorkingBuffer = Buffer;\r
+ WorkingBufferSize = BufferSize;\r
+\r
+ //\r
+ // Allocate a temporary buffer for operation\r
+ //\r
+ DataBufferSize = BlockSize * DATA_BUFFER_BLOCK_NUM;\r
+\r
+ if (Media->IoAlign > 1) {\r
+ PreData = AllocatePool (DataBufferSize + Media->IoAlign);\r
+ Data = PreData - ((UINTN) PreData & (Media->IoAlign - 1)) + Media->IoAlign;\r
+ } else {\r
+ PreData = AllocatePool (DataBufferSize);\r
+ Data = PreData;\r
+ }\r
+\r
+ if (PreData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ Lba = DivU64x32Remainder (Offset, BlockSize, &UnderRun);\r
+\r
+ Length = BlockSize - UnderRun;\r
+ TransactionComplete = FALSE;\r
+\r
+ Status = EFI_SUCCESS;\r
+ if (UnderRun != 0) {\r
+ //\r
+ // Offset starts in the middle of an Lba, so read the entire block.\r
+ //\r
+ Status = BlockIo->ReadBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ Lba,\r
+ BlockSize,\r
+ Data\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ if (Length > BufferSize) {\r
+ Length = BufferSize;\r
+ TransactionComplete = TRUE;\r
+ }\r
+\r
+ CopyMem (WorkingBuffer, Data + UnderRun, Length);\r
+\r
+ WorkingBuffer += Length;\r
+\r
+ WorkingBufferSize -= Length;\r
+ if (WorkingBufferSize == 0) {\r
+ goto Done;\r
+ }\r
+\r
+ Lba += 1;\r
+ }\r
+\r
+ OverRunLba = Lba + DivU64x32Remainder (WorkingBufferSize, BlockSize, &OverRun);\r
+\r
+ if (!TransactionComplete && WorkingBufferSize >= BlockSize) {\r
+ //\r
+ // If the DiskIo maps directly to a BlockIo device do the read.\r
+ //\r
+ if (OverRun != 0) {\r
+ WorkingBufferSize -= OverRun;\r
+ }\r
+ //\r
+ // Check buffer alignment\r
+ //\r
+ IsBufferAligned = (UINTN) WorkingBuffer & (UINTN) (Media->IoAlign - 1);\r
+\r
+ if (Media->IoAlign <= 1 || IsBufferAligned == 0) {\r
+ //\r
+ // Alignment is satisfied, so read them together\r
+ //\r
+ Status = BlockIo->ReadBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ Lba,\r
+ WorkingBufferSize,\r
+ WorkingBuffer\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ WorkingBuffer += WorkingBufferSize;\r
+\r
+ } else {\r
+ //\r
+ // Use the allocated buffer instead of the original buffer\r
+ // to avoid alignment issue.\r
+ // Here, the allocated buffer (8-byte align) can satisfy the alignment\r
+ //\r
+ LastRead = FALSE;\r
+ do {\r
+ if (WorkingBufferSize <= DataBufferSize) {\r
+ //\r
+ // It is the last calling to readblocks in this loop\r
+ //\r
+ DataBufferSize = WorkingBufferSize;\r
+ LastRead = TRUE;\r
+ }\r
+\r
+ Status = BlockIo->ReadBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ Lba,\r
+ DataBufferSize,\r
+ Data\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ CopyMem (WorkingBuffer, Data, DataBufferSize);\r
+ WorkingBufferSize -= DataBufferSize;\r
+ WorkingBuffer += DataBufferSize;\r
+ Lba += DATA_BUFFER_BLOCK_NUM;\r
+ } while (!LastRead);\r
+ }\r
+ }\r
+\r
+ if (!TransactionComplete && OverRun != 0) {\r
+ //\r
+ // Last read is not a complete block.\r
+ //\r
+ Status = BlockIo->ReadBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ OverRunLba,\r
+ BlockSize,\r
+ Data\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ CopyMem (WorkingBuffer, Data, OverRun);\r
+ }\r
+\r
+Done:\r
+ if (PreData != NULL) {\r
+ FreePool (PreData);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+\r
+/**\r
+ Writes BufferSize bytes from Buffer into Offset.\r
+ Writes may require a read modify write to support writes that are not\r
+ aligned on sector boundaries. There are three cases:\r
+ UnderRun - The first byte is not on a sector boundary or the write request\r
+ is less than a sector in length. Read modify write is required.\r
+ Aligned - A write of N contiguous sectors.\r
+ OverRun - The last byte is not on a sector boundary. Read modified write\r
+ required.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param MediaId Id of the media, changes every time the media is replaced.\r
+ @param Offset The starting byte offset to read from\r
+ @param BufferSize Size of Buffer\r
+ @param Buffer Buffer containing read data\r
+\r
+ @retval EFI_SUCCESS The data was written correctly to the device.\r
+ @retval EFI_WRITE_PROTECTED The device can not be written to.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
+ @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not\r
+ valid for the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoWriteDisk (\r
+ IN EFI_DISK_IO_PROTOCOL *This,\r
+ IN UINT32 MediaId,\r
+ IN UINT64 Offset,\r
+ IN UINTN BufferSize,\r
+ IN VOID *Buffer\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ DISK_IO_PRIVATE_DATA *Private;\r
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
+ EFI_BLOCK_IO_MEDIA *Media;\r
+ UINT32 BlockSize;\r
+ UINT64 Lba;\r
+ UINT64 OverRunLba;\r
+ UINT32 UnderRun;\r
+ UINT32 OverRun;\r
+ BOOLEAN TransactionComplete;\r
+ UINTN WorkingBufferSize;\r
+ UINT8 *WorkingBuffer;\r
+ UINTN Length;\r
+ UINT8 *Data;\r
+ UINT8 *PreData;\r
+ UINTN IsBufferAligned;\r
+ UINTN DataBufferSize;\r
+ BOOLEAN LastWrite;\r
+\r
+ Private = DISK_IO_PRIVATE_DATA_FROM_THIS (This);\r
+\r
+ BlockIo = Private->BlockIo;\r
+ Media = BlockIo->Media;\r
+ BlockSize = Media->BlockSize;\r
+\r
+ if (Media->ReadOnly) {\r
+ return EFI_WRITE_PROTECTED;\r
+ }\r
+\r
+ if (Media->MediaId != MediaId) {\r
+ return EFI_MEDIA_CHANGED;\r
+ }\r
+\r
+ DataBufferSize = BlockSize * DATA_BUFFER_BLOCK_NUM;\r
+\r
+ if (Media->IoAlign > 1) {\r
+ PreData = AllocatePool (DataBufferSize + Media->IoAlign);\r
+ Data = PreData - ((UINTN) PreData & (Media->IoAlign - 1)) + Media->IoAlign;\r
+ } else {\r
+ PreData = AllocatePool (DataBufferSize);\r
+ Data = PreData;\r
+ }\r
+\r
+ if (PreData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ WorkingBuffer = Buffer;\r
+ WorkingBufferSize = BufferSize;\r
+\r
+ Lba = DivU64x32Remainder (Offset, BlockSize, &UnderRun);\r
+\r
+ Length = BlockSize - UnderRun;\r
+ TransactionComplete = FALSE;\r
+\r
+ Status = EFI_SUCCESS;\r
+ if (UnderRun != 0) {\r
+ //\r
+ // Offset starts in the middle of an Lba, so do read modify write.\r
+ //\r
+ Status = BlockIo->ReadBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ Lba,\r
+ BlockSize,\r
+ Data\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ if (Length > BufferSize) {\r
+ Length = BufferSize;\r
+ TransactionComplete = TRUE;\r
+ }\r
+\r
+ CopyMem (Data + UnderRun, WorkingBuffer, Length);\r
+\r
+ Status = BlockIo->WriteBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ Lba,\r
+ BlockSize,\r
+ Data\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ WorkingBuffer += Length;\r
+ WorkingBufferSize -= Length;\r
+ if (WorkingBufferSize == 0) {\r
+ goto Done;\r
+ }\r
+\r
+ Lba += 1;\r
+ }\r
+\r
+ OverRunLba = Lba + DivU64x32Remainder (WorkingBufferSize, BlockSize, &OverRun);\r
+\r
+ if (!TransactionComplete && WorkingBufferSize >= BlockSize) {\r
+ //\r
+ // If the DiskIo maps directly to a BlockIo device do the write.\r
+ //\r
+ if (OverRun != 0) {\r
+ WorkingBufferSize -= OverRun;\r
+ }\r
+ //\r
+ // Check buffer alignment\r
+ //\r
+ IsBufferAligned = (UINTN) WorkingBuffer & (UINTN) (Media->IoAlign - 1);\r
+\r
+ if (Media->IoAlign <= 1 || IsBufferAligned == 0) {\r
+ //\r
+ // Alignment is satisfied, so write them together\r
+ //\r
+ Status = BlockIo->WriteBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ Lba,\r
+ WorkingBufferSize,\r
+ WorkingBuffer\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ WorkingBuffer += WorkingBufferSize;\r
+\r
+ } else {\r
+ //\r
+ // The buffer parameter is not aligned with the request\r
+ // So use the allocated instead.\r
+ // It can fit almost all the cases.\r
+ //\r
+ LastWrite = FALSE;\r
+ do {\r
+ if (WorkingBufferSize <= DataBufferSize) {\r
+ //\r
+ // It is the last calling to writeblocks in this loop\r
+ //\r
+ DataBufferSize = WorkingBufferSize;\r
+ LastWrite = TRUE;\r
+ }\r
+\r
+ CopyMem (Data, WorkingBuffer, DataBufferSize);\r
+ Status = BlockIo->WriteBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ Lba,\r
+ DataBufferSize,\r
+ Data\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ WorkingBufferSize -= DataBufferSize;\r
+ WorkingBuffer += DataBufferSize;\r
+ Lba += DATA_BUFFER_BLOCK_NUM;\r
+ } while (!LastWrite);\r
+ }\r
+ }\r
+\r
+ if (!TransactionComplete && OverRun != 0) {\r
+ //\r
+ // Last bit is not a complete block, so do a read modify write.\r
+ //\r
+ Status = BlockIo->ReadBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ OverRunLba,\r
+ BlockSize,\r
+ Data\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ CopyMem (Data, WorkingBuffer, OverRun);\r
+\r
+ Status = BlockIo->WriteBlocks (\r
+ BlockIo,\r
+ MediaId,\r
+ OverRunLba,\r
+ BlockSize,\r
+ Data\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+ }\r
+\r
+Done:\r
+ if (PreData != NULL) {\r
+ FreePool (PreData);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+\r
+/**\r
+ Retrieves the health status of a controller in the platform. This function can also \r
+ optionally return warning messages, error messages, and a set of HII Forms that may \r
+ be repair a controller that is not proper configured. \r
+ \r
+ @param This A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
+\r
+ @param ControllerHandle The handle of the controller to retrieve the health status \r
+ on. This is an optional parameter that may be NULL. If \r
+ this parameter is NULL, then the value of ChildHandle is \r
+ ignored, and the combined health status of all the devices \r
+ that the driver is managing is returned.\r
+\r
+ @param ChildHandle The handle of the child controller to retrieve the health \r
+ status on. This is an optional parameter that may be NULL. \r
+ This parameter is ignored of ControllerHandle is NULL. It \r
+ will be NULL for device drivers. It will also be NULL for \r
+ bus drivers when an attempt is made to collect the health \r
+ status of the bus controller. If will not be NULL when an \r
+ attempt is made to collect the health status for a child \r
+ controller produced by the driver.\r
+\r
+ @param HealthStatus A pointer to the health status that is returned by this \r
+ function. This is an optional parameter that may be NULL. \r
+ This parameter is ignored of ControllerHandle is NULL. \r
+ The health status for the controller specified by \r
+ ControllerHandle and ChildHandle is returned. \r
+\r
+ @param MessageList A pointer to an array of warning or error messages associated \r
+ with the controller specified by ControllerHandle and \r
+ ChildHandle. This is an optional parameter that may be NULL. \r
+ MessageList is allocated by this function with the EFI Boot \r
+ Service AllocatePool(), and it is the caller's responsibility \r
+ to free MessageList with the EFI Boot Service FreePool(). \r
+ Each message is specified by tuple of an EFI_HII_HANDLE and \r
+ an EFI_STRING_ID. The array of messages is terminated by tuple \r
+ containing a EFI_HII_HANDLE with a value of NULL. The \r
+ EFI_HII_STRING_PROTOCOL.GetString() function can be used to \r
+ retrieve the warning or error message as a Null-terminated \r
+ Unicode string in a specific language. Messages may be \r
+ returned for any of the HealthStatus values except \r
+ EfiDriverHealthStatusReconnectRequired and \r
+ EfiDriverHealthStatusRebootRequired.\r
+\r
+ @param FormHiiHandle A pointer to the HII handle for an HII form associated with the \r
+ controller specified by ControllerHandle and ChildHandle. \r
+ This is an optional parameter that may be NULL. An HII form \r
+ is specified by a combination of an EFI_HII_HANDLE and an \r
+ EFI_GUID that identifies the Form Set GUID. The \r
+ EFI_FORM_BROWSER2_PROTOCOL.SendForm() function can be used \r
+ to display and allow the user to make configuration changes \r
+ to the HII Form. An HII form may only be returned with a \r
+ HealthStatus value of EfiDriverHealthStatusConfigurationRequired.\r
+\r
+ @retval EFI_SUCCESS ControllerHandle is NULL, and all the controllers \r
+ managed by this driver specified by This have a health \r
+ status of EfiDriverHealthStatusHealthy with no warning \r
+ messages to be returned. The ChildHandle, HealthStatus, \r
+ MessageList, and FormList parameters are ignored.\r
+\r
+ @retval EFI_DEVICE_ERROR ControllerHandle is NULL, and one or more of the \r
+ controllers managed by this driver specified by This \r
+ do not have a health status of EfiDriverHealthStatusHealthy. \r
+ The ChildHandle, HealthStatus, MessageList, and \r
+ FormList parameters are ignored.\r
+\r
+ @retval EFI_DEVICE_ERROR ControllerHandle is NULL, and one or more of the \r
+ controllers managed by this driver specified by This \r
+ have one or more warning and/or error messages. \r
+ The ChildHandle, HealthStatus, MessageList, and \r
+ FormList parameters are ignored.\r
+\r
+ @retval EFI_SUCCESS ControllerHandle is not NULL and the health status \r
+ of the controller specified by ControllerHandle and \r
+ ChildHandle was returned in HealthStatus. A list \r
+ of warning and error messages may be optionally \r
+ returned in MessageList, and a list of HII Forms \r
+ may be optionally returned in FormList.\r
+\r
+ @retval EFI_UNSUPPORTED ControllerHandle is not NULL, and the controller \r
+ specified by ControllerHandle and ChildHandle is not \r
+ currently being managed by the driver specified by This.\r
+\r
+ @retval EFI_INVALID_PARAMETER HealthStatus is NULL.\r
+\r
+ @retval EFI_OUT_OF_RESOURCES MessageList is not NULL, and there are not enough \r
+ resource available to allocate memory for MessageList.\r
+\r
+**/\r
+EFI_STATUS\r
+DiskIoDriverHealthGetHealthStatus (\r
+ IN EFI_DRIVER_HEALTH_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle OPTIONAL,\r
+ IN EFI_HANDLE ChildHandle OPTIONAL,\r
+ OUT EFI_DRIVER_HEALTH_STATUS *HealthStatus,\r
+ OUT EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList OPTIONAL,\r
+ OUT EFI_HII_HANDLE *FormHiiHandle OPTIONAL\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_DISK_IO_PROTOCOL *DiskIo;\r
+ DISK_IO_PRIVATE_DATA *Private;\r
+ DEVICE_STATE *DeviceState;\r
+ CONTROLLER_STATE *ControllerState;\r
+ LIST_ENTRY *Link;\r
+ UINTN BufferSize;\r
+\r
+ ControllerState = NULL;\r
+ DeviceState = NULL;\r
+\r
+ if (HealthStatus == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (ControllerHandle == NULL) {\r
+ *HealthStatus = EfiDriverHealthStatusHealthy;\r
+ if (mNumNotHealthy != 0) {\r
+ *HealthStatus = EfiDriverHealthStatusFailed;\r
+ }\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ //\r
+ // This is a device driver, so ChildHandle must be NULL.\r
+ //\r
+ if (ChildHandle != NULL) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ //\r
+ // Make sure this driver is currently managing ControllerHandle\r
+ //\r
+ Status = EfiTestManagedDevice (\r
+ ControllerHandle,\r
+ gDiskIoDriverBinding.DriverBindingHandle,\r
+ &gEfiBlockIoProtocolGuid\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (HealthStatus == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ Status = gBS->HandleProtocol (ControllerHandle, &gEfiDiskIoProtocolGuid, (VOID **) &DiskIo);\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ if (HealthStatus == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Private = DISK_IO_PRIVATE_DATA_FROM_THIS (DiskIo);\r
+\r
+\r
+ //\r
+ // Get the Controller State from global list\r
+ //\r
+ Link = GetFirstNode (&mControllerList);\r
+\r
+ while (!IsNull (&mControllerList, Link)) {\r
+ ControllerState = DISK_IO_CONTROLLER_STATE_FROM_LINK (Link);\r
+\r
+ if (ControllerState->ControllerHandle == ControllerHandle) {\r
+ DeviceState = GetDeviceState (ControllerState->DeviceStateNum);\r
+ break;\r
+ }\r
+ Link = GetNextNode (&mControllerList, Link);\r
+ }\r
+\r
+ ASSERT (DeviceState != NULL);\r
+\r
+ if (DeviceState->HealthStatus == EfiDriverHealthStatusConfigurationRequired) {\r
+ \r
+ //\r
+ // Read the configuration for this device\r
+ //\r
+ BufferSize = sizeof (Private->NVdata.ConfigGood);\r
+ Status = gRT->GetVariable (\r
+ L"Config",\r
+ &gEfiCallerIdGuid,\r
+ NULL,\r
+ &BufferSize,\r
+ &Private->NVdata.ConfigGood\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // If the config value is 1, then the configuration is valid and the state machine can move to the next state\r
+ // Otherwise, the state machine returns ConfigurationRequired again\r
+ //\r
+ if (Private->NVdata.ConfigGood == ControllerState->ControllerIndex) {\r
+ if (DeviceState->HealthStatus != EfiDriverHealthStatusHealthy || DeviceState->StringId != 0) {\r
+ mNumNotHealthy--;\r
+ }\r
+\r
+ ControllerState->DeviceStateNum = DeviceState->NextState;\r
+\r
+ DeviceState = GetDeviceState (ControllerState->DeviceStateNum);\r
+ ASSERT (DeviceState != NULL);\r
+\r
+ if (DeviceState->HealthStatus != EfiDriverHealthStatusHealthy) {\r
+ mNumNotHealthy++;\r
+ }\r
+ }\r
+ } \r
+ \r
+ *HealthStatus = DeviceState->HealthStatus;\r
+\r
+ if (MessageList != NULL) {\r
+ *MessageList = NULL;\r
+ if (DeviceState->StringId != 0) {\r
+ *MessageList = AllocateZeroPool (sizeof(EFI_DRIVER_HEALTH_HII_MESSAGE) * 2);\r
+ if (*MessageList == NULL) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ (*MessageList)[0].HiiHandle = mHiiHandle;\r
+ (*MessageList)[0].StringId = DeviceState->StringId;\r
+ } else {\r
+ *MessageList = AllocateZeroPool (sizeof(EFI_DRIVER_HEALTH_HII_MESSAGE) * 1);\r
+ if (*MessageList == NULL) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ }\r
+ }\r
+ if (FormHiiHandle != NULL) {\r
+ *FormHiiHandle = mHiiHandle;\r
+ }\r
+\r
+ if (DeviceState->HealthStatus == EfiDriverHealthStatusConfigurationRequired) {\r
+ Private->NVdata.ConfigGood = 0;\r
+ Status = gRT->SetVariable (\r
+ L"Config",\r
+ &gEfiCallerIdGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ sizeof (Private->NVdata.ConfigGood),\r
+ &Private->NVdata.ConfigGood\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ Performs a repair operation on a controller in the platform. This function can \r
+ optionally report repair progress information back to the platform. \r
+ \r
+ @param This A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
+ @param ControllerHandle The handle of the controller to repair.\r
+ @param ChildHandle The handle of the child controller to repair. This is \r
+ an optional parameter that may be NULL. It will be NULL \r
+ for device drivers. It will also be NULL for bus \r
+ drivers when an attempt is made to repair a bus controller.\r
+ If will not be NULL when an attempt is made to repair a \r
+ child controller produced by the driver.\r
+ @param RepairNotify A notification function that may be used by a driver to \r
+ report the progress of the repair operation. This is \r
+ an optional parameter that may be NULL. \r
+\r
+\r
+ @retval EFI_SUCCESS An attempt to repair the controller specified by \r
+ ControllerHandle and ChildHandle was performed. \r
+ The result of the repair operation can be \r
+ determined by calling GetHealthStatus().\r
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently \r
+ managing the controller specified by ControllerHandle \r
+ and ChildHandle.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources to perform the \r
+ repair operation.\r
+\r
+*/\r
+EFI_STATUS\r
+DiskIoDriverHealthRepair (\r
+ IN EFI_DRIVER_HEALTH_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE ChildHandle OPTIONAL,\r
+ IN EFI_DRIVER_HEALTH_REPAIR_PROGRESS_NOTIFY RepairNotify OPTIONAL\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Index;\r
+ DEVICE_STATE *DeviceState;\r
+ CONTROLLER_STATE *ControllerState;\r
+ LIST_ENTRY *Link;\r
+ EFI_DISK_IO_PROTOCOL *DiskIo;\r
+ DISK_IO_PRIVATE_DATA *Private;\r
+\r
+ Index = 0;\r
+ ControllerState = NULL;\r
+ DeviceState = NULL;\r
+ //\r
+ // This is a device driver, so ChildHandle must be NULL.\r
+ //\r
+ if (ChildHandle != NULL) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ //\r
+ // Make sure this driver is currently managing ControllerHandle\r
+ //\r
+ Status = EfiTestManagedDevice (\r
+ ControllerHandle,\r
+ gDiskIoDriverBinding.DriverBindingHandle,\r
+ &gEfiBlockIoProtocolGuid\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = gBS->HandleProtocol (ControllerHandle, &gEfiDiskIoProtocolGuid, (VOID **) &DiskIo);\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ Private = DISK_IO_PRIVATE_DATA_FROM_THIS (DiskIo);\r
+\r
+ Link = GetFirstNode (&mControllerList);\r
+\r
+ while (!IsNull (&mControllerList, Link)) {\r
+ ControllerState = DISK_IO_CONTROLLER_STATE_FROM_LINK (Link);\r
+\r
+ if (ControllerState->ControllerHandle == ControllerHandle) {\r
+ DeviceState = GetDeviceState (ControllerState->DeviceStateNum);\r
+ break;\r
+ }\r
+ Link = GetNextNode (&mControllerList, Link);\r
+ }\r
+\r
+ ASSERT (DeviceState != NULL);\r
+ //\r
+ // Check to see if the controller has already been repaired\r
+ //\r
+ if (DeviceState->HealthStatus != EfiDriverHealthStatusRepairRequired) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ if (DeviceState->RepairNotify) {\r
+ do {\r
+ RepairNotify(Index, 10);\r
+ Index++;\r
+ } while ((gBS->Stall(100000) == EFI_SUCCESS) && (Index < 10));\r
+ }\r
+\r
+ if (DeviceState->HealthStatus != EfiDriverHealthStatusHealthy || DeviceState->StringId != 0) {\r
+ mNumNotHealthy--;\r
+ }\r
+ \r
+ //\r
+ // Repair success, go to next state\r
+ //\r
+ ControllerState->DeviceStateNum = DeviceState->NextState;\r
+\r
+ DeviceState = GetDeviceState (ControllerState->DeviceStateNum);\r
+ ASSERT (DeviceState != NULL);\r
+\r
+ if (DeviceState->HealthStatus != EfiDriverHealthStatusHealthy || DeviceState->StringId != 0) {\r
+ mNumNotHealthy++;\r
+ }\r
+\r
+ if (DeviceState->HealthStatus == EfiDriverHealthStatusConfigurationRequired) {\r
+ Private->NVdata.ConfigGood = 0;\r
+ Status = gRT->SetVariable (\r
+ L"Config",\r
+ &gEfiCallerIdGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ sizeof (Private->NVdata.ConfigGood),\r
+ &Private->NVdata.ConfigGood\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ The user Entry Point for module DiskIo. The user code starts with this function.\r
+\r
+ @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
+ @param[in] SystemTable A pointer to the EFI System Table.\r
+ \r
+ @retval EFI_SUCCESS The entry point is executed successfully.\r
+ @retval other Some error occurs when executing this entry point.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeDiskIo (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ //\r
+ // Install driver model protocol(s).\r
+ //\r
+ Status = EfiLibInstallDriverBindingComponentName2 (\r
+ ImageHandle,\r
+ SystemTable,\r
+ &gDiskIoDriverBinding,\r
+ ImageHandle,\r
+ &gDiskIoComponentName,\r
+ &gDiskIoComponentName2\r
+ );\r
+\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ Status = gBS->InstallProtocolInterface (\r
+ &ImageHandle,\r
+ &gEfiDriverHealthProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ &gDiskIoDriverHealth\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ InitializeListHead (&mControllerList);\r
+\r
+ gDiskIoPrivateDataTemplate.Handle = ImageHandle;\r
+ Status = DiskIoConfigFormInit ();\r
+\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Initialize the serial configuration form.\r
+\r
+ @retval EFI_SUCCESS The serial configuration form is initialized.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+ @retval Others Other errors as indicated.\r
+**/\r
+EFI_STATUS\r
+DiskIoConfigFormInit (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Locate Hii Database protocol\r
+ //\r
+ Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **)&gDiskIoPrivateDataTemplate.HiiDatabase);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&gDiskIoPrivateDataTemplate.HiiConfigRouting);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Install Device Path Protocol and Config Access protocol to driver handle\r
+ //\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &gDiskIoPrivateDataTemplate.Handle,\r
+ &gEfiDevicePathProtocolGuid, &mHiiVendorDevicePathDiskIoDummy,\r
+ &gEfiHiiConfigAccessProtocolGuid, &gDiskIoPrivateDataTemplate.ConfigAccess,\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Publish our HII data\r
+ //\r
+ mHiiHandle = HiiAddPackages (\r
+ &gEfiCallerIdGuid,\r
+ gDiskIoPrivateDataTemplate.Handle,\r
+ DriverHealthDxeStrings,\r
+ DriverHealthVfrBin,\r
+ NULL\r
+ );\r
+ if (mHiiHandle == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+/**\r
+ This function processes the results of changes in configuration.\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Action Specifies the type of action taken by the browser.\r
+ @param QuestionId A unique value which is sent to the original\r
+ exporting driver so that it can identify the type\r
+ of data to expect.\r
+ @param Type The type of value for the question.\r
+ @param Value A pointer to the data being sent to the original\r
+ exporting driver.\r
+ @param ActionRequest On return, points to the action requested by the\r
+ callback function.\r
+\r
+ @retval EFI_SUCCESS The callback successfully handled the action.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r
+ variable and its data.\r
+ @retval EFI_DEVICE_ERROR The variable could not be saved.\r
+ @retval EFI_UNSUPPORTED The specified Action is not supported by the\r
+ callback.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DummyDriverCallback (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN EFI_BROWSER_ACTION Action,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN UINT8 Type,\r
+ IN EFI_IFR_TYPE_VALUE *Value,\r
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
+ )\r
+{\r
+\r
+ DISK_IO_NV_DATA *IfrNvData;\r
+\r
+ //\r
+ // Retrieve uncommitted data from Browser\r
+ //\r
+\r
+ IfrNvData = AllocateZeroPool (sizeof (DISK_IO_NV_DATA));\r
+ ASSERT (IfrNvData != NULL);\r
+\r
+ if (!HiiGetBrowserData (&gEfiCallerIdGuid, VariableName, sizeof (DISK_IO_NV_DATA), (UINT8 *) IfrNvData)) {\r
+ FreePool (IfrNvData);\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ if ((Value == NULL) || (ActionRequest == NULL)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ This function allows a caller to extract the current configuration for one\r
+ or more named elements from the target driver.\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Request A null-terminated Unicode string in\r
+ <ConfigRequest> format.\r
+ @param Progress On return, points to a character in the Request\r
+ string. Points to the string's null terminator if\r
+ request was successful. Points to the most recent\r
+ '&' before the first failing name/value pair (or\r
+ the beginning of the string if the failure is in\r
+ the first name/value pair) if the request was not\r
+ successful.\r
+ @param Results A null-terminated Unicode string in\r
+ <ConfigAltResp> format which has all values filled\r
+ in for the names in the Request string. String to\r
+ be allocated by the called function.\r
+\r
+ @retval EFI_SUCCESS The Results is filled with the requested values.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
+ @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
+ driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DummyExtractConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Request,\r
+ OUT EFI_STRING *Progress,\r
+ OUT EFI_STRING *Results\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN BufferSize;\r
+ DISK_IO_PRIVATE_DATA *PrivateData;\r
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
+ EFI_STRING ConfigRequest;\r
+ EFI_STRING ConfigRequestHdr;\r
+ UINTN Size;\r
+ \r
+ if (Progress == NULL || Results == NULL || Request == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // Initialize the local variables.\r
+ //\r
+ ConfigRequestHdr = NULL;\r
+ ConfigRequest = NULL;\r
+ Size = 0;\r
+ *Progress = Request;\r
+\r
+ PrivateData = DISK_IO_PRIVATE_DATA_FROM_CONFIG_ACCESS(This);\r
+ HiiConfigRouting = PrivateData->HiiConfigRouting;\r
+\r
+ //\r
+ // Get Buffer Storage data from EFI variable.\r
+ // Try to get the current setting from variable.\r
+ //\r
+ BufferSize = sizeof (DISK_IO_NV_DATA);\r
+ Status = gRT->GetVariable (\r
+ VariableName,\r
+ &gEfiCallerIdGuid,\r
+ NULL,\r
+ &BufferSize,\r
+ &PrivateData->NVdata\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+ \r
+ if (Request == NULL) {\r
+ //\r
+ // Request is set to NULL, construct full request string.\r
+ //\r
+\r
+ //\r
+ // Allocate and fill a buffer large enough to hold the <ConfigHdr> template \r
+ // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator\r
+ //\r
+ ConfigRequestHdr = HiiConstructConfigHdr (&gEfiCallerIdGuid, VariableName, PrivateData->Handle);\r
+ Size = (StrLen (ConfigRequest) + 32 + 1) * sizeof (CHAR16);\r
+ ConfigRequest = AllocateZeroPool (Size);\r
+ UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);\r
+ FreePool (ConfigRequestHdr);\r
+ } else {\r
+ //\r
+ // Check routing data in <ConfigHdr>.\r
+ // Note: if only one Storage is used, then this checking could be skipped.\r
+ //\r
+ if (!HiiIsConfigHdrMatch (Request, &gEfiCallerIdGuid, VariableName)) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+ ConfigRequest = Request;\r
+ }\r
+\r
+ //\r
+ // Convert buffer data to <ConfigResp> by helper function BlockToConfig()\r
+ //\r
+ Status = HiiConfigRouting->BlockToConfig (\r
+ HiiConfigRouting,\r
+ ConfigRequest,\r
+ (UINT8 *) &PrivateData->NVdata,\r
+ BufferSize,\r
+ Results,\r
+ Progress\r
+ );\r
+ \r
+ if (Request == NULL) {\r
+ FreePool (ConfigRequest);\r
+ *Progress = NULL;\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ This function processes the results of changes in configuration.\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Configuration A null-terminated Unicode string in <ConfigResp>\r
+ format.\r
+ @param Progress A pointer to a string filled in with the offset of\r
+ the most recent '&' before the first failing\r
+ name/value pair (or the beginning of the string if\r
+ the failure is in the first name/value pair) or\r
+ the terminating NULL if all was successful.\r
+\r
+ @retval EFI_SUCCESS The Results is processed successfully.\r
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
+ driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DummyRouteConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Configuration,\r
+ OUT EFI_STRING *Progress\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN BufferSize;\r
+ DISK_IO_PRIVATE_DATA *PrivateData;\r
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
+\r
+ if (Configuration == NULL || Progress == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+\r
+ PrivateData = DISK_IO_PRIVATE_DATA_FROM_CONFIG_ACCESS (This);\r
+ HiiConfigRouting = PrivateData->HiiConfigRouting;\r
+ *Progress = Configuration;\r
+\r
+ //\r
+ // Check routing data in <ConfigHdr>.\r
+ // Note: if only one Storage is used, then this checking could be skipped.\r
+ //\r
+ if (!HiiIsConfigHdrMatch (Configuration, &gEfiCallerIdGuid, VariableName)) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ //\r
+ // Get Buffer Storage data from EFI variable\r
+ //\r
+ BufferSize = sizeof (DISK_IO_NV_DATA);\r
+ Status = gRT->GetVariable (\r
+ VariableName,\r
+ &gEfiCallerIdGuid,\r
+ NULL,\r
+ &BufferSize,\r
+ &PrivateData->NVdata\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Convert <ConfigResp> to buffer data by helper function ConfigToBlock()\r
+ //\r
+ BufferSize = sizeof (DISK_IO_NV_DATA);\r
+ Status = HiiConfigRouting->ConfigToBlock (\r
+ HiiConfigRouting,\r
+ Configuration,\r
+ (UINT8 *) &PrivateData->NVdata,\r
+ &BufferSize,\r
+ Progress\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Store Buffer Storage back to EFI variable\r
+ //\r
+ Status = gRT->SetVariable(\r
+ VariableName,\r
+ &gEfiCallerIdGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ sizeof (DISK_IO_NV_DATA),\r
+ &PrivateData->NVdata\r
+ );\r
+\r
+ return Status;\r
+}\r
--- /dev/null
+/** @file\r
+ DiskIo driver that layers it's self on every Block IO protocol in the system.\r
+ DiskIo converts a block oriented device to a byte oriented device.\r
+\r
+ Copyright (c) 2006 - 2009, Intel Corporation \r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#ifndef _DISK_IO_H\r
+#define _DISK_IO_H\r
+\r
+#include <Uefi.h>\r
+#include <Protocol/BlockIo.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Protocol/DriverConfiguration.h>\r
+#include <Protocol/DriverConfiguration2.h>\r
+#include <Protocol/DriverHealth.h>\r
+#include <Protocol/DiskIo.h>\r
+#include <Protocol/HiiDatabase.h>\r
+#include <Protocol/HiiConfigAccess.h>\r
+#include <Protocol/HiiConfigRouting.h>\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/HiiString.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/PrintLib.h>\r
+#include "NVDataStruc.h"\r
+\r
+#define DISK_IO_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('d', 's', 'k', 'I') \r
+\r
+#define DISK_IO_CONTROLLER_STATE_SIGNATURE SIGNATURE_32 ('c', 't', 's', 'S') \r
+\r
+#define DATA_BUFFER_BLOCK_NUM (64)\r
+\r
+typedef struct {\r
+ VENDOR_DEVICE_PATH VendorDevicePath;\r
+ EFI_DEVICE_PATH_PROTOCOL End;\r
+} HII_VENDOR_DEVICE_PATH;\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+ EFI_DISK_IO_PROTOCOL DiskIo;\r
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
+ EFI_HANDLE Handle;\r
+ //\r
+ // Consumed protocol\r
+ //\r
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;\r
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
+\r
+ //\r
+ // Produced protocol\r
+ //\r
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
+\r
+ DISK_IO_NV_DATA NVdata;\r
+ EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
+ UINT8 ControllerIndex;\r
+} DISK_IO_PRIVATE_DATA;\r
+\r
+typedef struct {\r
+ BOOLEAN StartState;\r
+ UINTN CurrentState;\r
+ UINTN NextState;\r
+ EFI_STRING_ID StringId;\r
+ BOOLEAN RepairNotify;\r
+ EFI_DRIVER_HEALTH_STATUS HealthStatus;\r
+} DEVICE_STATE;\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+\r
+ EFI_HANDLE ControllerHandle;\r
+ UINTN ControllerIndex;\r
+ EFI_HANDLE ChildHandle;\r
+ UINTN DeviceStateNum;\r
+} CONTROLLER_STATE;\r
+\r
+#define DISK_IO_PRIVATE_DATA_FROM_THIS(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo, DISK_IO_PRIVATE_DATA_SIGNATURE)\r
+#define DISK_IO_PRIVATE_DATA_FROM_CONFIG_ACCESS(a) CR (a, DISK_IO_PRIVATE_DATA, ConfigAccess, DISK_IO_PRIVATE_DATA_SIGNATURE)\r
+\r
+#define DISK_IO_CONTROLLER_STATE_FROM_HANDLE(a) CR (a, CONTROLLER_STATE, ControllerHandle, DISK_IO_CONTROLLER_STATE_SIGNATURE)\r
+#define DISK_IO_CONTROLLER_STATE_FROM_LINK(a) CR (a, CONTROLLER_STATE, Link, DISK_IO_CONTROLLER_STATE_SIGNATURE)\r
+//\r
+// Global Variables\r
+//\r
+extern EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2;\r
+extern EFI_DRIVER_HEALTH_PROTOCOL gDiskIoDriverHealth;\r
+\r
+//\r
+// This is the generated String package data for all .UNI files.\r
+// This data array is ready to be used as input of HiiAddPackages() to\r
+// create a packagelist (which contains Form packages, String packages, etc).\r
+//\r
+extern UINT8 DriverHealthDxeStrings[];\r
+extern UINT8 DriverHealthVfrBin[];\r
+\r
+\r
+//\r
+// Prototypes\r
+// Driver model protocol interface\r
+//\r
+/**\r
+ Test to see if this driver supports ControllerHandle. \r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to test\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver supports this device\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoDriverBindingSupported (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
+ );\r
+\r
+/**\r
+ Start this driver on ControllerHandle by opening a Block IO protocol and\r
+ installing a Disk IO protocol on ControllerHandle.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to bind driver to\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver is added to ControllerHandle\r
+ @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoDriverBindingStart (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
+ );\r
+\r
+/**\r
+ Stop this driver on ControllerHandle by removing Disk IO protocol and closing\r
+ the Block IO protocol on ControllerHandle.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to stop driver on\r
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
+ children is zero stop the entire bus driver.\r
+ @param ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+ @retval EFI_SUCCESS This driver is removed ControllerHandle\r
+ @retval other This driver was not removed from this device\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoDriverBindingStop (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN UINTN NumberOfChildren,\r
+ IN EFI_HANDLE *ChildHandleBuffer\r
+ );\r
+\r
+//\r
+// Disk I/O Protocol Interface\r
+//\r
+/**\r
+ Read BufferSize bytes from Offset into Buffer.\r
+ Reads may support reads that are not aligned on\r
+ sector boundaries. There are three cases:\r
+ UnderRun - The first byte is not on a sector boundary or the read request is\r
+ less than a sector in length.\r
+ Aligned - A read of N contiguous sectors.\r
+ OverRun - The last byte is not on a sector boundary.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param MediaId Id of the media, changes every time the media is replaced.\r
+ @param Offset The starting byte offset to read from\r
+ @param BufferSize Size of Buffer\r
+ @param Buffer Buffer containing read data\r
+\r
+ @retval EFI_SUCCESS The data was read correctly from the device.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
+ @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not\r
+ valid for the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoReadDisk (\r
+ IN EFI_DISK_IO_PROTOCOL *This,\r
+ IN UINT32 MediaId,\r
+ IN UINT64 Offset,\r
+ IN UINTN BufferSize,\r
+ OUT VOID *Buffer\r
+ );\r
+\r
+/**\r
+ Writes BufferSize bytes from Buffer into Offset.\r
+ Writes may require a read modify write to support writes that are not\r
+ aligned on sector boundaries. There are three cases:\r
+ UnderRun - The first byte is not on a sector boundary or the write request\r
+ is less than a sector in length. Read modify write is required.\r
+ Aligned - A write of N contiguous sectors.\r
+ OverRun - The last byte is not on a sector boundary. Read modified write\r
+ required.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param MediaId Id of the media, changes every time the media is replaced.\r
+ @param Offset The starting byte offset to read from\r
+ @param BufferSize Size of Buffer\r
+ @param Buffer Buffer containing read data\r
+\r
+ @retval EFI_SUCCESS The data was written correctly to the device.\r
+ @retval EFI_WRITE_PROTECTED The device can not be written to.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
+ @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not\r
+ valid for the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoWriteDisk (\r
+ IN EFI_DISK_IO_PROTOCOL *This,\r
+ IN UINT32 MediaId,\r
+ IN UINT64 Offset,\r
+ IN UINTN BufferSize,\r
+ IN VOID *Buffer\r
+ );\r
+\r
+//\r
+// EFI Component Name Functions\r
+//\r
+/**\r
+ Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+ This function retrieves the user readable name of a driver in the form of a\r
+ Unicode string. If the driver specified by This has a user readable name in\r
+ the language specified by Language, then a pointer to the driver name is\r
+ returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+ by This does not support the language specified by Language,\r
+ then EFI_UNSUPPORTED is returned.\r
+\r
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+ EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+ @param Language[in] A pointer to a Null-terminated ASCII string\r
+ array indicating the language. This is the\r
+ language of the driver name that the caller is\r
+ requesting, and it must match one of the\r
+ languages specified in SupportedLanguages. The\r
+ number of languages supported by a driver is up\r
+ to the driver writer. Language is specified\r
+ in RFC 4646 or ISO 639-2 language code format.\r
+\r
+ @param DriverName[out] A pointer to the Unicode string to return.\r
+ This Unicode string is the name of the\r
+ driver specified by This in the language\r
+ specified by Language.\r
+\r
+ @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
+ This and the language specified by Language was\r
+ returned in DriverName.\r
+\r
+ @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+ @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+\r
+ @retval EFI_UNSUPPORTED The driver specified by This does not support\r
+ the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoComponentNameGetDriverName (\r
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
+ IN CHAR8 *Language,\r
+ OUT CHAR16 **DriverName\r
+ );\r
+\r
+/**\r
+ Retrieves a Unicode string that is the user readable name of the controller\r
+ that is being managed by a driver.\r
+\r
+ This function retrieves the user readable name of the controller specified by\r
+ ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+ driver specified by This has a user readable name in the language specified by\r
+ Language, then a pointer to the controller name is returned in ControllerName,\r
+ and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
+ managing the controller specified by ControllerHandle and ChildHandle,\r
+ then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
+ support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+ EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+ @param ControllerHandle[in] The handle of a controller that the driver\r
+ specified by This is managing. This handle\r
+ specifies the controller whose name is to be\r
+ returned.\r
+\r
+ @param ChildHandle[in] The handle of the child controller to retrieve\r
+ the name of. This is an optional parameter that\r
+ may be NULL. It will be NULL for device\r
+ drivers. It will also be NULL for a bus drivers\r
+ that wish to retrieve the name of the bus\r
+ controller. It will not be NULL for a bus\r
+ driver that wishes to retrieve the name of a\r
+ child controller.\r
+\r
+ @param Language[in] A pointer to a Null-terminated ASCII string\r
+ array indicating the language. This is the\r
+ language of the driver name that the caller is\r
+ requesting, and it must match one of the\r
+ languages specified in SupportedLanguages. The\r
+ number of languages supported by a driver is up\r
+ to the driver writer. Language is specified in\r
+ RFC 4646 or ISO 639-2 language code format.\r
+\r
+ @param ControllerName[out] A pointer to the Unicode string to return.\r
+ This Unicode string is the name of the\r
+ controller specified by ControllerHandle and\r
+ ChildHandle in the language specified by\r
+ Language from the point of view of the driver\r
+ specified by This.\r
+\r
+ @retval EFI_SUCCESS The Unicode string for the user readable name in\r
+ the language specified by Language for the\r
+ driver specified by This was returned in\r
+ DriverName.\r
+\r
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+\r
+ @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+ EFI_HANDLE.\r
+\r
+ @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+ @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
+ managing the controller specified by\r
+ ControllerHandle and ChildHandle.\r
+\r
+ @retval EFI_UNSUPPORTED The driver specified by This does not support\r
+ the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DiskIoComponentNameGetControllerName (\r
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE ChildHandle OPTIONAL,\r
+ IN CHAR8 *Language,\r
+ OUT CHAR16 **ControllerName\r
+ );\r
+\r
+//\r
+// EFI Driver Health Functions\r
+//\r
+/**\r
+ Retrieves the health status of a controller in the platform. This function can also \r
+ optionally return warning messages, error messages, and a set of HII Forms that may \r
+ be repair a controller that is not proper configured. \r
+ \r
+ @param This A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
+\r
+ @param ControllerHandle The handle of the controller to retrieve the health status \r
+ on. This is an optional parameter that may be NULL. If \r
+ this parameter is NULL, then the value of ChildHandle is \r
+ ignored, and the combined health status of all the devices \r
+ that the driver is managing is returned.\r
+\r
+ @param ChildHandle The handle of the child controller to retrieve the health \r
+ status on. This is an optional parameter that may be NULL. \r
+ This parameter is ignored of ControllerHandle is NULL. It \r
+ will be NULL for device drivers. It will also be NULL for \r
+ bus drivers when an attempt is made to collect the health \r
+ status of the bus controller. If will not be NULL when an \r
+ attempt is made to collect the health status for a child \r
+ controller produced by the driver.\r
+\r
+ @param HealthStatus A pointer to the health status that is returned by this \r
+ function. This is an optional parameter that may be NULL. \r
+ This parameter is ignored of ControllerHandle is NULL. \r
+ The health status for the controller specified by \r
+ ControllerHandle and ChildHandle is returned. \r
+\r
+ @param MessageList A pointer to an array of warning or error messages associated \r
+ with the controller specified by ControllerHandle and \r
+ ChildHandle. This is an optional parameter that may be NULL. \r
+ MessageList is allocated by this function with the EFI Boot \r
+ Service AllocatePool(), and it is the caller's responsibility \r
+ to free MessageList with the EFI Boot Service FreePool(). \r
+ Each message is specified by tuple of an EFI_HII_HANDLE and \r
+ an EFI_STRING_ID. The array of messages is terminated by tuple \r
+ containing a EFI_HII_HANDLE with a value of NULL. The \r
+ EFI_HII_STRING_PROTOCOL.GetString() function can be used to \r
+ retrieve the warning or error message as a Null-terminated \r
+ Unicode string in a specific language. Messages may be \r
+ returned for any of the HealthStatus values except \r
+ EfiDriverHealthStatusReconnectRequired and \r
+ EfiDriverHealthStatusRebootRequired.\r
+\r
+ @param FormHiiHandle A pointer to the HII handle for an HII form associated with the \r
+ controller specified by ControllerHandle and ChildHandle. \r
+ This is an optional parameter that may be NULL. An HII form \r
+ is specified by a combination of an EFI_HII_HANDLE and an \r
+ EFI_GUID that identifies the Form Set GUID. The \r
+ EFI_FORM_BROWSER2_PROTOCOL.SendForm() function can be used \r
+ to display and allow the user to make configuration changes \r
+ to the HII Form. An HII form may only be returned with a \r
+ HealthStatus value of EfiDriverHealthStatusConfigurationRequired.\r
+\r
+ @retval EFI_SUCCESS ControllerHandle is NULL, and all the controllers \r
+ managed by this driver specified by This have a health \r
+ status of EfiDriverHealthStatusHealthy with no warning \r
+ messages to be returned. The ChildHandle, HealthStatus, \r
+ MessageList, and FormList parameters are ignored.\r
+\r
+ @retval EFI_DEVICE_ERROR ControllerHandle is NULL, and one or more of the \r
+ controllers managed by this driver specified by This \r
+ do not have a health status of EfiDriverHealthStatusHealthy. \r
+ The ChildHandle, HealthStatus, MessageList, and \r
+ FormList parameters are ignored.\r
+\r
+ @retval EFI_DEVICE_ERROR ControllerHandle is NULL, and one or more of the \r
+ controllers managed by this driver specified by This \r
+ have one or more warning and/or error messages. \r
+ The ChildHandle, HealthStatus, MessageList, and \r
+ FormList parameters are ignored.\r
+\r
+ @retval EFI_SUCCESS ControllerHandle is not NULL and the health status \r
+ of the controller specified by ControllerHandle and \r
+ ChildHandle was returned in HealthStatus. A list \r
+ of warning and error messages may be optionally \r
+ returned in MessageList, and a list of HII Forms \r
+ may be optionally returned in FormList.\r
+\r
+ @retval EFI_UNSUPPORTED ControllerHandle is not NULL, and the controller \r
+ specified by ControllerHandle and ChildHandle is not \r
+ currently being managed by the driver specified by This.\r
+\r
+ @retval EFI_INVALID_PARAMETER HealthStatus is NULL.\r
+\r
+ @retval EFI_OUT_OF_RESOURCES MessageList is not NULL, and there are not enough \r
+ resource available to allocate memory for MessageList.\r
+\r
+**/\r
+EFI_STATUS\r
+DiskIoDriverHealthGetHealthStatus (\r
+ IN EFI_DRIVER_HEALTH_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle OPTIONAL,\r
+ IN EFI_HANDLE ChildHandle OPTIONAL,\r
+ OUT EFI_DRIVER_HEALTH_STATUS *HealthStatus,\r
+ OUT EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList OPTIONAL,\r
+ OUT EFI_HII_HANDLE *FormHiiHandle OPTIONAL\r
+ );\r
+\r
+/**\r
+ Performs a repair operation on a controller in the platform. This function can \r
+ optionally report repair progress information back to the platform. \r
+ \r
+ @param This A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
+ @param ControllerHandle The handle of the controller to repair.\r
+ @param ChildHandle The handle of the child controller to repair. This is \r
+ an optional parameter that may be NULL. It will be NULL \r
+ for device drivers. It will also be NULL for bus \r
+ drivers when an attempt is made to repair a bus controller.\r
+ If will not be NULL when an attempt is made to repair a \r
+ child controller produced by the driver.\r
+ @param RepairNotify A notification function that may be used by a driver to \r
+ report the progress of the repair operation. This is \r
+ an optional parameter that may be NULL. \r
+\r
+\r
+ @retval EFI_SUCCESS An attempt to repair the controller specified by \r
+ ControllerHandle and ChildHandle was performed. \r
+ The result of the repair operation can be \r
+ determined by calling GetHealthStatus().\r
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently \r
+ managing the controller specified by ControllerHandle \r
+ and ChildHandle.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources to perform the \r
+ repair operation.\r
+\r
+*/\r
+EFI_STATUS\r
+DiskIoDriverHealthRepair (\r
+ IN EFI_DRIVER_HEALTH_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE ChildHandle OPTIONAL,\r
+ IN EFI_DRIVER_HEALTH_REPAIR_PROGRESS_NOTIFY RepairNotify OPTIONAL\r
+ );\r
+\r
+/**\r
+ Initialize the serial configuration form.\r
+\r
+ @retval EFI_SUCCESS The serial configuration form is initialized.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+ @retval Others Other errors as indicated.\r
+**/\r
+EFI_STATUS\r
+DiskIoConfigFormInit (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ This function allows a caller to extract the current configuration for one\r
+ or more named elements from the target driver.\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Request A null-terminated Unicode string in\r
+ <ConfigRequest> format.\r
+ @param Progress On return, points to a character in the Request\r
+ string. Points to the string's null terminator if\r
+ request was successful. Points to the most recent\r
+ '&' before the first failing name/value pair (or\r
+ the beginning of the string if the failure is in\r
+ the first name/value pair) if the request was not\r
+ successful.\r
+ @param Results A null-terminated Unicode string in\r
+ <ConfigAltResp> format which has all values filled\r
+ in for the names in the Request string. String to\r
+ be allocated by the called function.\r
+\r
+ @retval EFI_SUCCESS The Results is filled with the requested values.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
+ @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
+ driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DummyExtractConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Request,\r
+ OUT EFI_STRING *Progress,\r
+ OUT EFI_STRING *Results\r
+ );\r
+\r
+/**\r
+ This function processes the results of changes in configuration.\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Configuration A null-terminated Unicode string in <ConfigResp>\r
+ format.\r
+ @param Progress A pointer to a string filled in with the offset of\r
+ the most recent '&' before the first failing\r
+ name/value pair (or the beginning of the string if\r
+ the failure is in the first name/value pair) or\r
+ the terminating NULL if all was successful.\r
+\r
+ @retval EFI_SUCCESS The Results is processed successfully.\r
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
+ driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DummyRouteConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Configuration,\r
+ OUT EFI_STRING *Progress\r
+ );\r
+\r
+/**\r
+ This function processes the results of changes in configuration.\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Action Specifies the type of action taken by the browser.\r
+ @param QuestionId A unique value which is sent to the original\r
+ exporting driver so that it can identify the type\r
+ of data to expect.\r
+ @param Type The type of value for the question.\r
+ @param Value A pointer to the data being sent to the original\r
+ exporting driver.\r
+ @param ActionRequest On return, points to the action requested by the\r
+ callback function.\r
+\r
+ @retval EFI_SUCCESS The callback successfully handled the action.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r
+ variable and its data.\r
+ @retval EFI_DEVICE_ERROR The variable could not be saved.\r
+ @retval EFI_UNSUPPORTED The specified Action is not supported by the\r
+ callback.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DummyDriverCallback (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN EFI_BROWSER_ACTION Action,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN UINT8 Type,\r
+ IN EFI_IFR_TYPE_VALUE *Value,\r
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
+ );\r
+\r
+/**\r
+ Add the ISO639-2 and RFC4646 component name both for the Disk IO device\r
+\r
+ @param DiskIoDevice A pointer to the DISK_IO_PRIVATE_DATA instance.\r
+\r
+**/\r
+VOID\r
+AddName (\r
+ IN DISK_IO_PRIVATE_DATA *DiskIoDevice\r
+ );\r
+\r
+#endif\r