summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-10-24 22:15:08 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-10-24 22:15:08 +0000
commit58f4d5f3b698c4551626e555dfc1fe5c3bbee64f (patch)
tree4af1860e457ec49372c96b4fdcbd9d4726e370d7 /sys/arch
parent4501d823799c49da95b185fad6f3104abc825112 (diff)
map a piece of memory after the msgbuf and copy bootargv there.
pass cksumlen argument, sysctl it mostly by niklas me just did slite editing.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/bios.c38
-rw-r--r--sys/arch/i386/i386/machdep.c35
-rw-r--r--sys/arch/i386/i386/pmap.c11
-rw-r--r--sys/arch/i386/i386/pmap.old.c11
-rw-r--r--sys/arch/i386/include/biosvar.h15
5 files changed, 67 insertions, 43 deletions
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c
index a40efa9d05c..3c34b68720a 100644
--- a/sys/arch/i386/i386/bios.c
+++ b/sys/arch/i386/i386/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.12 1997/10/24 06:49:20 mickey Exp $ */
+/* $OpenBSD: bios.c,v 1.13 1997/10/24 22:15:05 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -79,12 +79,11 @@ struct cfdriver bios_cd = {
NULL, "bios", DV_DULL
};
-extern bus_addr_t bootargv;
-extern int bootargc;
extern u_int bootapiver; /* locore.s */
extern dev_t bootdev;
bios_diskinfo_t *bios_diskinfo;
+u_int32_t bios_cksumlen;
bios_diskinfo_t *bios_getdiskinfo __P((dev_t));
@@ -94,30 +93,19 @@ biosprobe(parent, match, aux)
void *match, *aux;
{
struct bios_attach_args *bia = aux;
- bus_space_handle_t hsp;
- int error;
#ifdef BIOS_DEBUG
printf("%s%d: boot API ver %x, %x; args %p[%d]\n",
bia->bios_dev, bios_cd.cd_ndevs,
- bootapiver, BOOT_APIVER, bootargv, bootargc);
+ bootapiver, BOOT_APIVER, bootargp, bootargc);
#endif
/* there could be only one */
if (bios_cd.cd_ndevs || strcmp(bia->bios_dev, bios_cd.cd_name))
return 0;
- if (bootapiver < BOOT_APIVER || bootargv == NULL)
+ if (bootapiver < BOOT_APIVER || bootargp == NULL )
return 0;
- if ((error = bus_space_map(bia->bios_memt,
- bootargv, bootargc, 1, &hsp)) != 0) {
-#ifdef DEBUG
- printf("bios0: bus_space_map() == %d\n", error);
-#endif
- return 0;
- }
- bus_space_unmap(bia->bios_memt, hsp, bootargc);
-
return 1;
}
@@ -133,16 +121,8 @@ biosattach(parent, self, aux)
#endif
u_int8_t *va = ISA_HOLE_VADDR(0xffff0);
char *str;
- bus_space_handle_t hsp;
bootarg_t *p, *q;
- if (bus_space_map(bia->bios_memt, bootargv, bootargc, 1, &hsp) != 0) {
-#ifdef DEBUG
- panic("getbootargs: can't map low memory");
-#endif
- return;
- }
-
switch (va[14]) {
default:
case 0xff: str = "PC"; break;
@@ -158,8 +138,8 @@ biosattach(parent, self, aux)
str, va[15], va[5], va[6], va[8], va[9], va[11], va[12]);
printf("%s:", sc->sc_dev.dv_xname);
- p = (bootarg_t *)hsp;
- for(q = p; q->ba_type != BOOTARG_END; q = q->ba_next) {
+
+ for(q = p = bootargp; q->ba_type != BOOTARG_END; q = q->ba_next) {
q->ba_next = (bootarg_t *)((caddr_t)q + q->ba_size);
switch (q->ba_type) {
case BOOTARG_MEMMAP:
@@ -173,6 +153,10 @@ biosattach(parent, self, aux)
printf(" apminfo");
apm = (bios_apminfo_t *)q->ba_arg;
break;
+ case BOOTARG_CKSUMLEN:
+ printf(" cksumlen");
+ bios_cksumlen = (u_int32_t)q->ba_arg;
+ break;
default:
}
}
@@ -350,6 +334,8 @@ bios_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return sysctl_rdint(oldp, oldlenp, newp, cnvmem);
case BIOS_EXTMEM:
return sysctl_rdint(oldp, oldlenp, newp, extmem);
+ case BIOS_CKSUMLEN:
+ return sysctl_rdint(oldp, oldlenp, newp, bios_cksumlen);
default:
return EOPNOTSUPP;
}
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index bd014daa3f0..2557b904345 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.56 1997/10/22 23:37:12 mickey Exp $ */
+/* $OpenBSD: machdep.c,v 1.57 1997/10/24 22:15:06 mickey Exp $ */
/* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */
/*-
@@ -74,6 +74,7 @@
#endif
#include <dev/cons.h>
+#include <stand/boot/bootarg.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
@@ -151,6 +152,7 @@ int cpu_class;
struct msgbuf *msgbufp;
int msgbufmapped;
+bootarg_t *bootargp;
vm_map_t buffer_map;
extern vm_offset_t avail_start, avail_end;
@@ -197,7 +199,7 @@ cpu_startup()
caddr_t v;
int sz;
int base, residual;
- vm_offset_t minaddr, maxaddr;
+ vm_offset_t minaddr, maxaddr, va, pa;
vm_size_t size;
struct pcb *pcb;
int x;
@@ -205,13 +207,34 @@ cpu_startup()
/*
* Initialize error message buffer (at end of core).
*/
+ pa = avail_end;
/* avail_end was pre-decremented in pmap_bootstrap to compensate */
- for (i = 0; i < btoc(sizeof(struct msgbuf)); i++)
+ for (i = 0; i < btoc(sizeof(struct msgbuf)); i++, pa += NBPG)
pmap_enter(pmap_kernel(),
(vm_offset_t)((caddr_t)msgbufp + i * NBPG),
- avail_end + i * NBPG, VM_PROT_ALL, TRUE);
+ pa, VM_PROT_ALL, TRUE);
msgbufmapped = 1;
+ /*
+ * The boot arguments can be anywhere in the low memory area, but
+ * we want it more nicely aligned to not have troubles in the pmap.
+ * So we have allocated an area right after msgbuf which we map now.
+ * We also temporarily map the old area while copying the arguments.
+ */
+ if (bootargv != NULL) {
+ va = (vm_offset_t)bootargp;
+ for (i = 0; i < btoc(bootargc); i++, va += NBPG, pa += NBPG)
+ pmap_enter(pmap_kernel(), va, pa, VM_PROT_ALL, TRUE);
+
+ minaddr = i386_trunc_page(bootargv);
+ maxaddr = i386_round_page(bootargv + bootargc) + 1;
+ for (i = 0; i < maxaddr - minaddr; i += NBPG)
+ pmap_enter(pmap_kernel(), va + i * NBPG,
+ minaddr + i, VM_PROT_READ, TRUE);
+ bcopy((void*)(va + (bootargv - minaddr)), bootargp, bootargc);
+ } else
+ bootargp = NULL;
+
printf(version);
startrtclock();
@@ -1239,12 +1262,11 @@ init386(first_avail)
* extent map. This is done before the addresses are
* page rounded just to make sure we get them all.
*/
-#if 0
if (extent_alloc_region(iomem_ex, 0, IOM_BEGIN, EX_NOWAIT)) {
/* XXX What should we do? */
printf("WARNING: CAN'T ALLOCATE BASE RAM FROM IOMEM EXTENT MAP!\n");
}
-#endif
+
avail_end = biosextmem ? IOM_END + biosextmem * 1024
: biosbasemem * 1024; /* just temporary use */
@@ -1273,6 +1295,7 @@ init386(first_avail)
* These guys should be page-aligned.
*/
hole_start = biosbasemem * 1024;
+
/* we load right after the I/O hole; adjust hole_end to compensate */
hole_end = round_page(first_avail);
avail_next = avail_start;
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index ed3eb9f7ba1..5485a07b22b 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.20 1997/09/24 22:28:15 niklas Exp $ */
+/* $OpenBSD: pmap.c,v 1.21 1997/10/24 22:15:07 mickey Exp $ */
/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */
/*
@@ -92,6 +92,7 @@
#include <machine/cpu.h>
#include <dev/isa/isareg.h>
+#include <stand/boot/bootarg.h>
#include <i386/isa/isa_machdep.h>
#include "isa.h"
@@ -203,7 +204,7 @@ void pmap_pvdump __P((vm_offset_t pa));
*/
pt_entry_t *CMAP1, *CMAP2, *XXX_mmap;
caddr_t CADDR1, CADDR2, vmmap;
-pt_entry_t *msgbufmap;
+pt_entry_t *msgbufmap, *bootargmap;
#endif /* BSDVM_COMPAT */
/*
@@ -227,8 +228,9 @@ pmap_bootstrap(virtual_start)
pt_entry_t *pte;
#endif
- /* XXX: allow for msgbuf */
- avail_end -= i386_round_page(sizeof(struct msgbuf));
+ /* XXX: allow for msgbuf and bootargv */
+ avail_end -= i386_round_page(sizeof(struct msgbuf)) +
+ 2 * i386_round_page(bootargc);
virtual_avail = virtual_start;
virtual_end = VM_MAX_KERNEL_ADDRESS;
@@ -276,6 +278,7 @@ pmap_bootstrap(virtual_start)
SYSMAP(caddr_t ,CMAP2 ,CADDR2 ,1 )
SYSMAP(caddr_t ,XXX_mmap ,vmmap ,1 )
SYSMAP(struct msgbuf * ,msgbufmap ,msgbufp ,1 )
+ SYSMAP(bootarg_t * ,bootargmap ,bootargp ,2 )
virtual_avail = va;
#endif
diff --git a/sys/arch/i386/i386/pmap.old.c b/sys/arch/i386/i386/pmap.old.c
index 3aa6887d912..dade4699176 100644
--- a/sys/arch/i386/i386/pmap.old.c
+++ b/sys/arch/i386/i386/pmap.old.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.old.c,v 1.20 1997/09/24 22:28:15 niklas Exp $ */
+/* $OpenBSD: pmap.old.c,v 1.21 1997/10/24 22:15:07 mickey Exp $ */
/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */
/*
@@ -92,6 +92,7 @@
#include <machine/cpu.h>
#include <dev/isa/isareg.h>
+#include <stand/boot/bootarg.h>
#include <i386/isa/isa_machdep.h>
#include "isa.h"
@@ -203,7 +204,7 @@ void pmap_pvdump __P((vm_offset_t pa));
*/
pt_entry_t *CMAP1, *CMAP2, *XXX_mmap;
caddr_t CADDR1, CADDR2, vmmap;
-pt_entry_t *msgbufmap;
+pt_entry_t *msgbufmap, *bootargmap;
#endif /* BSDVM_COMPAT */
/*
@@ -227,8 +228,9 @@ pmap_bootstrap(virtual_start)
pt_entry_t *pte;
#endif
- /* XXX: allow for msgbuf */
- avail_end -= i386_round_page(sizeof(struct msgbuf));
+ /* XXX: allow for msgbuf and bootargv */
+ avail_end -= i386_round_page(sizeof(struct msgbuf)) +
+ 2 * i386_round_page(bootargc);
virtual_avail = virtual_start;
virtual_end = VM_MAX_KERNEL_ADDRESS;
@@ -276,6 +278,7 @@ pmap_bootstrap(virtual_start)
SYSMAP(caddr_t ,CMAP2 ,CADDR2 ,1 )
SYSMAP(caddr_t ,XXX_mmap ,vmmap ,1 )
SYSMAP(struct msgbuf * ,msgbufmap ,msgbufp ,1 )
+ SYSMAP(bootarg_t * ,bootargmap ,bootargp ,2 )
virtual_avail = va;
#endif
diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h
index 00b75e40cdf..76077223203 100644
--- a/sys/arch/i386/include/biosvar.h
+++ b/sys/arch/i386/include/biosvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosvar.h,v 1.22 1997/10/24 06:49:19 mickey Exp $ */
+/* $OpenBSD: biosvar.h,v 1.23 1997/10/24 22:15:07 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -65,7 +65,8 @@
#define BIOS_DISKINFO 2 /* struct: BIOS boot device info */
#define BIOS_CNVMEM 3 /* int: amount of conventional memory */
#define BIOS_EXTMEM 4 /* int: amount of extended memory */
-#define BIOS_MAXID 5 /* number of valid machdep ids */
+#define BIOS_CKSUMLEN 5 /* int: disk cksum block count */
+#define BIOS_MAXID 6 /* number of valid machdep ids */
#define CTL_BIOS_NAMES { \
{ 0, 0 }, \
@@ -73,6 +74,7 @@
{ "diskinfo", CTLTYPE_STRUCT }, \
{ "cnvmem", CTLTYPE_INT }, \
{ "extmem", CTLTYPE_INT }, \
+ { "cksumlen", CTLTYPE_INT }, \
}
#define BOOTARG_MEMMAP 0
@@ -104,7 +106,12 @@ typedef struct _bios_diskinfo {
/* Checksum section */
u_int32_t checksum; /* Checksum for drive */
- u_int checklen; /* Number of sectors done */
+
+ /* Misc. flags */
+ u_int32_t flags;
+#define BDI_INVALID 0x00000001 /* I/O error during checksumming */
+#define BDI_GOODLABEL 0x00000002 /* Had SCSI or ST506/ESDI disklabel */
+#define BDI_BADLABEL 0x00000004 /* Had another disklabel */
} bios_diskinfo_t;
@@ -120,6 +127,8 @@ typedef struct _bios_apminfo {
u_int apm_entry;
} bios_apminfo_t;
+#define BOOTARG_CKSUMLEN 3 /* u_int32_t */
+
#if defined(_KERNEL) || defined (_STANDALONE)
#ifdef _LOCORE