* bios32_init * * Locate various bios32 entities. */
| 76 | * Locate various bios32 entities. |
| 77 | */ |
| 78 | static void |
| 79 | bios32_init(void *junk) |
| 80 | { |
| 81 | u_long sigaddr; |
| 82 | struct bios32_SDheader *sdh; |
| 83 | struct PnPBIOS_table *pt; |
| 84 | u_int8_t ck, *cv; |
| 85 | int i; |
| 86 | char *p; |
| 87 | |
| 88 | /* |
| 89 | * BIOS32 Service Directory, PCI BIOS |
| 90 | */ |
| 91 | |
| 92 | /* look for the signature */ |
| 93 | if ((sigaddr = bios_sigsearch(0, "_32_", 4, 16, 0)) != 0) { |
| 94 | /* get a virtual pointer to the structure */ |
| 95 | sdh = (struct bios32_SDheader *)(uintptr_t)BIOS_PADDRTOVADDR(sigaddr); |
| 96 | for (cv = (u_int8_t *)sdh, ck = 0, i = 0; i < (sdh->len * 16); i++) { |
| 97 | ck += cv[i]; |
| 98 | } |
| 99 | /* If checksum is OK, enable use of the entrypoint */ |
| 100 | if ((ck == 0) && (BIOS_START <= sdh->entry ) && |
| 101 | (sdh->entry < (BIOS_START + BIOS_SIZE))) { |
| 102 | bios32_SDCI = BIOS_PADDRTOVADDR(sdh->entry); |
| 103 | if (bootverbose) { |
| 104 | printf("bios32: Found BIOS32 Service Directory header at %p\n", sdh); |
| 105 | printf("bios32: Entry = 0x%x (%x) Rev = %d Len = %d\n", |
| 106 | sdh->entry, bios32_SDCI, sdh->revision, sdh->len); |
| 107 | } |
| 108 | |
| 109 | /* Allow user override of PCI BIOS search */ |
| 110 | if (((p = kern_getenv("machdep.bios.pci")) == NULL) || strcmp(p, "disable")) { |
| 111 | /* See if there's a PCI BIOS entrypoint here */ |
| 112 | PCIbios.ident.id = 0x49435024; /* PCI systems should have this */ |
| 113 | if (!bios32_SDlookup(&PCIbios) && bootverbose) |
| 114 | printf("pcibios: PCI BIOS entry at 0x%x+0x%x\n", PCIbios.base, PCIbios.entry); |
| 115 | } |
| 116 | if (p != NULL) |
| 117 | freeenv(p); |
| 118 | } else { |
| 119 | printf("bios32: Bad BIOS32 Service Directory\n"); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | /* |
| 124 | * PnP BIOS |
| 125 | * |
| 126 | * Allow user override of PnP BIOS search |
| 127 | */ |
| 128 | if ((((p = kern_getenv("machdep.bios.pnp")) == NULL) || strcmp(p, "disable")) && |
| 129 | ((sigaddr = bios_sigsearch(0, "$PnP", 4, 16, 0)) != 0)) { |
| 130 | /* get a virtual pointer to the structure */ |
| 131 | pt = (struct PnPBIOS_table *)(uintptr_t)BIOS_PADDRTOVADDR(sigaddr); |
| 132 | for (cv = (u_int8_t *)pt, ck = 0, i = 0; i < pt->len; i++) { |
| 133 | ck += cv[i]; |
| 134 | } |
| 135 | /* If checksum is OK, enable use of the entrypoint */ |
nothing calls this directly
no test coverage detected