MCPcopy Create free account
hub / github.com/coreboot/coreboot / lock_descriptor

Function lock_descriptor

util/ifdtool/ifdtool.c:1427–1568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1425}
1426
1427static void lock_descriptor(const char *filename, char *image, int size)
1428{
1429 int wr_shift, rd_shift;
1430 struct fmba *fmba = find_fmba(image, size);
1431 const struct frba *frba = find_frba(image, size);
1432 if (!fmba)
1433 exit(EXIT_FAILURE);
1434
1435 if (ifd_version >= IFD_VERSION_2) {
1436 wr_shift = FLMSTR_WR_SHIFT_V2;
1437 rd_shift = FLMSTR_RD_SHIFT_V2;
1438
1439 /*
1440 * Clear all read/write access bits. See comment on
1441 * platform_has_extended_regions() for bitfields.
1442 */
1443 if (platform_has_extended_regions()) {
1444 fmba->flmstr1 = 0;
1445 fmba->flmstr2 = 0;
1446 fmba->flmstr3 = 0;
1447 fmba->flmstr5 = 0;
1448 } else {
1449 fmba->flmstr1 &= 0xff;
1450 fmba->flmstr2 &= 0xff;
1451 fmba->flmstr3 &= 0xff;
1452 fmba->flmstr5 &= 0xff;
1453 }
1454 } else {
1455 wr_shift = FLMSTR_WR_SHIFT_V1;
1456 rd_shift = FLMSTR_RD_SHIFT_V1;
1457
1458 fmba->flmstr1 = 0;
1459 fmba->flmstr2 = 0;
1460 /* Requestor ID */
1461 fmba->flmstr3 = 0x118;
1462 }
1463
1464 switch (platform) {
1465 case PLATFORM_APL:
1466 case PLATFORM_GLK:
1467 /* CPU/BIOS can read descriptor and BIOS */
1468 fmba->flmstr1 |= 0x3 << rd_shift;
1469 /* CPU/BIOS can write BIOS */
1470 fmba->flmstr1 |= 0x2 << wr_shift;
1471 /* TXE can read descriptor, BIOS and Device Expansion */
1472 fmba->flmstr2 |= 0x23 << rd_shift;
1473 /* TXE can only write Device Expansion */
1474 fmba->flmstr2 |= 0x20 << wr_shift;
1475 break;
1476 case PLATFORM_CNL:
1477 case PLATFORM_ICL:
1478 case PLATFORM_SKLKBL:
1479 case PLATFORM_TGL:
1480 case PLATFORM_JSL:
1481 case PLATFORM_EHL:
1482 case PLATFORM_ADL:
1483 case PLATFORM_IFD2:
1484 case PLATFORM_MTL:

Callers 1

mainFunction · 0.85

Calls 6

find_fmbaFunction · 0.85
find_frbaFunction · 0.85
exitFunction · 0.85
check_regionFunction · 0.85
write_imageFunction · 0.85

Tested by

no test coverage detected