| 73 | } |
| 74 | |
| 75 | bool 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 | |
| 99 | static bool cbmem_sysfs_probe_cbmem_entry(uint32_t id, uint64_t *addr_out, size_t *size_out) |
| 100 | { |
no test coverage detected