1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687
|
/** @file
Utility functions for UI presentation.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 - 2022 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Setup.h"
BOOLEAN mHiiPackageListUpdated;
UI_MENU_SELECTION *gCurrentSelection;
EFI_HII_HANDLE mCurrentHiiHandle = NULL;
EFI_GUID mCurrentFormSetGuid = {
0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }
};
UINT16 mCurrentFormId = 0;
EFI_EVENT mValueChangedEvent = NULL;
LIST_ENTRY mRefreshEventList = INITIALIZE_LIST_HEAD_VARIABLE (mRefreshEventList);
UINT16 mCurFakeQestId;
FORM_DISPLAY_ENGINE_FORM gDisplayFormData;
BOOLEAN mFinishRetrieveCall = FALSE;
/**
Check whether the ConfigAccess protocol is available.
@param FormSet FormSet of which the ConfigAcces protocol need to be checked.
@retval EFI_SUCCESS The function executed successfully.
**/
EFI_STATUS
CheckConfigAccess (
IN FORM_BROWSER_FORMSET *FormSet
)
{
EFI_STATUS Status;
Status = gBS->HandleProtocol (
FormSet->DriverHandle,
&gEfiHiiConfigAccessProtocolGuid,
(VOID **)&FormSet->ConfigAccess
);
if (EFI_ERROR (Status)) {
//
// Configuration Driver don't attach ConfigAccess protocol to its HII package
// list, then there will be no configuration action required.
// Or the ConfigAccess protocol has been uninstalled.
//
FormSet->ConfigAccess = NULL;
}
return EFI_SUCCESS;
}
/**
Evaluate all expressions in a Form.
@param FormSet FormSet this Form belongs to.
@param Form The Form.
@retval EFI_SUCCESS The expression evaluated successfuly
**/
EFI_STATUS
EvaluateFormExpressions (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form
)
{
EFI_STATUS Status;
LIST_ENTRY *Link;
FORM_EXPRESSION *Expression;
Link = GetFirstNode (&Form->ExpressionListHead);
while (!IsNull (&Form->ExpressionListHead, Link)) {
Expression = FORM_EXPRESSION_FROM_LINK (Link);
Link = GetNextNode (&Form->ExpressionListHead, Link);
if ((Expression->Type == EFI_HII_EXPRESSION_INCONSISTENT_IF) ||
(Expression->Type == EFI_HII_EXPRESSION_NO_SUBMIT_IF) ||
(Expression->Type == EFI_HII_EXPRESSION_WARNING_IF) ||
(Expression->Type == EFI_HII_EXPRESSION_WRITE) ||
((Expression->Type == EFI_HII_EXPRESSION_READ) && (Form->FormType != STANDARD_MAP_FORM_TYPE)))
{
//
// Postpone Form validation to Question editing or Form submitting or Question Write or Question Read for nonstandard form.
//
continue;
}
Status = EvaluateExpression (FormSet, Form, Expression);
if (EFI_ERROR (Status)) {
return Status;
}
}
return EFI_SUCCESS;
}
/**
Base on the opcode buffer info to get the display statement.
@param OpCode The input opcode buffer for this statement.
@retval Statement The statement use this opcode buffer.
**/
FORM_DISPLAY_ENGINE_STATEMENT *
GetDisplayStatement (
IN EFI_IFR_OP_HEADER *OpCode
)
{
FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement;
LIST_ENTRY *Link;
Link = GetFirstNode (&gDisplayFormData.StatementListHead);
while (!IsNull (&gDisplayFormData.StatementListHead, Link)) {
DisplayStatement = FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (Link);
if (DisplayStatement->OpCode == OpCode) {
return DisplayStatement;
}
Link = GetNextNode (&gDisplayFormData.StatementListHead, Link);
}
return NULL;
}
/**
Free the refresh event list.
**/
VOID
FreeRefreshEvent (
VOID
)
{
LIST_ENTRY *Link;
FORM_BROWSER_REFRESH_EVENT_NODE *EventNode;
while (!IsListEmpty (&mRefreshEventList)) {
Link = GetFirstNode (&mRefreshEventList);
EventNode = FORM_BROWSER_REFRESH_EVENT_FROM_LINK (Link);
RemoveEntryList (&EventNode->Link);
gBS->CloseEvent (EventNode->RefreshEvent);
FreePool (EventNode);
}
}
/**
Check whether this statement value is changed. If yes, update the statement value and return TRUE;
else return FALSE.
@param Statement The statement need to check.
**/
VOID
UpdateStatement (
IN OUT FORM_BROWSER_STATEMENT *Statement
)
{
GetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithHiiDriver);
//
// Reset FormPackage update flag
//
mHiiPackageListUpdated = FALSE;
//
// Question value may be changed, need invoke its Callback()
//
ProcessCallBackFunction (gCurrentSelection, gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, EFI_BROWSER_ACTION_RETRIEVE, FALSE);
if (mHiiPackageListUpdated) {
//
// Package list is updated, force to reparse IFR binary of target Formset
//
mHiiPackageListUpdated = FALSE;
gCurrentSelection->Action = UI_ACTION_REFRESH_FORMSET;
}
}
/**
Refresh the question which has refresh guid event attribute.
@param Event The event which has this function related.
@param Context The input context info related to this event or the status code return to the caller.
**/
VOID
EFIAPI
RefreshEventNotifyForStatement (
IN EFI_EVENT Event,
IN VOID *Context
)
{
FORM_BROWSER_STATEMENT *Statement;
Statement = (FORM_BROWSER_STATEMENT *)Context;
UpdateStatement (Statement);
gBS->SignalEvent (mValueChangedEvent);
}
/**
Refresh the questions within this form.
@param Event The event which has this function related.
@param Context The input context info related to this event or the status code return to the caller.
**/
VOID
EFIAPI
RefreshEventNotifyForForm (
IN EFI_EVENT Event,
IN VOID *Context
)
{
gCurrentSelection->Action = UI_ACTION_REFRESH_FORMSET;
gBS->SignalEvent (mValueChangedEvent);
}
/**
Create refresh hook event for statement which has refresh event or interval.
@param Statement The statement need to check.
**/
VOID
CreateRefreshEventForStatement (
IN FORM_BROWSER_STATEMENT *Statement
)
{
EFI_STATUS Status;
EFI_EVENT RefreshEvent;
FORM_BROWSER_REFRESH_EVENT_NODE *EventNode;
//
// If question has refresh guid, create the notify function.
//
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
RefreshEventNotifyForStatement,
Statement,
&Statement->RefreshGuid,
&RefreshEvent
);
ASSERT_EFI_ERROR (Status);
EventNode = AllocateZeroPool (sizeof (FORM_BROWSER_REFRESH_EVENT_NODE));
ASSERT (EventNode != NULL);
EventNode->RefreshEvent = RefreshEvent;
InsertTailList (&mRefreshEventList, &EventNode->Link);
}
/**
Create refresh hook event for form which has refresh event or interval.
@param Form The form need to check.
**/
VOID
CreateRefreshEventForForm (
IN FORM_BROWSER_FORM *Form
)
{
EFI_STATUS Status;
EFI_EVENT RefreshEvent;
FORM_BROWSER_REFRESH_EVENT_NODE *EventNode;
//
// If question has refresh guid, create the notify function.
//
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
RefreshEventNotifyForForm,
Form,
&Form->RefreshGuid,
&RefreshEvent
);
ASSERT_EFI_ERROR (Status);
EventNode = AllocateZeroPool (sizeof (FORM_BROWSER_REFRESH_EVENT_NODE));
ASSERT (EventNode != NULL);
EventNode->RefreshEvent = RefreshEvent;
InsertTailList (&mRefreshEventList, &EventNode->Link);
}
/**
Initialize the Display statement structure data.
@param DisplayStatement Pointer to the display Statement data strucure.
@param Statement The statement need to check.
**/
VOID
InitializeDisplayStatement (
IN OUT FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement,
IN FORM_BROWSER_STATEMENT *Statement
)
{
LIST_ENTRY *Link;
QUESTION_OPTION *Option;
DISPLAY_QUESTION_OPTION *DisplayOption;
FORM_DISPLAY_ENGINE_STATEMENT *ParentStatement;
DisplayStatement->Signature = FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE;
DisplayStatement->Version = FORM_DISPLAY_ENGINE_STATEMENT_VERSION_1;
DisplayStatement->OpCode = Statement->OpCode;
InitializeListHead (&DisplayStatement->NestStatementList);
InitializeListHead (&DisplayStatement->OptionListHead);
if ((EvaluateExpressionList (Statement->Expression, FALSE, NULL, NULL) == ExpressGrayOut) || Statement->Locked) {
DisplayStatement->Attribute |= HII_DISPLAY_GRAYOUT;
}
if ((Statement->ValueExpression != NULL) || ((Statement->QuestionFlags & EFI_IFR_FLAG_READ_ONLY) != 0)) {
DisplayStatement->Attribute |= HII_DISPLAY_READONLY;
}
//
// Initilize the option list in statement.
//
Link = GetFirstNode (&Statement->OptionListHead);
while (!IsNull (&Statement->OptionListHead, Link)) {
Option = QUESTION_OPTION_FROM_LINK (Link);
Link = GetNextNode (&Statement->OptionListHead, Link);
if ((Option->SuppressExpression != NULL) &&
((EvaluateExpressionList (Option->SuppressExpression, FALSE, NULL, NULL) == ExpressSuppress)))
{
continue;
}
DisplayOption = AllocateZeroPool (sizeof (DISPLAY_QUESTION_OPTION));
ASSERT (DisplayOption != NULL);
DisplayOption->ImageId = Option->ImageId;
DisplayOption->Signature = DISPLAY_QUESTION_OPTION_SIGNATURE;
DisplayOption->OptionOpCode = Option->OpCode;
InsertTailList (&DisplayStatement->OptionListHead, &DisplayOption->Link);
}
CopyMem (&DisplayStatement->CurrentValue, &Statement->HiiValue, sizeof (EFI_HII_VALUE));
//
// Some special op code need an extra buffer to save the data.
// Such as string, password, orderedlist...
//
if (Statement->BufferValue != NULL) {
//
// Ordered list opcode may not initilized, get default value here.
//
if ((Statement->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) && (GetArrayData (Statement->BufferValue, Statement->ValueType, 0) == 0)) {
GetQuestionDefault (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, 0);
}
DisplayStatement->CurrentValue.Buffer = AllocateCopyPool (Statement->StorageWidth, Statement->BufferValue);
DisplayStatement->CurrentValue.BufferLen = Statement->StorageWidth;
}
DisplayStatement->SettingChangedFlag = Statement->ValueChanged;
//
// Get the highlight statement for current form.
//
if (((gCurrentSelection->QuestionId != 0) && (Statement->QuestionId == gCurrentSelection->QuestionId)) ||
((mCurFakeQestId != 0) && (Statement->FakeQuestionId == mCurFakeQestId)))
{
gDisplayFormData.HighLightedStatement = DisplayStatement;
}
//
// Create the refresh event process function.
//
if (!IsZeroGuid (&Statement->RefreshGuid)) {
CreateRefreshEventForStatement (Statement);
}
//
// For RTC type of date/time, set default refresh interval to be 1 second.
//
if (((Statement->Operand == EFI_IFR_DATE_OP) || (Statement->Operand == EFI_IFR_TIME_OP)) && (Statement->Storage == NULL)) {
Statement->RefreshInterval = 1;
}
//
// Create the refresh guid hook event.
// If the statement in this form has refresh event or refresh interval, browser will create this event for display engine.
//
if ((!IsZeroGuid (&Statement->RefreshGuid)) || (Statement->RefreshInterval != 0)) {
gDisplayFormData.FormRefreshEvent = mValueChangedEvent;
}
//
// Save the password check function for later use.
//
if (Statement->Operand == EFI_IFR_PASSWORD_OP) {
DisplayStatement->PasswordCheck = PasswordCheck;
}
//
// If this statement is nest in the subtitle, insert to the host statement.
// else insert to the form it belongs to.
//
if (Statement->ParentStatement != NULL) {
ParentStatement = GetDisplayStatement (Statement->ParentStatement->OpCode);
ASSERT (ParentStatement != NULL);
InsertTailList (&ParentStatement->NestStatementList, &DisplayStatement->DisplayLink);
} else {
InsertTailList (&gDisplayFormData.StatementListHead, &DisplayStatement->DisplayLink);
}
}
/**
Process for the refresh interval statement.
@param Event The Event need to be process
@param Context The context of the event.
**/
VOID
EFIAPI
RefreshIntervalProcess (
IN EFI_EVENT Event,
IN VOID *Context
)
{
FORM_BROWSER_STATEMENT *Statement;
LIST_ENTRY *Link;
Link = GetFirstNode (&gCurrentSelection->Form->StatementListHead);
while (!IsNull (&gCurrentSelection->Form->StatementListHead, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&gCurrentSelection->Form->StatementListHead, Link);
if (Statement->RefreshInterval == 0) {
continue;
}
UpdateStatement (Statement);
}
gBS->SignalEvent (mValueChangedEvent);
}
/**
Make a copy of the global hotkey info.
**/
VOID
UpdateHotkeyList (
VOID
)
{
BROWSER_HOT_KEY *HotKey;
BROWSER_HOT_KEY *CopyKey;
LIST_ENTRY *Link;
Link = GetFirstNode (&gBrowserHotKeyList);
while (!IsNull (&gBrowserHotKeyList, Link)) {
HotKey = BROWSER_HOT_KEY_FROM_LINK (Link);
CopyKey = AllocateCopyPool (sizeof (BROWSER_HOT_KEY), HotKey);
ASSERT (CopyKey != NULL);
CopyKey->KeyData = AllocateCopyPool (sizeof (EFI_INPUT_KEY), HotKey->KeyData);
ASSERT (CopyKey->KeyData != NULL);
CopyKey->HelpString = AllocateCopyPool (StrSize (HotKey->HelpString), HotKey->HelpString);
ASSERT (CopyKey->HelpString != NULL);
InsertTailList (&gDisplayFormData.HotKeyListHead, &CopyKey->Link);
Link = GetNextNode (&gBrowserHotKeyList, Link);
}
}
/**
Get the extra question attribute from override question list.
@param QuestionId The question id for this request question.
@retval The attribute for this question or NULL if not found this
question in the list.
**/
UINT32
ProcessQuestionExtraAttr (
IN EFI_QUESTION_ID QuestionId
)
{
LIST_ENTRY *Link;
QUESTION_ATTRIBUTE_OVERRIDE *QuestionDesc;
//
// Return HII_DISPLAY_NONE if input a invalid question id.
//
if (QuestionId == 0) {
return HII_DISPLAY_NONE;
}
Link = GetFirstNode (&mPrivateData.FormBrowserEx2.OverrideQestListHead);
while (!IsNull (&mPrivateData.FormBrowserEx2.OverrideQestListHead, Link)) {
QuestionDesc = FORM_QUESTION_ATTRIBUTE_OVERRIDE_FROM_LINK (Link);
Link = GetNextNode (&mPrivateData.FormBrowserEx2.OverrideQestListHead, Link);
if ((QuestionDesc->QuestionId == QuestionId) &&
(QuestionDesc->FormId == gCurrentSelection->FormId) &&
(QuestionDesc->HiiHandle == gCurrentSelection->Handle) &&
CompareGuid (&QuestionDesc->FormSetGuid, &gCurrentSelection->FormSetGuid))
{
return QuestionDesc->Attribute;
}
}
return HII_DISPLAY_NONE;
}
/**
Enum all statement in current form, find all the statement can be display and
add to the display form.
**/
VOID
AddStatementToDisplayForm (
VOID
)
{
EFI_STATUS Status;
LIST_ENTRY *Link;
FORM_BROWSER_STATEMENT *Statement;
FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement;
UINT8 MinRefreshInterval;
EFI_EVENT RefreshIntervalEvent;
FORM_BROWSER_REFRESH_EVENT_NODE *EventNode;
BOOLEAN FormEditable;
UINT32 ExtraAttribute;
MinRefreshInterval = 0;
FormEditable = FALSE;
//
// Process the statement outside the form, these statements are not recognized
// by browser core.
//
Link = GetFirstNode (&gCurrentSelection->FormSet->StatementListOSF);
while (!IsNull (&gCurrentSelection->FormSet->StatementListOSF, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&gCurrentSelection->FormSet->StatementListOSF, Link);
DisplayStatement = AllocateZeroPool (sizeof (FORM_DISPLAY_ENGINE_STATEMENT));
ASSERT (DisplayStatement != NULL);
DisplayStatement->Signature = FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE;
DisplayStatement->Version = FORM_DISPLAY_ENGINE_STATEMENT_VERSION_1;
DisplayStatement->OpCode = Statement->OpCode;
InitializeListHead (&DisplayStatement->NestStatementList);
InitializeListHead (&DisplayStatement->OptionListHead);
InsertTailList (&gDisplayFormData.StatementListOSF, &DisplayStatement->DisplayLink);
}
//
// treat formset as statement outside the form,get its opcode.
//
DisplayStatement = AllocateZeroPool (sizeof (FORM_DISPLAY_ENGINE_STATEMENT));
ASSERT (DisplayStatement != NULL);
DisplayStatement->Signature = FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE;
DisplayStatement->Version = FORM_DISPLAY_ENGINE_STATEMENT_VERSION_1;
DisplayStatement->OpCode = gCurrentSelection->FormSet->OpCode;
InitializeListHead (&DisplayStatement->NestStatementList);
InitializeListHead (&DisplayStatement->OptionListHead);
InsertTailList (&gDisplayFormData.StatementListOSF, &DisplayStatement->DisplayLink);
//
// Process the statement in this form.
//
Link = GetFirstNode (&gCurrentSelection->Form->StatementListHead);
while (!IsNull (&gCurrentSelection->Form->StatementListHead, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&gCurrentSelection->Form->StatementListHead, Link);
//
// This statement can't be show, skip it.
//
if (EvaluateExpressionList (Statement->Expression, FALSE, NULL, NULL) > ExpressGrayOut) {
continue;
}
//
// Check the extra attribute.
//
ExtraAttribute = ProcessQuestionExtraAttr (Statement->QuestionId);
if ((ExtraAttribute & HII_DISPLAY_SUPPRESS) != 0) {
continue;
}
DisplayStatement = AllocateZeroPool (sizeof (FORM_DISPLAY_ENGINE_STATEMENT));
ASSERT (DisplayStatement != NULL);
//
// Initialize this statement and add it to the display form.
//
InitializeDisplayStatement (DisplayStatement, Statement);
//
// Set the extra attribute.
//
DisplayStatement->Attribute |= ExtraAttribute;
if (Statement->Storage != NULL) {
FormEditable = TRUE;
}
//
// Get the minimal refresh interval value for later use.
//
if ((Statement->RefreshInterval != 0) &&
((MinRefreshInterval == 0) || (Statement->RefreshInterval < MinRefreshInterval)))
{
MinRefreshInterval = Statement->RefreshInterval;
}
}
//
// Create the periodic timer for refresh interval statement.
//
if (MinRefreshInterval != 0) {
Status = gBS->CreateEvent (EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, RefreshIntervalProcess, NULL, &RefreshIntervalEvent);
ASSERT_EFI_ERROR (Status);
Status = gBS->SetTimer (RefreshIntervalEvent, TimerPeriodic, MinRefreshInterval * ONE_SECOND);
ASSERT_EFI_ERROR (Status);
EventNode = AllocateZeroPool (sizeof (FORM_BROWSER_REFRESH_EVENT_NODE));
ASSERT (EventNode != NULL);
EventNode->RefreshEvent = RefreshIntervalEvent;
InsertTailList (&mRefreshEventList, &EventNode->Link);
}
//
// Create the refresh event process function for Form.
//
if (!IsZeroGuid (&gCurrentSelection->Form->RefreshGuid)) {
CreateRefreshEventForForm (gCurrentSelection->Form);
if (gDisplayFormData.FormRefreshEvent == NULL) {
gDisplayFormData.FormRefreshEvent = mValueChangedEvent;
}
}
//
// Update hotkey list field.
//
if ((gBrowserSettingScope == SystemLevel) || FormEditable) {
UpdateHotkeyList ();
}
}
/**
Initialize the SettingChangedFlag variable in the display form.
**/
VOID
UpdateDataChangedFlag (
VOID
)
{
LIST_ENTRY *Link;
FORM_BROWSER_FORMSET *LocalFormSet;
gDisplayFormData.SettingChangedFlag = FALSE;
if (IsNvUpdateRequiredForForm (gCurrentSelection->Form)) {
gDisplayFormData.SettingChangedFlag = TRUE;
return;
}
//
// Base on the system level to check whether need to show the NV flag.
//
switch (gBrowserSettingScope) {
case SystemLevel:
//
// Check the maintain list to see whether there is any change.
//
Link = GetFirstNode (&gBrowserFormSetList);
while (!IsNull (&gBrowserFormSetList, Link)) {
LocalFormSet = FORM_BROWSER_FORMSET_FROM_LINK (Link);
if (IsNvUpdateRequiredForFormSet (LocalFormSet)) {
gDisplayFormData.SettingChangedFlag = TRUE;
return;
}
Link = GetNextNode (&gBrowserFormSetList, Link);
}
break;
case FormSetLevel:
if (IsNvUpdateRequiredForFormSet (gCurrentSelection->FormSet)) {
gDisplayFormData.SettingChangedFlag = TRUE;
return;
}
break;
default:
break;
}
}
/**
Initialize the Display form structure data.
**/
VOID
InitializeDisplayFormData (
VOID
)
{
EFI_STATUS Status;
gDisplayFormData.Signature = FORM_DISPLAY_ENGINE_FORM_SIGNATURE;
gDisplayFormData.Version = FORM_DISPLAY_ENGINE_VERSION_1;
gDisplayFormData.ImageId = 0;
gDisplayFormData.AnimationId = 0;
InitializeListHead (&gDisplayFormData.StatementListHead);
InitializeListHead (&gDisplayFormData.StatementListOSF);
InitializeListHead (&gDisplayFormData.HotKeyListHead);
Status = gBS->CreateEvent (
EVT_NOTIFY_WAIT,
TPL_CALLBACK,
EfiEventEmptyFunction,
NULL,
&mValueChangedEvent
);
ASSERT_EFI_ERROR (Status);
}
/**
Free the kotkey info saved in form data.
**/
VOID
FreeHotkeyList (
VOID
)
{
BROWSER_HOT_KEY *HotKey;
LIST_ENTRY *Link;
while (!IsListEmpty (&gDisplayFormData.HotKeyListHead)) {
Link = GetFirstNode (&gDisplayFormData.HotKeyListHead);
HotKey = BROWSER_HOT_KEY_FROM_LINK (Link);
RemoveEntryList (&HotKey->Link);
FreePool (HotKey->KeyData);
FreePool (HotKey->HelpString);
FreePool (HotKey);
}
}
/**
Update the Display form structure data.
**/
VOID
UpdateDisplayFormData (
VOID
)
{
gDisplayFormData.FormTitle = gCurrentSelection->Form->FormTitle;
gDisplayFormData.FormId = gCurrentSelection->FormId;
gDisplayFormData.HiiHandle = gCurrentSelection->Handle;
CopyGuid (&gDisplayFormData.FormSetGuid, &gCurrentSelection->FormSetGuid);
gDisplayFormData.Attribute = 0;
gDisplayFormData.Attribute |= gCurrentSelection->Form->ModalForm ? HII_DISPLAY_MODAL : 0;
gDisplayFormData.Attribute |= gCurrentSelection->Form->Locked ? HII_DISPLAY_LOCK : 0;
gDisplayFormData.FormRefreshEvent = NULL;
gDisplayFormData.HighLightedStatement = NULL;
UpdateDataChangedFlag ();
AddStatementToDisplayForm ();
}
/**
Free the Display Statement structure data.
@param StatementList Point to the statement list which need to be free.
**/
VOID
FreeStatementData (
LIST_ENTRY *StatementList
)
{
LIST_ENTRY *Link;
LIST_ENTRY *OptionLink;
FORM_DISPLAY_ENGINE_STATEMENT *Statement;
DISPLAY_QUESTION_OPTION *Option;
//
// Free Statements/Questions
//
while (!IsListEmpty (StatementList)) {
Link = GetFirstNode (StatementList);
Statement = FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (Link);
//
// Free Options List
//
while (!IsListEmpty (&Statement->OptionListHead)) {
OptionLink = GetFirstNode (&Statement->OptionListHead);
Option = DISPLAY_QUESTION_OPTION_FROM_LINK (OptionLink);
RemoveEntryList (&Option->Link);
FreePool (Option);
}
//
// Free nest statement List
//
if (!IsListEmpty (&Statement->NestStatementList)) {
FreeStatementData (&Statement->NestStatementList);
}
RemoveEntryList (&Statement->DisplayLink);
FreePool (Statement);
}
}
/**
Free the Display form structure data.
**/
VOID
FreeDisplayFormData (
VOID
)
{
FreeStatementData (&gDisplayFormData.StatementListHead);
FreeStatementData (&gDisplayFormData.StatementListOSF);
FreeRefreshEvent ();
FreeHotkeyList ();
}
/**
Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.
@param DisplayStatement The input FORM_DISPLAY_ENGINE_STATEMENT.
@retval FORM_BROWSER_STATEMENT The return FORM_BROWSER_STATEMENT info.
**/
FORM_BROWSER_STATEMENT *
GetBrowserStatement (
IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement
)
{
FORM_BROWSER_STATEMENT *Statement;
LIST_ENTRY *Link;
Link = GetFirstNode (&gCurrentSelection->Form->StatementListHead);
while (!IsNull (&gCurrentSelection->Form->StatementListHead, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
if (Statement->OpCode == DisplayStatement->OpCode) {
return Statement;
}
Link = GetNextNode (&gCurrentSelection->Form->StatementListHead, Link);
}
return NULL;
}
/**
Update the ValueChanged status for questions in this form.
@param FormSet FormSet data structure.
@param Form Form data structure.
**/
VOID
UpdateStatementStatusForForm (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form
)
{
LIST_ENTRY *Link;
FORM_BROWSER_STATEMENT *Question;
Link = GetFirstNode (&Form->StatementListHead);
while (!IsNull (&Form->StatementListHead, Link)) {
Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&Form->StatementListHead, Link);
//
// For password opcode, not set the the value changed flag.
//
if (Question->Operand == EFI_IFR_PASSWORD_OP) {
continue;
}
IsQuestionValueChanged (FormSet, Form, Question, GetSetValueWithBuffer);
}
}
/**
Update the ValueChanged status for questions in this formset.
@param FormSet FormSet data structure.
**/
VOID
UpdateStatementStatusForFormSet (
IN FORM_BROWSER_FORMSET *FormSet
)
{
LIST_ENTRY *Link;
FORM_BROWSER_FORM *Form;
Link = GetFirstNode (&FormSet->FormListHead);
while (!IsNull (&FormSet->FormListHead, Link)) {
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
Link = GetNextNode (&FormSet->FormListHead, Link);
UpdateStatementStatusForForm (FormSet, Form);
}
}
/**
Update the ValueChanged status for questions.
@param FormSet FormSet data structure.
@param Form Form data structure.
@param SettingScope Setting Scope for Default action.
**/
VOID
UpdateStatementStatus (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN BROWSER_SETTING_SCOPE SettingScope
)
{
LIST_ENTRY *Link;
FORM_BROWSER_FORMSET *LocalFormSet;
switch (SettingScope) {
case SystemLevel:
Link = GetFirstNode (&gBrowserFormSetList);
while (!IsNull (&gBrowserFormSetList, Link)) {
LocalFormSet = FORM_BROWSER_FORMSET_FROM_LINK (Link);
Link = GetNextNode (&gBrowserFormSetList, Link);
if (!ValidateFormSet (LocalFormSet)) {
continue;
}
UpdateStatementStatusForFormSet (LocalFormSet);
}
break;
case FormSetLevel:
UpdateStatementStatusForFormSet (FormSet);
break;
case FormLevel:
UpdateStatementStatusForForm (FormSet, Form);
break;
default:
break;
}
}
/**
Process the action request in user input.
@param Action The user input action request info.
@param DefaultId The user input default Id info.
@retval EFI_SUCCESS This function always return successfully for now.
**/
EFI_STATUS
ProcessAction (
IN UINT32 Action,
IN UINT16 DefaultId
)
{
//
// This is caused by use press ESC, and it should not combine with other action type.
//
if ((Action & BROWSER_ACTION_FORM_EXIT) == BROWSER_ACTION_FORM_EXIT) {
FindNextMenu (gCurrentSelection, FormLevel);
return EFI_SUCCESS;
}
//
// Below is normal hotkey trigged action, these action maybe combine with each other.
//
if ((Action & BROWSER_ACTION_DISCARD) == BROWSER_ACTION_DISCARD) {
DiscardForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
}
if ((Action & BROWSER_ACTION_DEFAULT) == BROWSER_ACTION_DEFAULT) {
ExtractDefault (gCurrentSelection->FormSet, gCurrentSelection->Form, DefaultId, gBrowserSettingScope, GetDefaultForAll, NULL, FALSE, FALSE);
UpdateStatementStatus (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
}
if ((Action & BROWSER_ACTION_SUBMIT) == BROWSER_ACTION_SUBMIT) {
SubmitForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
}
if ((Action & BROWSER_ACTION_RESET) == BROWSER_ACTION_RESET) {
gResetRequiredFormLevel = TRUE;
gResetRequiredSystemLevel = TRUE;
}
if ((Action & BROWSER_ACTION_EXIT) == BROWSER_ACTION_EXIT) {
//
// Form Exit without saving, Similar to ESC Key.
// FormSet Exit without saving, Exit SendForm.
// System Exit without saving, CallExitHandler and Exit SendForm.
//
DiscardForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
if ((gBrowserSettingScope == FormLevel) || (gBrowserSettingScope == FormSetLevel)) {
FindNextMenu (gCurrentSelection, gBrowserSettingScope);
} else if (gBrowserSettingScope == SystemLevel) {
if (ExitHandlerFunction != NULL) {
ExitHandlerFunction ();
}
gCurrentSelection->Action = UI_ACTION_EXIT;
}
}
return EFI_SUCCESS;
}
/**
Check whether the formset guid is in this Hii package list.
@param HiiHandle The HiiHandle for this HII package list.
@param FormSetGuid The formset guid for the request formset.
@retval TRUE Find the formset guid.
@retval FALSE Not found the formset guid.
**/
BOOLEAN
GetFormsetGuidFromHiiHandle (
IN EFI_HII_HANDLE HiiHandle,
IN EFI_GUID *FormSetGuid
)
{
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
UINTN BufferSize;
UINT32 Offset;
UINT32 Offset2;
UINT32 PackageListLength;
EFI_HII_PACKAGE_HEADER PackageHeader;
UINT8 *Package;
UINT8 *OpCodeData;
EFI_STATUS Status;
BOOLEAN FindGuid;
BufferSize = 0;
HiiPackageList = NULL;
FindGuid = FALSE;
Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, HiiHandle, &BufferSize, HiiPackageList);
if (Status == EFI_BUFFER_TOO_SMALL) {
HiiPackageList = AllocatePool (BufferSize);
ASSERT (HiiPackageList != NULL);
Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, HiiHandle, &BufferSize, HiiPackageList);
}
if (EFI_ERROR (Status) || (HiiPackageList == NULL)) {
return FALSE;
}
//
// Get Form package from this HII package List
//
Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
Offset2 = 0;
CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
while (Offset < PackageListLength) {
Package = ((UINT8 *)HiiPackageList) + Offset;
CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
Offset += PackageHeader.Length;
if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {
//
// Search FormSet in this Form Package
//
Offset2 = sizeof (EFI_HII_PACKAGE_HEADER);
while (Offset2 < PackageHeader.Length) {
OpCodeData = Package + Offset2;
if (((EFI_IFR_OP_HEADER *)OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {
if (CompareGuid (FormSetGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
FindGuid = TRUE;
break;
}
}
Offset2 += ((EFI_IFR_OP_HEADER *)OpCodeData)->Length;
}
}
if (FindGuid) {
break;
}
}
FreePool (HiiPackageList);
return FindGuid;
}
/**
Find HII Handle in the HII database associated with given Device Path.
If DevicePath is NULL, then ASSERT.
@param DevicePath Device Path associated with the HII package list
handle.
@param FormsetGuid The formset guid for this formset.
@retval Handle HII package list Handle associated with the Device
Path.
@retval NULL Hii Package list handle is not found.
**/
EFI_HII_HANDLE
DevicePathToHiiHandle (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN EFI_GUID *FormsetGuid
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
UINTN Index;
EFI_HANDLE Handle;
EFI_HANDLE DriverHandle;
EFI_HII_HANDLE *HiiHandles;
EFI_HII_HANDLE HiiHandle;
ASSERT (DevicePath != NULL);
TmpDevicePath = DevicePath;
//
// Locate Device Path Protocol handle buffer
//
Status = gBS->LocateDevicePath (
&gEfiDevicePathProtocolGuid,
&TmpDevicePath,
&DriverHandle
);
if (EFI_ERROR (Status) || !IsDevicePathEnd (TmpDevicePath)) {
return NULL;
}
//
// Retrieve all HII Handles from HII database
//
HiiHandles = HiiGetHiiHandles (NULL);
if (HiiHandles == NULL) {
return NULL;
}
//
// Search Hii Handle by Driver Handle
//
HiiHandle = NULL;
for (Index = 0; HiiHandles[Index] != NULL; Index++) {
Status = mHiiDatabase->GetPackageListHandle (
mHiiDatabase,
HiiHandles[Index],
&Handle
);
if (!EFI_ERROR (Status) && (Handle == DriverHandle)) {
if (GetFormsetGuidFromHiiHandle (HiiHandles[Index], FormsetGuid)) {
HiiHandle = HiiHandles[Index];
break;
}
if (HiiHandle != NULL) {
break;
}
}
}
FreePool (HiiHandles);
return HiiHandle;
}
/**
Find HII Handle in the HII database associated with given form set guid.
If FormSetGuid is NULL, then ASSERT.
@param ComparingGuid FormSet Guid associated with the HII package list
handle.
@retval Handle HII package list Handle associated with the Device
Path.
@retval NULL Hii Package list handle is not found.
**/
EFI_HII_HANDLE
FormSetGuidToHiiHandle (
EFI_GUID *ComparingGuid
)
{
EFI_HII_HANDLE *HiiHandles;
EFI_HII_HANDLE HiiHandle;
UINTN Index;
ASSERT (ComparingGuid != NULL);
HiiHandle = NULL;
//
// Get all the Hii handles
//
HiiHandles = HiiGetHiiHandles (NULL);
ASSERT (HiiHandles != NULL);
//
// Search for formset of each class type
//
for (Index = 0; HiiHandles[Index] != NULL; Index++) {
if (GetFormsetGuidFromHiiHandle (HiiHandles[Index], ComparingGuid)) {
HiiHandle = HiiHandles[Index];
break;
}
if (HiiHandle != NULL) {
break;
}
}
FreePool (HiiHandles);
return HiiHandle;
}
/**
check how to process the changed data in current form or form set.
@param Selection On input, Selection tell setup browser the information
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
@param Scope Data save or discard scope, form or formset.
@retval TRUE Success process the changed data, will return to the parent form.
@retval FALSE Reject to process the changed data, will stay at current form.
**/
BOOLEAN
ProcessChangedData (
IN OUT UI_MENU_SELECTION *Selection,
IN BROWSER_SETTING_SCOPE Scope
)
{
BOOLEAN RetValue;
EFI_STATUS Status;
RetValue = TRUE;
switch (mFormDisplay->ConfirmDataChange ()) {
case BROWSER_ACTION_DISCARD:
DiscardForm (Selection->FormSet, Selection->Form, Scope);
break;
case BROWSER_ACTION_SUBMIT:
Status = SubmitForm (Selection->FormSet, Selection->Form, Scope);
if (EFI_ERROR (Status)) {
RetValue = FALSE;
}
break;
case BROWSER_ACTION_NONE:
RetValue = FALSE;
break;
default:
//
// if Invalid value return, process same as BROWSER_ACTION_NONE.
//
RetValue = FALSE;
break;
}
return RetValue;
}
/**
Find parent formset menu(the first menu which has different formset) for current menu.
If not find, just return to the first menu.
@param Selection The selection info.
**/
VOID
FindParentFormSet (
IN OUT UI_MENU_SELECTION *Selection
)
{
FORM_ENTRY_INFO *CurrentMenu;
FORM_ENTRY_INFO *ParentMenu;
CurrentMenu = Selection->CurrentMenu;
ParentMenu = UiFindParentMenu (CurrentMenu, FormSetLevel);
if (ParentMenu != NULL) {
CopyMem (&Selection->FormSetGuid, &ParentMenu->FormSetGuid, sizeof (EFI_GUID));
Selection->Handle = ParentMenu->HiiHandle;
Selection->FormId = ParentMenu->FormId;
Selection->QuestionId = ParentMenu->QuestionId;
} else {
Selection->FormId = CurrentMenu->FormId;
Selection->QuestionId = CurrentMenu->QuestionId;
}
Selection->Statement = NULL;
}
/**
Process the goto op code, update the info in the selection structure.
@param Statement The statement belong to goto op code.
@param Selection The selection info.
@retval EFI_SUCCESS The menu process successfully.
@return Other value if the process failed.
**/
EFI_STATUS
ProcessGotoOpCode (
IN OUT FORM_BROWSER_STATEMENT *Statement,
IN OUT UI_MENU_SELECTION *Selection
)
{
CHAR16 *StringPtr;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
FORM_BROWSER_FORM *RefForm;
EFI_STATUS Status;
EFI_HII_HANDLE HiiHandle;
Status = EFI_SUCCESS;
StringPtr = NULL;
HiiHandle = NULL;
//
// Prepare the device path check, get the device path info first.
//
if (Statement->HiiValue.Value.ref.DevicePath != 0) {
StringPtr = GetToken (Statement->HiiValue.Value.ref.DevicePath, Selection->FormSet->HiiHandle);
}
//
// Check whether the device path string is a valid string.
//
if ((Statement->HiiValue.Value.ref.DevicePath != 0) && (StringPtr != NULL) && (StringPtr[0] != L'\0')) {
if (Selection->Form->ModalForm) {
return Status;
}
//
// Goto another Hii Package list
//
if (mPathFromText != NULL) {
DevicePath = mPathFromText->ConvertTextToDevicePath (StringPtr);
if (DevicePath != NULL) {
HiiHandle = DevicePathToHiiHandle (DevicePath, &Statement->HiiValue.Value.ref.FormSetGuid);
FreePool (DevicePath);
}
FreePool (StringPtr);
} else {
//
// Not found the EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL protocol.
//
PopupErrorMessage (BROWSER_PROTOCOL_NOT_FOUND, NULL, NULL, NULL);
FreePool (StringPtr);
return Status;
}
if (HiiHandle != Selection->Handle) {
//
// Goto another Formset, check for uncommitted data
//
if (((gBrowserSettingScope == FormLevel) || (gBrowserSettingScope == FormSetLevel)) &&
IsNvUpdateRequiredForFormSet (Selection->FormSet))
{
if (!ProcessChangedData (Selection, FormSetLevel)) {
return EFI_SUCCESS;
}
}
}
Selection->Action = UI_ACTION_REFRESH_FORMSET;
Selection->Handle = HiiHandle;
if (Selection->Handle == NULL) {
//
// If target Hii Handle not found, exit current formset.
//
FindParentFormSet (Selection);
return EFI_SUCCESS;
}
CopyMem (&Selection->FormSetGuid, &Statement->HiiValue.Value.ref.FormSetGuid, sizeof (EFI_GUID));
Selection->FormId = Statement->HiiValue.Value.ref.FormId;
Selection->QuestionId = Statement->HiiValue.Value.ref.QuestionId;
} else if (!IsZeroGuid (&Statement->HiiValue.Value.ref.FormSetGuid)) {
if (Selection->Form->ModalForm) {
return Status;
}
if (!CompareGuid (&Statement->HiiValue.Value.ref.FormSetGuid, &Selection->FormSetGuid)) {
//
// Goto another Formset, check for uncommitted data
//
if (((gBrowserSettingScope == FormLevel) || (gBrowserSettingScope == FormSetLevel)) &&
IsNvUpdateRequiredForFormSet (Selection->FormSet))
{
if (!ProcessChangedData (Selection, FormSetLevel)) {
return EFI_SUCCESS;
}
}
}
Selection->Action = UI_ACTION_REFRESH_FORMSET;
Selection->Handle = FormSetGuidToHiiHandle (&Statement->HiiValue.Value.ref.FormSetGuid);
if (Selection->Handle == NULL) {
//
// If target Hii Handle not found, exit current formset.
//
FindParentFormSet (Selection);
return EFI_SUCCESS;
}
CopyMem (&Selection->FormSetGuid, &Statement->HiiValue.Value.ref.FormSetGuid, sizeof (EFI_GUID));
Selection->FormId = Statement->HiiValue.Value.ref.FormId;
Selection->QuestionId = Statement->HiiValue.Value.ref.QuestionId;
} else if (Statement->HiiValue.Value.ref.FormId != 0) {
//
// Goto another Form, check for uncommitted data
//
if (Statement->HiiValue.Value.ref.FormId != Selection->FormId) {
if (((gBrowserSettingScope == FormLevel) && IsNvUpdateRequiredForForm (Selection->Form))) {
if (!ProcessChangedData (Selection, FormLevel)) {
return EFI_SUCCESS;
}
}
}
RefForm = IdToForm (Selection->FormSet, Statement->HiiValue.Value.ref.FormId);
if ((RefForm != NULL) && (RefForm->SuppressExpression != NULL)) {
if (EvaluateExpressionList (RefForm->SuppressExpression, TRUE, Selection->FormSet, RefForm) != ExpressFalse) {
//
// Form is suppressed.
//
PopupErrorMessage (BROWSER_FORM_SUPPRESS, NULL, NULL, NULL);
return EFI_SUCCESS;
}
}
Selection->FormId = Statement->HiiValue.Value.ref.FormId;
Selection->QuestionId = Statement->HiiValue.Value.ref.QuestionId;
} else if (Statement->HiiValue.Value.ref.QuestionId != 0) {
Selection->QuestionId = Statement->HiiValue.Value.ref.QuestionId;
}
return Status;
}
/**
Process Question Config.
@param Selection The UI menu selection.
@param Question The Question to be peocessed.
@retval EFI_SUCCESS Question Config process success.
@retval Other Question Config process fail.
**/
EFI_STATUS
ProcessQuestionConfig (
IN UI_MENU_SELECTION *Selection,
IN FORM_BROWSER_STATEMENT *Question
)
{
EFI_STATUS Status;
CHAR16 *ConfigResp;
CHAR16 *Progress;
if (Question->QuestionConfig == 0) {
return EFI_SUCCESS;
}
//
// Get <ConfigResp>
//
ConfigResp = GetToken (Question->QuestionConfig, Selection->FormSet->HiiHandle);
if (ConfigResp == NULL) {
return EFI_NOT_FOUND;
} else if (ConfigResp[0] == L'\0') {
return EFI_SUCCESS;
}
//
// Send config to Configuration Driver
//
Status = mHiiConfigRouting->RouteConfig (
mHiiConfigRouting,
ConfigResp,
&Progress
);
return Status;
}
/**
Process the user input data.
@param UserInput The user input data.
@retval EFI_SUCCESS This function always return successfully for now.
**/
EFI_STATUS
ProcessUserInput (
IN USER_INPUT *UserInput
)
{
EFI_STATUS Status;
FORM_BROWSER_STATEMENT *Statement;
Status = EFI_SUCCESS;
Statement = NULL;
//
// When Exit from FormDisplay function, one of the below two cases must be true.
//
ASSERT (UserInput->Action != 0 || UserInput->SelectedStatement != NULL);
//
// Remove the last highligh question id, this id will update when show next form.
//
gCurrentSelection->QuestionId = 0;
if (UserInput->SelectedStatement != NULL) {
Statement = GetBrowserStatement (UserInput->SelectedStatement);
ASSERT (Statement != NULL);
//
// This question is the current user select one,record it and later
// show it as the highlight question.
//
gCurrentSelection->CurrentMenu->QuestionId = Statement->QuestionId;
//
// For statement like text, actio, it not has question id.
// So use FakeQuestionId to save the question.
//
if (gCurrentSelection->CurrentMenu->QuestionId == 0) {
mCurFakeQestId = Statement->FakeQuestionId;
} else {
mCurFakeQestId = 0;
}
}
//
// First process the Action field in USER_INPUT.
//
if (UserInput->Action != 0) {
Status = ProcessAction (UserInput->Action, UserInput->DefaultId);
gCurrentSelection->Statement = NULL;
} else {
ASSERT (Statement != NULL);
gCurrentSelection->Statement = Statement;
switch (Statement->Operand) {
case EFI_IFR_REF_OP:
Status = ProcessGotoOpCode (Statement, gCurrentSelection);
break;
case EFI_IFR_ACTION_OP:
//
// Process the Config string <ConfigResp>
//
Status = ProcessQuestionConfig (gCurrentSelection, Statement);
break;
case EFI_IFR_RESET_BUTTON_OP:
//
// Reset Question to default value specified by DefaultId
//
Status = ExtractDefault (gCurrentSelection->FormSet, NULL, Statement->DefaultId, FormSetLevel, GetDefaultForAll, NULL, FALSE, FALSE);
UpdateStatementStatus (gCurrentSelection->FormSet, NULL, FormSetLevel);
break;
default:
switch (Statement->Operand) {
case EFI_IFR_STRING_OP:
DeleteString (Statement->HiiValue.Value.string, gCurrentSelection->FormSet->HiiHandle);
Statement->HiiValue.Value.string = UserInput->InputValue.Value.string;
CopyMem (Statement->BufferValue, UserInput->InputValue.Buffer, (UINTN)UserInput->InputValue.BufferLen);
FreePool (UserInput->InputValue.Buffer);
break;
case EFI_IFR_PASSWORD_OP:
if (UserInput->InputValue.Buffer == NULL) {
//
// User not input new password, just return.
//
break;
}
DeleteString (Statement->HiiValue.Value.string, gCurrentSelection->FormSet->HiiHandle);
Statement->HiiValue.Value.string = UserInput->InputValue.Value.string;
CopyMem (Statement->BufferValue, UserInput->InputValue.Buffer, (UINTN)UserInput->InputValue.BufferLen);
ZeroMem (UserInput->InputValue.Buffer, (UINTN)UserInput->InputValue.BufferLen);
FreePool (UserInput->InputValue.Buffer);
//
// Two password match, send it to Configuration Driver
//
if ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {
PasswordCheck (NULL, UserInput->SelectedStatement, (CHAR16 *)Statement->BufferValue);
//
// Clean the value after saved it.
//
ZeroMem (Statement->BufferValue, (UINTN)UserInput->InputValue.BufferLen);
HiiSetString (gCurrentSelection->FormSet->HiiHandle, Statement->HiiValue.Value.string, (CHAR16 *)Statement->BufferValue, NULL);
} else {
SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithHiiDriver);
}
break;
case EFI_IFR_ORDERED_LIST_OP:
CopyMem (Statement->BufferValue, UserInput->InputValue.Buffer, UserInput->InputValue.BufferLen);
break;
default:
CopyMem (&Statement->HiiValue, &UserInput->InputValue, sizeof (EFI_HII_VALUE));
break;
}
break;
}
}
return Status;
}
/**
Display form and wait for user to select one menu option, then return it.
@retval EFI_SUCCESS This function always return successfully for now.
**/
EFI_STATUS
DisplayForm (
VOID
)
{
EFI_STATUS Status;
USER_INPUT UserInput;
FORM_ENTRY_INFO *CurrentMenu;
ZeroMem (&UserInput, sizeof (USER_INPUT));
//
// Update the menu history data.
//
CurrentMenu = UiFindMenuList (gCurrentSelection->Handle, &gCurrentSelection->FormSetGuid, gCurrentSelection->FormId);
if (CurrentMenu == NULL) {
//
// Current menu not found, add it to the menu tree
//
CurrentMenu = UiAddMenuList (
gCurrentSelection->Handle,
&gCurrentSelection->FormSetGuid,
gCurrentSelection->FormId,
gCurrentSelection->QuestionId
);
ASSERT (CurrentMenu != NULL);
}
//
// Back up the form view history data for this form.
//
UiCopyMenuList (&gCurrentSelection->Form->FormViewListHead, &mPrivateData.FormBrowserEx2.FormViewHistoryHead);
gCurrentSelection->CurrentMenu = CurrentMenu;
if (gCurrentSelection->QuestionId == 0) {
//
// Highlight not specified, fetch it from cached menu
//
gCurrentSelection->QuestionId = CurrentMenu->QuestionId;
}
Status = EvaluateFormExpressions (gCurrentSelection->FormSet, gCurrentSelection->Form);
if (EFI_ERROR (Status)) {
return Status;
}
UpdateDisplayFormData ();
ASSERT (gDisplayFormData.BrowserStatus == BROWSER_SUCCESS);
Status = mFormDisplay->FormDisplay (&gDisplayFormData, &UserInput);
if (EFI_ERROR (Status)) {
FreeDisplayFormData ();
return Status;
}
CheckConfigAccess (gCurrentSelection->FormSet);
Status = ProcessUserInput (&UserInput);
FreeDisplayFormData ();
return Status;
}
/**
Functions which are registered to receive notification of
database events have this prototype. The actual event is encoded
in NotifyType. The following table describes how PackageType,
PackageGuid, Handle, and Package are used for each of the
notification types.
@param PackageType Package type of the notification.
@param PackageGuid If PackageType is
EFI_HII_PACKAGE_TYPE_GUID, then this is
the pointer to the GUID from the Guid
field of EFI_HII_PACKAGE_GUID_HEADER.
Otherwise, it must be NULL.
@param Package Points to the package referred to by the
notification Handle The handle of the package
list which contains the specified package.
@param Handle The HII handle.
@param NotifyType The type of change concerning the
database. See
EFI_HII_DATABASE_NOTIFY_TYPE.
**/
EFI_STATUS
EFIAPI
FormUpdateNotify (
IN UINT8 PackageType,
IN CONST EFI_GUID *PackageGuid,
IN CONST EFI_HII_PACKAGE_HEADER *Package,
IN EFI_HII_HANDLE Handle,
IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
)
{
mHiiPackageListUpdated = TRUE;
return EFI_SUCCESS;
}
/**
Update the NV flag info for this form set.
@param FormSet FormSet data structure.
**/
BOOLEAN
IsNvUpdateRequiredForFormSet (
IN FORM_BROWSER_FORMSET *FormSet
)
{
LIST_ENTRY *Link;
FORM_BROWSER_FORM *Form;
BOOLEAN RetVal;
//
// Not finished question initialization, return FALSE.
//
if (!FormSet->QuestionInited) {
return FALSE;
}
RetVal = FALSE;
Link = GetFirstNode (&FormSet->FormListHead);
while (!IsNull (&FormSet->FormListHead, Link)) {
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
RetVal = IsNvUpdateRequiredForForm (Form);
if (RetVal) {
break;
}
Link = GetNextNode (&FormSet->FormListHead, Link);
}
return RetVal;
}
/**
Update the NvUpdateRequired flag for a form.
@param Form Form data structure.
**/
BOOLEAN
IsNvUpdateRequiredForForm (
IN FORM_BROWSER_FORM *Form
)
{
LIST_ENTRY *Link;
FORM_BROWSER_STATEMENT *Statement;
Link = GetFirstNode (&Form->StatementListHead);
while (!IsNull (&Form->StatementListHead, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
if (Statement->ValueChanged) {
return TRUE;
}
Link = GetNextNode (&Form->StatementListHead, Link);
}
return FALSE;
}
/**
Find menu which will show next time.
@param Selection On input, Selection tell setup browser the information
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
@param SettingLevel Input Settting level, if it is FormLevel, just exit current form.
else, we need to exit current formset.
@retval TRUE Exit current form.
@retval FALSE User press ESC and keep in current form.
**/
BOOLEAN
FindNextMenu (
IN OUT UI_MENU_SELECTION *Selection,
IN BROWSER_SETTING_SCOPE SettingLevel
)
{
FORM_ENTRY_INFO *CurrentMenu;
FORM_ENTRY_INFO *ParentMenu;
BROWSER_SETTING_SCOPE Scope;
CurrentMenu = Selection->CurrentMenu;
Scope = FormSetLevel;
ParentMenu = UiFindParentMenu (CurrentMenu, SettingLevel);
while (ParentMenu != NULL && !ValidateHiiHandle (ParentMenu->HiiHandle)) {
ParentMenu = UiFindParentMenu (ParentMenu, SettingLevel);
}
if (ParentMenu != NULL) {
if (CompareGuid (&CurrentMenu->FormSetGuid, &ParentMenu->FormSetGuid)) {
Scope = FormLevel;
} else {
Scope = FormSetLevel;
}
}
//
// Form Level Check whether the data is changed.
//
if (((gBrowserSettingScope == FormLevel) && IsNvUpdateRequiredForForm (Selection->Form)) ||
((gBrowserSettingScope == FormSetLevel) && IsNvUpdateRequiredForFormSet (Selection->FormSet) && (Scope == FormSetLevel)))
{
if (!ProcessChangedData (Selection, gBrowserSettingScope)) {
return FALSE;
}
}
if (ParentMenu != NULL) {
//
// ParentMenu is found. Then, go to it.
//
if (Scope == FormLevel) {
Selection->Action = UI_ACTION_REFRESH_FORM;
} else {
Selection->Action = UI_ACTION_REFRESH_FORMSET;
CopyMem (&Selection->FormSetGuid, &ParentMenu->FormSetGuid, sizeof (EFI_GUID));
Selection->Handle = ParentMenu->HiiHandle;
}
Selection->Statement = NULL;
Selection->FormId = ParentMenu->FormId;
Selection->QuestionId = ParentMenu->QuestionId;
//
// Clear highlight record for this menu
//
CurrentMenu->QuestionId = 0;
return FALSE;
}
//
// Current in root page, exit the SendForm
//
Selection->Action = UI_ACTION_EXIT;
return TRUE;
}
/**
Reconnect the controller.
@param DriverHandle The controller handle which need to be reconnect.
@retval TRUE do the reconnect behavior success.
@retval FALSE do the reconnect behavior failed.
**/
BOOLEAN
ReconnectController (
IN EFI_HANDLE DriverHandle
)
{
EFI_STATUS Status;
Status = gBS->DisconnectController (DriverHandle, NULL, NULL);
if (!EFI_ERROR (Status)) {
Status = gBS->ConnectController (DriverHandle, NULL, NULL, TRUE);
}
return Status == EFI_SUCCESS;
}
/**
Call the call back function for the question and process the return action.
@param Selection On input, Selection tell setup browser the information
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
@param FormSet The formset this question belong to.
@param Form The form this question belong to.
@param Question The Question which need to call.
@param Action The action request.
@param SkipSaveOrDiscard Whether skip save or discard action.
@retval EFI_SUCCESS The call back function executes successfully.
@return Other value if the call back function failed to execute.
**/
EFI_STATUS
ProcessCallBackFunction (
IN OUT UI_MENU_SELECTION *Selection,
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN FORM_BROWSER_STATEMENT *Question,
IN EFI_BROWSER_ACTION Action,
IN BOOLEAN SkipSaveOrDiscard
)
{
EFI_STATUS Status;
EFI_STATUS InternalStatus;
EFI_BROWSER_ACTION_REQUEST ActionRequest;
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
EFI_HII_VALUE *HiiValue;
EFI_IFR_TYPE_VALUE *TypeValue;
FORM_BROWSER_STATEMENT *Statement;
BOOLEAN SubmitFormIsRequired;
BOOLEAN DiscardFormIsRequired;
BOOLEAN NeedExit;
LIST_ENTRY *Link;
BROWSER_SETTING_SCOPE SettingLevel;
EFI_IFR_TYPE_VALUE BackUpValue;
UINT8 *BackUpBuffer;
CHAR16 *NewString;
ConfigAccess = FormSet->ConfigAccess;
SubmitFormIsRequired = FALSE;
SettingLevel = FormSetLevel;
DiscardFormIsRequired = FALSE;
NeedExit = FALSE;
Status = EFI_SUCCESS;
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
BackUpBuffer = NULL;
if (ConfigAccess == NULL) {
return EFI_SUCCESS;
}
Link = GetFirstNode (&Form->StatementListHead);
while (!IsNull (&Form->StatementListHead, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&Form->StatementListHead, Link);
//
// if Question != NULL, only process the question. Else, process all question in this form.
//
if ((Question != NULL) && (Statement != Question)) {
continue;
}
if ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != EFI_IFR_FLAG_CALLBACK) {
continue;
}
//
// Check whether Statement is disabled.
//
if (Statement->Expression != NULL) {
if (EvaluateExpressionList (Statement->Expression, TRUE, FormSet, Form) == ExpressDisable) {
continue;
}
}
HiiValue = &Statement->HiiValue;
TypeValue = &HiiValue->Value;
if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
//
// For OrderedList, passing in the value buffer to Callback()
//
TypeValue = (EFI_IFR_TYPE_VALUE *)Statement->BufferValue;
}
//
// If EFI_BROWSER_ACTION_CHANGING type, back up the new question value.
//
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
BackUpBuffer = AllocateCopyPool (Statement->StorageWidth, Statement->BufferValue);
ASSERT (BackUpBuffer != NULL);
} else {
CopyMem (&BackUpValue, &HiiValue->Value, sizeof (EFI_IFR_TYPE_VALUE));
}
}
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
Status = ConfigAccess->Callback (
ConfigAccess,
Action,
Statement->QuestionId,
HiiValue->Type,
TypeValue,
&ActionRequest
);
if (!EFI_ERROR (Status)) {
//
// Need to sync the value between Statement->HiiValue->Value and Statement->BufferValue
//
if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
NewString = GetToken (Statement->HiiValue.Value.string, FormSet->HiiHandle);
ASSERT (NewString != NULL);
ASSERT (StrLen (NewString) * sizeof (CHAR16) <= Statement->StorageWidth);
if (StrLen (NewString) * sizeof (CHAR16) <= Statement->StorageWidth) {
ZeroMem (Statement->BufferValue, Statement->StorageWidth);
CopyMem (Statement->BufferValue, NewString, StrSize (NewString));
} else {
CopyMem (Statement->BufferValue, NewString, Statement->StorageWidth);
}
FreePool (NewString);
}
//
// Only for EFI_BROWSER_ACTION_CHANGED need to handle this ActionRequest.
//
switch (Action) {
case EFI_BROWSER_ACTION_CHANGED:
switch (ActionRequest) {
case EFI_BROWSER_ACTION_REQUEST_RESET:
DiscardFormIsRequired = TRUE;
gResetRequiredFormLevel = TRUE;
gResetRequiredSystemLevel = TRUE;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_SUBMIT:
SubmitFormIsRequired = TRUE;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_EXIT:
DiscardFormIsRequired = TRUE;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT:
SubmitFormIsRequired = TRUE;
SettingLevel = FormLevel;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT:
DiscardFormIsRequired = TRUE;
SettingLevel = FormLevel;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_APPLY:
SubmitFormIsRequired = TRUE;
SettingLevel = FormLevel;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD:
DiscardFormIsRequired = TRUE;
SettingLevel = FormLevel;
break;
case EFI_BROWSER_ACTION_REQUEST_RECONNECT:
gCallbackReconnect = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY:
Status = SetQuestionValue (
gCurrentSelection->FormSet,
gCurrentSelection->Form,
Statement,
GetSetValueWithHiiDriver
);
break;
default:
break;
}
break;
case EFI_BROWSER_ACTION_CHANGING:
//
// Do the question validation.
//
Status = ValueChangedValidation (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement);
if (!EFI_ERROR (Status)) {
//
// check whether the question value changed compared with edit buffer before updating edit buffer
// if changed, set the ValueChanged flag to TRUE,in order to trig the CHANGED callback function
//
IsQuestionValueChanged (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);
//
// According the spec, return value from call back of "changing" and
// "retrieve" should update to the question's temp buffer.
//
SetQuestionValue (FormSet, Form, Statement, GetSetValueWithEditBuffer);
}
break;
case EFI_BROWSER_ACTION_RETRIEVE:
//
// According the spec, return value from call back of "changing" and
// "retrieve" should update to the question's temp buffer.
//
SetQuestionValue (FormSet, Form, Statement, GetSetValueWithEditBuffer);
break;
default:
break;
}
} else {
//
// If the callback returns EFI_UNSUPPORTED for EFI_BROWSER_ACTION_CHANGING,
// then the browser will use the value passed to Callback() and ignore the
// value returned by Callback().
//
if ((Action == EFI_BROWSER_ACTION_CHANGING) && (Status == EFI_UNSUPPORTED)) {
if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
CopyMem (Statement->BufferValue, BackUpBuffer, Statement->StorageWidth);
} else {
CopyMem (&HiiValue->Value, &BackUpValue, sizeof (EFI_IFR_TYPE_VALUE));
}
//
// Do the question validation.
//
InternalStatus = ValueChangedValidation (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement);
if (!EFI_ERROR (InternalStatus)) {
//
// check whether the question value changed compared with edit buffer before updating edit buffer
// if changed, set the ValueChanged flag to TRUE,in order to trig the CHANGED callback function
//
IsQuestionValueChanged (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);
SetQuestionValue (FormSet, Form, Statement, GetSetValueWithEditBuffer);
}
}
//
// According the spec, return fail from call back of "changing" and
// "retrieve", should restore the question's value.
//
if ((Action == EFI_BROWSER_ACTION_CHANGING) && (Status != EFI_UNSUPPORTED)) {
if (Statement->Storage != NULL) {
GetQuestionValue (FormSet, Form, Statement, GetSetValueWithEditBuffer);
} else if ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {
ProcessCallBackFunction (Selection, FormSet, Form, Question, EFI_BROWSER_ACTION_RETRIEVE, FALSE);
}
}
if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
GetQuestionValue (FormSet, Form, Statement, GetSetValueWithEditBuffer);
}
if (Status == EFI_UNSUPPORTED) {
//
// If return EFI_UNSUPPORTED, also consider Hii driver suceess deal with it.
//
Status = EFI_SUCCESS;
}
}
if (BackUpBuffer != NULL) {
FreePool (BackUpBuffer);
}
//
// If Question != NULL, means just process one question
// and if code reach here means this question has finished
// processing, so just break.
//
if (Question != NULL) {
break;
}
}
if (gCallbackReconnect && (EFI_BROWSER_ACTION_CHANGED == Action)) {
//
// Confirm changes with user first.
//
if (IsNvUpdateRequiredForFormSet (FormSet)) {
if (BROWSER_ACTION_DISCARD == PopupErrorMessage (BROWSER_RECONNECT_SAVE_CHANGES, NULL, NULL, NULL)) {
gCallbackReconnect = FALSE;
DiscardFormIsRequired = TRUE;
} else {
SubmitFormIsRequired = TRUE;
}
} else {
PopupErrorMessage (BROWSER_RECONNECT_REQUIRED, NULL, NULL, NULL);
}
//
// Exit current formset before do the reconnect.
//
NeedExit = TRUE;
SettingLevel = FormSetLevel;
}
if (SubmitFormIsRequired && !SkipSaveOrDiscard) {
SubmitForm (FormSet, Form, SettingLevel);
}
if (DiscardFormIsRequired && !SkipSaveOrDiscard) {
DiscardForm (FormSet, Form, SettingLevel);
}
if (NeedExit) {
FindNextMenu (Selection, SettingLevel);
}
return Status;
}
/**
Call the retrieve type call back function for one question to get the initialize data.
This function only used when in the initialize stage, because in this stage, the
Selection->Form is not ready. For other case, use the ProcessCallBackFunction instead.
@param ConfigAccess The config access protocol produced by the hii driver.
@param Statement The Question which need to call.
@param FormSet The formset this question belong to.
@retval EFI_SUCCESS The call back function executes successfully.
@return Other value if the call back function failed to execute.
**/
EFI_STATUS
ProcessRetrieveForQuestion (
IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess,
IN FORM_BROWSER_STATEMENT *Statement,
IN FORM_BROWSER_FORMSET *FormSet
)
{
EFI_STATUS Status;
EFI_BROWSER_ACTION_REQUEST ActionRequest;
EFI_HII_VALUE *HiiValue;
EFI_IFR_TYPE_VALUE *TypeValue;
CHAR16 *NewString;
Status = EFI_SUCCESS;
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
if (((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != EFI_IFR_FLAG_CALLBACK) || (ConfigAccess == NULL)) {
return EFI_UNSUPPORTED;
}
HiiValue = &Statement->HiiValue;
TypeValue = &HiiValue->Value;
if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
//
// For OrderedList, passing in the value buffer to Callback()
//
TypeValue = (EFI_IFR_TYPE_VALUE *)Statement->BufferValue;
}
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
Status = ConfigAccess->Callback (
ConfigAccess,
EFI_BROWSER_ACTION_RETRIEVE,
Statement->QuestionId,
HiiValue->Type,
TypeValue,
&ActionRequest
);
if (!EFI_ERROR (Status) && (HiiValue->Type == EFI_IFR_TYPE_STRING)) {
NewString = GetToken (Statement->HiiValue.Value.string, FormSet->HiiHandle);
ASSERT (NewString != NULL);
ASSERT (StrLen (NewString) * sizeof (CHAR16) <= Statement->StorageWidth);
if (StrLen (NewString) * sizeof (CHAR16) <= Statement->StorageWidth) {
ZeroMem (Statement->BufferValue, Statement->StorageWidth);
CopyMem (Statement->BufferValue, NewString, StrSize (NewString));
} else {
CopyMem (Statement->BufferValue, NewString, Statement->StorageWidth);
}
FreePool (NewString);
}
return Status;
}
/**
The worker function that send the displays to the screen. On output,
the selection made by user is returned.
@param Selection On input, Selection tell setup browser the information
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
@retval EFI_SUCCESS The page is displayed successfully.
@return Other value if the page failed to be diplayed.
**/
EFI_STATUS
SetupBrowser (
IN OUT UI_MENU_SELECTION *Selection
)
{
EFI_STATUS Status;
LIST_ENTRY *Link;
EFI_HANDLE NotifyHandle;
FORM_BROWSER_STATEMENT *Statement;
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
ConfigAccess = Selection->FormSet->ConfigAccess;
//
// Register notify for Form package update
//
Status = mHiiDatabase->RegisterPackageNotify (
mHiiDatabase,
EFI_HII_PACKAGE_FORMS,
NULL,
FormUpdateNotify,
EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,
&NotifyHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Initialize current settings of Questions in this FormSet
//
InitializeCurrentSetting (Selection->FormSet);
//
// Initilize Action field.
//
Selection->Action = UI_ACTION_REFRESH_FORM;
//
// Clean the mCurFakeQestId value is formset refreshed.
//
mCurFakeQestId = 0;
do {
//
// Reset Status to prevent the next break from returning incorrect error status.
//
Status = EFI_SUCCESS;
//
// IFR is updated, force to reparse the IFR binary
// This check is shared by EFI_BROWSER_ACTION_FORM_CLOSE and
// EFI_BROWSER_ACTION_RETRIEVE, so code place here.
//
if (mHiiPackageListUpdated) {
Selection->Action = UI_ACTION_REFRESH_FORMSET;
mHiiPackageListUpdated = FALSE;
break;
}
//
// Initialize Selection->Form
//
if (Selection->FormId == 0) {
//
// Zero FormId indicates display the first Form in a FormSet
//
Link = GetFirstNode (&Selection->FormSet->FormListHead);
Selection->Form = FORM_BROWSER_FORM_FROM_LINK (Link);
Selection->FormId = Selection->Form->FormId;
} else {
Selection->Form = IdToForm (Selection->FormSet, Selection->FormId);
}
if (Selection->Form == NULL) {
//
// No Form to display
//
Status = EFI_NOT_FOUND;
goto Done;
}
//
// Check Form is suppressed.
//
if (Selection->Form->SuppressExpression != NULL) {
if (EvaluateExpressionList (Selection->Form->SuppressExpression, TRUE, Selection->FormSet, Selection->Form) == ExpressSuppress) {
//
// Form is suppressed.
//
PopupErrorMessage (BROWSER_FORM_SUPPRESS, NULL, NULL, NULL);
Status = EFI_NOT_FOUND;
goto Done;
}
}
//
// Before display new form, invoke ConfigAccess.Callback() with EFI_BROWSER_ACTION_FORM_OPEN
// for each question with callback flag.
// New form may be the first form, or the different form after another form close.
//
if (((Selection->Handle != mCurrentHiiHandle) ||
(!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid)) ||
(Selection->FormId != mCurrentFormId)))
{
//
// Update Retrieve flag.
//
mFinishRetrieveCall = FALSE;
//
// Keep current form information
//
mCurrentHiiHandle = Selection->Handle;
CopyGuid (&mCurrentFormSetGuid, &Selection->FormSetGuid);
mCurrentFormId = Selection->FormId;
if (ConfigAccess != NULL) {
Status = ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE);
if (EFI_ERROR (Status)) {
goto Done;
}
//
// IFR is updated during callback of EFI_BROWSER_ACTION_FORM_OPEN, force to reparse the IFR binary
//
if (mHiiPackageListUpdated) {
Selection->Action = UI_ACTION_REFRESH_FORMSET;
mHiiPackageListUpdated = FALSE;
break;
}
}
}
//
// Load Questions' Value for display
//
Status = LoadFormSetConfig (Selection, Selection->FormSet);
if (EFI_ERROR (Status)) {
goto Done;
}
if (!mFinishRetrieveCall) {
//
// Finish call RETRIEVE callback for this form.
//
mFinishRetrieveCall = TRUE;
if (ConfigAccess != NULL) {
Status = ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_RETRIEVE, FALSE);
if (EFI_ERROR (Status)) {
goto Done;
}
//
// IFR is updated during callback of open form, force to reparse the IFR binary
//
if (mHiiPackageListUpdated) {
Selection->Action = UI_ACTION_REFRESH_FORMSET;
mHiiPackageListUpdated = FALSE;
break;
}
}
}
//
// Display form
//
Status = DisplayForm ();
if (EFI_ERROR (Status)) {
goto Done;
}
//
// Check Selected Statement (if press ESC, Selection->Statement will be NULL)
//
Statement = Selection->Statement;
if (Statement != NULL) {
if ((ConfigAccess != NULL) &&
((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) &&
(Statement->Operand != EFI_IFR_PASSWORD_OP))
{
Status = ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE);
if (Statement->Operand == EFI_IFR_REF_OP) {
//
// Process dynamic update ref opcode.
//
if (!EFI_ERROR (Status)) {
Status = ProcessGotoOpCode (Statement, Selection);
}
//
// Callback return error status or status return from process goto opcode.
//
if (EFI_ERROR (Status)) {
//
// Cross reference will not be taken, restore all essential field
//
Selection->Handle = mCurrentHiiHandle;
CopyMem (&Selection->FormSetGuid, &mCurrentFormSetGuid, sizeof (EFI_GUID));
Selection->FormId = mCurrentFormId;
Selection->QuestionId = 0;
Selection->Action = UI_ACTION_REFRESH_FORM;
}
}
if (!EFI_ERROR (Status) &&
(Statement->Operand != EFI_IFR_REF_OP) &&
((Statement->Storage == NULL) || ((Statement->Storage != NULL) && Statement->ValueChanged)))
{
//
// Only question value has been changed, browser will trig CHANGED callback.
//
ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE);
//
// check whether the question value changed compared with buffer value
// if doesn't change ,set the ValueChanged flag to FALSE ,in order not to display the "configuration changed "information on the screen
//
IsQuestionValueChanged (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithBuffer);
}
} else {
//
// Do the question validation.
//
Status = ValueChangedValidation (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement);
if (!EFI_ERROR (Status) && (Statement->Operand != EFI_IFR_PASSWORD_OP)) {
SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);
//
// Verify whether question value has checked, update the ValueChanged flag in Question.
//
IsQuestionValueChanged (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithBuffer);
}
}
//
// If question has EFI_IFR_FLAG_RESET_REQUIRED/EFI_IFR_FLAG_RECONNECT_REQUIRED flag and without storage
// and process question success till here, trig the gResetFlag/gFlagReconnect.
//
if ((Status == EFI_SUCCESS) &&
(Statement->Storage == NULL))
{
if ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) {
gResetRequiredFormLevel = TRUE;
gResetRequiredSystemLevel = TRUE;
}
if ((Statement->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != 0) {
gFlagReconnect = TRUE;
}
}
}
//
// Check whether Exit flag is TRUE.
//
if (gExitRequired) {
switch (gBrowserSettingScope) {
case SystemLevel:
Selection->Action = UI_ACTION_EXIT;
break;
case FormSetLevel:
case FormLevel:
FindNextMenu (Selection, gBrowserSettingScope);
break;
default:
break;
}
gExitRequired = FALSE;
}
//
// Before exit the form, invoke ConfigAccess.Callback() with EFI_BROWSER_ACTION_FORM_CLOSE
// for each question with callback flag.
//
if ((ConfigAccess != NULL) &&
((Selection->Action == UI_ACTION_EXIT) ||
(Selection->Handle != mCurrentHiiHandle) ||
(!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid)) ||
(Selection->FormId != mCurrentFormId)))
{
Status = ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE);
if (EFI_ERROR (Status)) {
goto Done;
}
}
} while (Selection->Action == UI_ACTION_REFRESH_FORM);
Done:
//
// Reset current form information to the initial setting when error happens or form exit.
//
if (EFI_ERROR (Status) || (Selection->Action == UI_ACTION_EXIT)) {
mCurrentHiiHandle = NULL;
CopyGuid (&mCurrentFormSetGuid, &gZeroGuid);
mCurrentFormId = 0;
}
//
// Unregister notify for Form package update
//
mHiiDatabase->UnregisterPackageNotify (
mHiiDatabase,
NotifyHandle
);
return Status;
}
|