kernel: Clean up the usage of <machine/pc/bios.h> and the header itself.
authorSascha Wildner <saw@online.de>
Mon, 25 Mar 2019 17:51:08 +0000 (18:51 +0100)
committerSascha Wildner <saw@online.de>
Mon, 25 Mar 2019 17:51:37 +0000 (18:51 +0100)
* In the boot code, use defines from this header instead of keeping local
  ones.

* In acpi_machdep.c, remove an unneeded inclusion of the header.

* Remove unused stuff from the header.

Reported-by: zrj
sys/boot/pc32/libi386/biosmem.c
sys/boot/pc32/libi386/biossmap.c
sys/platform/pc64/acpica/acpi_machdep.c
sys/platform/pc64/include/pc/bios.h

index 49c5dda..132a7ff 100644 (file)
@@ -40,15 +40,7 @@ vm_offset_t  memtop;
 vm_offset_t    heapbase;
 u_int32_t      bios_basemem, bios_extmem, bios_howmem;
 
-#define SMAPSIG        0x534D4150
-
-struct smap {
-    u_int64_t  base;
-    u_int64_t  length;
-    u_int32_t  type;
-} __packed;
-
-static struct smap smap;
+static struct bios_smap smap;
 
 void
 bios_getmem(void)
@@ -64,8 +56,8 @@ bios_getmem(void)
        v86.ctl = V86_FLAGS;
        v86.addr = 0x15;                /* int 0x15 function 0xe820*/
        v86.eax = 0xe820;
-       v86.ecx = sizeof(struct smap);
-       v86.edx = SMAPSIG;
+       v86.ecx = sizeof(struct bios_smap);
+       v86.edx = SMAP_SIG;
        v86.es = VTOPSEG(&smap);
        v86.edi = VTOPOFF(&smap);
        v86int();
@@ -75,7 +67,7 @@ bios_getmem(void)
                (int)(smap.base >> 32), (int)smap.base,
                (int)(smap.length >> 32), (int)smap.length);
 #endif
-       if ((v86.efl & PSL_C) || (v86.eax != SMAPSIG))
+       if ((v86.efl & PSL_C) || (v86.eax != SMAP_SIG))
            break;
        /* look for a low-memory segment that's large enough */
        if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) &&
index 20ba7af..e2fad06 100644 (file)
 #include "libi386.h"
 #include "btxv86.h"
 
-#define SMAPSIG        0x534D4150
+static struct bios_smap smap;
 
-struct smap {
-       u_int64_t       base;
-       u_int64_t       length;
-       u_int32_t       type;
-} __packed;
-
-static struct smap smap;
-
-static struct smap *smapbase;
+static struct bios_smap *smapbase;
 static int smaplen;
 
 void
@@ -65,12 +57,12 @@ bios_getsmap(void)
                v86.ctl = V86_FLAGS;
                v86.addr = 0x15;                /* int 0x15 function 0xe820*/
                v86.eax = 0xe820;
-               v86.ecx = sizeof(struct smap);
-               v86.edx = SMAPSIG;
+               v86.ecx = sizeof(struct bios_smap);
+               v86.edx = SMAP_SIG;
                v86.es = VTOPSEG(&smap);
                v86.edi = VTOPOFF(&smap);
                v86int();
-               if ((v86.efl & PSL_C) || (v86.eax != SMAPSIG))
+               if ((v86.efl & PSL_C) || (v86.eax != SMAP_SIG))
                        break;
                n++;
        } while (v86.ebx != 0);
@@ -85,8 +77,8 @@ bios_getsmap(void)
                v86.ctl = V86_FLAGS;
                v86.addr = 0x15;                /* int 0x15 function 0xe820*/
                v86.eax = 0xe820;
-               v86.ecx = sizeof(struct smap);
-               v86.edx = SMAPSIG;
+               v86.ecx = sizeof(struct bios_smap);
+               v86.edx = SMAP_SIG;
                v86.es = VTOPSEG(&smap);
                v86.edi = VTOPOFF(&smap);
                v86int();
@@ -123,7 +115,7 @@ bios_getsmap(void)
                        smapbase[smaplen] = smap;
                        ++smaplen;
                }
-               if ((v86.efl & PSL_C) || (v86.eax != SMAPSIG))
+               if ((v86.efl & PSL_C) || (v86.eax != SMAP_SIG))
                        break;
        } while (v86.ebx != 0 && smaplen < n);
 }
index 8296749..ae6e00e 100644 (file)
@@ -43,7 +43,6 @@ static device_t       acpi_dev;
 
 #include <sys/event.h>
 
-#include <machine/pc/bios.h>
 #include <machine_base/apic/ioapic.h>
 #include <machine/smp.h>
 
index 40919a3..3f4f021 100644 (file)
@@ -44,10 +44,6 @@ extern u_int32_t     bios_sigsearch(u_int32_t start, u_char *sig, int siglen,
 #define SMAP_SIG       0x534D4150                      /* 'SMAP' */
 
 #define        SMAP_TYPE_MEMORY        1
-#define        SMAP_TYPE_RESERVED      2
-#define        SMAP_TYPE_ACPI_RECLAIM  3
-#define        SMAP_TYPE_ACPI_NVS      4
-#define        SMAP_TYPE_ACPI_ERROR    5
 
 struct bios_smap {
     u_int64_t  base;
@@ -55,23 +51,6 @@ struct bios_smap {
     u_int32_t  type;
 } __packed;
 
-struct bios_oem_signature {
-       char * anchor;          /* search anchor string in BIOS memory */
-       size_t offset;          /* offset from anchor (may be negative) */
-       size_t totlen;          /* total length of BIOS string to copy */
-} __packed;
-struct bios_oem_range {
-       u_int from;             /* shouldn't be below 0xe0000 */
-       u_int to;               /* shouldn't be above 0xfffff */
-} __packed;
-struct bios_oem {
-       struct bios_oem_range range;
-       struct bios_oem_signature signature[];
-} __packed;
-
-extern int
-bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen);
-
 /*
  * System Management BIOS
  */