Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Reduce the diff between i386 and amd64 (bios32_serv...



details:   https://anonhg.NetBSD.org/src/rev/1e754afc5fd1
branches:  trunk
changeset: 355789:1e754afc5fd1
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Aug 15 06:04:28 2017 +0000

description:
Reduce the diff between i386 and amd64 (bios32_service not implemented
there).

diffstat:

 sys/arch/amd64/amd64/bios32.c |  52 +++++++++---------------------------------
 sys/arch/i386/i386/bios32.c   |  28 +++++++++++-----------
 2 files changed, 26 insertions(+), 54 deletions(-)

diffs (194 lines):

diff -r cf2774cf2e82 -r 1e754afc5fd1 sys/arch/amd64/amd64/bios32.c
--- a/sys/arch/amd64/amd64/bios32.c     Tue Aug 15 05:31:52 2017 +0000
+++ b/sys/arch/amd64/amd64/bios32.c     Tue Aug 15 06:04:28 2017 +0000
@@ -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 @@
 {
 #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 @@
 
                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 @@
 #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 @@
        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 @@
 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);
 }
diff -r cf2774cf2e82 -r 1e754afc5fd1 sys/arch/i386/i386/bios32.c
--- a/sys/arch/i386/i386/bios32.c       Tue Aug 15 05:31:52 2017 +0000
+++ b/sys/arch/i386/i386/bios32.c       Tue Aug 15 06:04:28 2017 +0000
@@ -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 @@
 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 @@
                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 @@
 #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 @@
 #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);



Home | Main Index | Thread Index | Old Index