Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/native/kernel/x86/dmar_x86.c # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / kernel / x86 / dmar_x86.c` 54 lines ยท 2689 bytes Raw Blame History 1 /* Firmware inventory before PCI drivers start. No remapping register access. */ 2 #include "../core/ck_internal.h" 3 #include "../core/dmar.h" 4 #include "x86.h" 5 6 void ck_x86_dmar_inventory(uint64_t rsdp) 7 { 8 static struct ck_dmar d; 9 const uint8_t *table = rsdp ? ck_acpi_lookup(rsdp, "DMAR") : 0; 10 if (!table) { 11 ck_puts("dmar: absent-or-invalid; DMA confinement NOT QUALIFIED\n"); 12 return; 13 } 14 uint32_t bytes; 15 memcpy(&bytes, table + 4, sizeof bytes); 16 int rc = ck_dmar_parse(table, bytes, &d); 17 if (rc) { 18 ck_printf("dmar: inventory refused rc=%d; DMA confinement NOT QUALIFIED\n", rc); 19 return; 20 } 21 ck_printf("dmar: inventory bytes=%u address_bits=%u flags=%u units=%u regions=%u scopes=%u other=%u\n", 22 d.bytes, d.address_bits, d.flags, d.nunits, d.nregions, d.nscopes, d.nother); 23 for (unsigned i = 0; i < d.nunits; i++) { 24 const struct ck_dmar_unit *u = &d.unit[i]; 25 ck_printf("dmar: unit=%u segment=%u base=0x%llx register_bytes=%u include_all=%u\n", 26 i, u->segment, (unsigned long long)u->base, u->register_bytes, u->include_all); 27 } 28 for (unsigned i = 0; i < d.nregions; i++) { 29 const struct ck_dmar_region *r = &d.region[i]; 30 ck_printf("dmar: region=%u segment=%u base=0x%llx inclusive_limit=0x%llx\n", 31 i, r->segment, (unsigned long long)r->base, (unsigned long long)r->limit); 32 } 33 for (unsigned i = 0; i < d.nscopes; i++) { 34 const struct ck_dmar_scope *s = &d.scope[i]; 35 unsigned segment = s->kind ? d.region[s->owner].segment : d.unit[s->owner].segment; 36 char path[CK_DMAR_MAX_PATH * 6 + 1]; 37 unsigned n = 0; 38 for (unsigned j = 0; j < s->npath; j++) 39 n += (unsigned)ck_snprintf(path + n, sizeof path - n, j ? "/%02x.%u" : "%02x.%u", 40 s->path[j].device, s->path[j].function); 41 ck_printf("dmar: scope=%u owner=%s:%u segment=%u type=%u enum=%u start_bus=%u path=%s\n", 42 i, s->kind ? "region" : "unit", s->owner, segment, s->type, 43 s->enumeration_id, s->start_bus, path); 44 if (s->npath == 1) { 45 unsigned rid = (unsigned)s->start_bus << 8 | (unsigned)s->path[0].device << 3 | 46 s->path[0].function; 47 ck_printf("dmar: scope=%u direct_source_id=%04x downstream=%s\n", i, rid, 48 s->type == 2 ? "requires-bridge-walk" : "none"); 49 } else { 50 ck_printf("dmar: scope=%u source_id=unresolved requires-bridge-walk\n", i); 51 } 52 } 53 ck_puts("dmar: inventory-only register_access=none; DMA confinement NOT QUALIFIED\n"); 54 }