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

Function disable_gpr0

util/ifdtool/ifdtool.c:1683–1709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1681}
1682
1683static void disable_gpr0(const char *filename, char *image, int size)
1684{
1685 struct fpsba *fpsba = find_fpsba(image, size);
1686 if (!fpsba)
1687 exit(EXIT_FAILURE);
1688
1689 uint32_t gpr0_offset = get_gpr0_offset();
1690 if (gpr0_offset == 0xffffffff) {
1691 fprintf(stderr, "Disabling GPR0 not supported on this platform\n");
1692 exit(EXIT_FAILURE);
1693 }
1694
1695 union gprd reg;
1696 /* If bit 31 is set then GPR0 protection is enable */
1697 reg.value = fpsba->pchstrp[gpr0_offset];
1698 if (!reg.data.write_protect_en) {
1699 printf("GPR0 protection is already disabled\n");
1700 return;
1701 }
1702
1703 printf("Value at GPRD offset (%d) is 0x%08x\n", gpr0_offset, reg.value);
1704 print_gpr0_range(reg);
1705 /* 0 means GPR0 protection is disabled */
1706 fpsba->pchstrp[gpr0_offset] = 0;
1707 write_image(filename, image, size);
1708 printf("GPR0 protection is now disabled\n");
1709}
1710
1711/*
1712 * Helper function to parse the FPT to retrieve the FITC start offset and size.

Callers 1

mainFunction · 0.85

Calls 7

find_fpsbaFunction · 0.85
exitFunction · 0.85
get_gpr0_offsetFunction · 0.85
fprintfFunction · 0.85
printfFunction · 0.85
print_gpr0_rangeFunction · 0.85
write_imageFunction · 0.85

Tested by

no test coverage detected