Module Name: src Committed By: maxv Date: Tue Aug 15 06:04:28 UTC 2017
Modified Files: src/sys/arch/amd64/amd64: bios32.c src/sys/arch/i386/i386: bios32.c Log Message: Reduce the diff between i386 and amd64 (bios32_service not implemented there). To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/amd64/amd64/bios32.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/i386/bios32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/amd64/bios32.c diff -u src/sys/arch/amd64/amd64/bios32.c:1.22 src/sys/arch/amd64/amd64/bios32.c:1.23 --- src/sys/arch/amd64/amd64/bios32.c:1.22 Sat Mar 11 07:21:10 2017 +++ src/sys/arch/amd64/amd64/bios32.c Tue Aug 15 06:04:28 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: bios32.c,v 1.22 2017/03/11 07:21:10 nonaka Exp $ */ +/* $NetBSD: bios32.c,v 1.23 2017/08/15 06:04:28 maxv Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.22 2017/03/11 07:21:10 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.23 2017/08/15 06:04:28 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -99,12 +99,12 @@ bios32_init(void) { #if 0 /* XXXfvdl need to set up compatibility segment for this */ paddr_t entry = 0; - void *p; + uint8_t *p; unsigned char cksum; int i; - for (p = (void *)ISA_HOLE_VADDR(BIOS32_START); - p < (void *)ISA_HOLE_VADDR(BIOS32_END); + for (p = (uint8_t *)ISA_HOLE_VADDR(BIOS32_START); + p < (uint8_t *)ISA_HOLE_VADDR(BIOS32_END); p += 16) { if (*(int *)p != BIOS32_MAKESIG('_', '3', '2', '_')) continue; @@ -120,7 +120,7 @@ bios32_init(void) entry = *(uint32_t *)(p + 4); - aprint_verbose("BIOS32 rev. %d found at 0x%lx\n", + aprint_debug("BIOS32 rev. %d found at 0x%lx\n", *(p + 8), entry); if (entry < BIOS32_START || @@ -139,7 +139,7 @@ bios32_init(void) #endif uint8_t *p; - /* see if we have SMBIOS extentions */ + /* see if we have SMBIOS extensions */ #ifndef XEN if (efi_probe()) { p = efi_getcfgtbl(&EFI_UUID_SMBIOS3); @@ -261,7 +261,7 @@ smbios3_map_kva(const uint8_t *p) if (eva == 0) return; - smbios_entry.addr = (uint8_t *)(eva + (sh->addr & PGOFSET)); + smbios_entry.addr = (uint8_t *)(eva + ((vaddr_t)sh->addr & PGOFSET)); smbios_entry.len = sh->size; smbios_entry.rev = sh->eprev; smbios_entry.mjr = sh->majrev; @@ -288,38 +288,10 @@ smbios3_map_kva(const uint8_t *p) int bios32_service(uint32_t service, bios32_entry_t e, bios32_entry_info_t ei) { - uint32_t eax, ebx, ecx, edx; - paddr_t entry; - - if (bios32_entry.offset == 0) - return (0); /* BIOS32 not present */ - - __asm volatile("lcall *(%%rdi)" - : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) - : "0" (service), "1" (0), "D" (&bios32_entry)); - - if ((eax & 0xff) != 0) - return (0); /* service not found */ - - entry = ebx + edx; - - if (entry < BIOS32_START || entry >= BIOS32_END) { - aprint_error( - "bios32: entry point for service %c%c%c%c is outside " - "allowable range\n", - service & 0xff, - (service >> 8) & 0xff, - (service >> 16) & 0xff, - (service >> 24) & 0xff); - return (0); - } - - e->offset = (void *)ISA_HOLE_VADDR(entry); - e->segment = GSEL(GCODE_SEL, SEL_KPL); - - ei->bei_base = ebx; - ei->bei_size = ecx; - ei->bei_entry = entry; + (void)service; + (void)e; + (void)ei; + panic("bios32_service not implemented on amd64"); return (1); } Index: src/sys/arch/i386/i386/bios32.c diff -u src/sys/arch/i386/i386/bios32.c:1.31 src/sys/arch/i386/i386/bios32.c:1.32 --- src/sys/arch/i386/i386/bios32.c:1.31 Sat Mar 11 23:39:49 2017 +++ src/sys/arch/i386/i386/bios32.c Tue Aug 15 06:04:28 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: bios32.c,v 1.31 2017/03/11 23:39:49 nonaka Exp $ */ +/* $NetBSD: bios32.c,v 1.32 2017/08/15 06:04:28 maxv Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -86,12 +86,11 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.31 2017/03/11 23:39:49 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.32 2017/08/15 06:04:28 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> -#include <sys/malloc.h> #include <dev/isa/isareg.h> #include <machine/isa_machdep.h> @@ -125,12 +124,12 @@ void bios32_init(void) { paddr_t entry = 0; - char *p; + uint8_t *p; unsigned char cksum; int i; - for (p = (char *)ISA_HOLE_VADDR(BIOS32_START); - p < (char *)ISA_HOLE_VADDR(BIOS32_END); + for (p = (uint8_t *)ISA_HOLE_VADDR(BIOS32_START); + p < (uint8_t *)ISA_HOLE_VADDR(BIOS32_END); p += 16) { if (*(int *)p != BIOS32_MAKESIG('_', '3', '2', '_')) continue; @@ -169,27 +168,26 @@ bios32_init(void) p = efi_getcfgtbl(&EFI_UUID_SMBIOS3); if (p != NULL && smbios3_check_header(p)) { smbios3_map_kva(p); - goto out; + return; } p = efi_getcfgtbl(&EFI_UUID_SMBIOS); if (p != NULL && smbios2_check_header(p)) { smbios2_map_kva(p); - goto out; + return; } } #endif for (p = ISA_HOLE_VADDR(SMBIOS_START); - p < (char *)ISA_HOLE_VADDR(SMBIOS_END); p+= 16) { + p < (uint8_t *)ISA_HOLE_VADDR(SMBIOS_END); p+= 16) { if (smbios3_check_header(p)) { smbios3_map_kva(p); - goto out; - } else if (smbios2_check_header(p)) { + return; + } + if (smbios2_check_header(p)) { smbios2_map_kva(p); - goto out; + return; } } -out: - pmap_update(pmap_kernel()); } static int @@ -245,6 +243,7 @@ smbios2_map_kva(const uint8_t *p) #else pmap_kenter_pa(eva, pa, VM_PROT_READ, 0); #endif + pmap_update(pmap_kernel()); aprint_debug("SMBIOS rev. %d.%d @ 0x%lx (%d entries)\n", sh->majrev, sh->minrev, (u_long)sh->addr, @@ -304,6 +303,7 @@ smbios3_map_kva(const uint8_t *p) #else pmap_kenter_pa(eva, pa, VM_PROT_READ, 0); #endif + pmap_update(pmap_kernel()); aprint_debug("SMBIOS rev. %d.%d.%d @ 0x%lx\n", sh->majrev, sh->minrev, sh->docrev, (u_long)sh->addr);