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

Function cbmem_sysfs_init

util/cbmem/sysfs_drv.c:75–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75bool cbmem_sysfs_init(void)
76{
77 char path[PATH_MAX_LEN];
78
79 for (enum cbmem_sysfs_path_type t = CBMEM_SYSFS_PATH_ADDRESS; t <= CBMEM_SYSFS_PATH_SIZE; ++t) {
80 new_sysfs_path(CBMEM_ID_CBTABLE, t, path, sizeof(path));
81
82 FILE *f = fopen(path, "rb");
83 if (!f) {
84 debug("Unable to open path %s for reading. Error: %s\n", path, strerror(errno));
85 return false;
86 }
87
88 uint8_t test_byte = 0;
89 if (fread(&test_byte, 1, 1, f) != 1) {
90 debug("Unable to read data from %s. Error: %s\n", path, strerror(errno));
91 return false;
92 }
93
94 fclose(f);
95 }
96 return true;
97}
98
99static bool cbmem_sysfs_probe_cbmem_entry(uint32_t id, uint64_t *addr_out, size_t *size_out)
100{

Callers 1

init_specific_backendFunction · 0.85

Calls 5

new_sysfs_pathFunction · 0.85
fopenFunction · 0.85
strerrorFunction · 0.85
freadFunction · 0.85
fcloseFunction · 0.85

Tested by

no test coverage detected