diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-04-18 07:40:04 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-04-18 07:40:04 +0000 |
commit | 888b63e1743ef4b4277b88169301e0b5c1445e16 (patch) | |
tree | 5b9d1c51879f3e1f909c17e6ec7c2f6050ac92e1 /sys/arch/i386/stand/libsa/memprobe.c | |
parent | c2ee71fae9cec63f4a94c921619dc28d1c5b5032 (diff) |
i386 bootblocks that work for 2.3. A tale too long to tell
Diffstat (limited to 'sys/arch/i386/stand/libsa/memprobe.c')
-rw-r--r-- | sys/arch/i386/stand/libsa/memprobe.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c index 1deadbe9616..3927bd83f96 100644 --- a/sys/arch/i386/stand/libsa/memprobe.c +++ b/sys/arch/i386/stand/libsa/memprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memprobe.c,v 1.26 1998/02/24 22:06:56 weingart Exp $ */ +/* $OpenBSD: memprobe.c,v 1.27 1998/04/18 07:39:54 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner, Michael Shalayeff @@ -198,41 +198,41 @@ bios_int12(mp) * * XXX - Does not detect aliased memory. */ +const u_int addrprobe_pat[] = { + 0x00000000, 0xFFFFFFFF, + 0x01010101, 0x10101010, + 0x55555555, 0xCCCCCCCC +}; static int addrprobe(kloc) u_int kloc; { __volatile u_int *loc; - static const u_int pat[] = { - 0x00000000, 0xFFFFFFFF, - 0x01010101, 0x10101010, - 0x55555555, 0xCCCCCCCC - }; register u_int i, ret = 0; - u_int save[NENTS(pat)]; + u_int save[NENTS(addrprobe_pat)]; /* Get location */ loc = (int *)(kloc * 1024); save[0] = *loc; /* Probe address */ - for(i = 0; i < NENTS(pat); i++){ - *loc = pat[i]; - if(*loc != pat[i]) + for(i = 0; i < NENTS(addrprobe_pat); i++){ + *loc = addrprobe_pat[i]; + if(*loc != addrprobe_pat[i]) ret++; } *loc = save[0]; if (!ret) { /* Write address */ - for(i = 0; i < NENTS(pat); i++) { + for(i = 0; i < NENTS(addrprobe_pat); i++) { save[i] = loc[i]; - loc[i] = pat[i]; + loc[i] = addrprobe_pat[i]; } /* Read address */ - for(i = 0; i < NENTS(pat); i++) { - if(loc[i] != pat[i]) + for(i = 0; i < NENTS(addrprobe_pat); i++) { + if(loc[i] != addrprobe_pat[i]) ret++; loc[i] = save[i]; } @@ -274,16 +274,16 @@ badprobe(mp) return ++mp; } +bios_memmap_t bios_memmap[32]; /* This is easier */ void memprobe() { - static bios_memmap_t bm[32]; /* This is easier */ - bios_memmap_t *pm = bm, *im; + bios_memmap_t *pm = bios_memmap, *im; #ifdef DEBUG printf("Probing memory: "); #endif - if(!(pm = bios_E820(bm))) { - im = bios_int12(bm); + if(!(pm = bios_E820(bios_memmap))) { + im = bios_int12(bios_memmap); pm = bios_E801(im); if (!pm) pm = bios_8800(im); @@ -299,13 +299,14 @@ memprobe() #endif pm->type = BIOS_MAP_END; /* Register in global var */ - addbootarg(BOOTARG_MEMMAP, (pm - bm + 1) * sizeof(*bm), bm); - memory_map = bm; /* XXX for 'machine mem' command only */ + addbootarg(BOOTARG_MEMMAP, + (pm - bios_memmap + 1) * sizeof(*bios_memmap), bios_memmap); + memory_map = bios_memmap; /* XXX for 'machine mem' command only */ printf("memory:"); /* XXX - Compatibility, remove later */ extmem = cnvmem = 0; - for(im = bm; im->type != BIOS_MAP_END; im++) { + for(im = bios_memmap; im->type != BIOS_MAP_END; im++) { /* Count only "good" memory chunks 4K an up in size */ if ((im->type == BIOS_MAP_FREE) && (im->size >= 4)) { printf(" %luK", (u_long)im->size); |