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

Function enable_gpr0

util/ifdtool/ifdtool.c:1827–1855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1825}
1826
1827static void enable_gpr0(const char *filename, char *image, int size)
1828{
1829 struct fpsba *fpsba = find_fpsba(image, size);
1830 if (!fpsba)
1831 exit(EXIT_FAILURE);
1832
1833 uint32_t gpr0_offset = get_gpr0_offset();
1834 if (gpr0_offset == 0xffffffff) {
1835 fprintf(stderr, "Enabling GPR0 not supported on this platform\n");
1836 exit(EXIT_FAILURE);
1837 }
1838
1839 union gprd reg;
1840 /* If bit 31 is set then GPR0 protection is enable */
1841 reg.value = fpsba->pchstrp[gpr0_offset];
1842 if (reg.data.write_protect_en) {
1843 printf("GPR0 protection is already enabled\n");
1844 print_gpr0_range(reg);
1845 return;
1846 }
1847
1848 union gprd enabled_gprd = get_enabled_gprd(image, size);
1849
1850 fpsba->pchstrp[gpr0_offset] = enabled_gprd.value;
1851 printf("Value at GPRD offset (%d) is 0x%08x\n", gpr0_offset, enabled_gprd.value);
1852 print_gpr0_range(enabled_gprd);
1853 write_image(filename, image, size);
1854 printf("GPR0 protection is now enabled\n");
1855}
1856
1857static void is_gpr0_protected(char *image, int size)
1858{

Callers 1

mainFunction · 0.85

Calls 8

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

Tested by

no test coverage detected