diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-06-29 21:33:55 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-06-29 21:33:55 +0000 |
commit | 07f81d1ec7f9a00d77ebeac722af8e828796359c (patch) | |
tree | a619bef47d79b4f92b7d53580ef398ec276f58da /sys/arch/sparc/stand/common/promdev.h | |
parent | e4860bc94976949e5141b134229c8c6973b499f7 (diff) |
In the boot blocks, stop assuming we have a 1:1 mapping of low physical
memory, but instead gather memory layout information and work with the MMU
(or the PROM) to make sure we can actually load the kernel image in a proper
contiguous physical memory area.
In order to do this, we look at the kernel image twice; during the first pass,
the kernel footprint is computed, and then after making sure it can be
loaded, the second pass loads the actual image.
Since such a logic doesn't work on media which can not seek backwards, such
as tapes, we check for the boot device being a tape and, in that case, assume
a fixed (generous) image size and don't load the kernel symbol table (to
avoid seeking backwards); since tape boot is supposed to be only used to
boot bsd.rd, this is something we can live with.
While there, lower the address the boot blocks are loaded in memory, because
the last crank did not work with some early sun4c OpenPROM, which only
map about 3.5MB of memory.
Memory games logic from NetBSD, tape handling by me.
Diffstat (limited to 'sys/arch/sparc/stand/common/promdev.h')
-rw-r--r-- | sys/arch/sparc/stand/common/promdev.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/sys/arch/sparc/stand/common/promdev.h b/sys/arch/sparc/stand/common/promdev.h index 2cd93e27cad..d8e2a7d6d54 100644 --- a/sys/arch/sparc/stand/common/promdev.h +++ b/sys/arch/sparc/stand/common/promdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: promdev.h,v 1.3 2003/08/14 17:13:57 deraadt Exp $ */ +/* $OpenBSD: promdev.h,v 1.4 2010/06/29 21:33:54 miod Exp $ */ /* $NetBSD: promdev.h,v 1.3 1995/09/18 21:31:50 pk Exp $ */ /* @@ -41,11 +41,11 @@ struct promdata { #define DT_NET 2 #define DT_BYTE 3 /* Hooks for netif.c */ - int (*xmit)(struct promdata *, void *, size_t); - int (*recv)(struct promdata *, void *, size_t); + ssize_t (*xmit)(struct promdata *, void *, size_t); + ssize_t (*recv)(struct promdata *, void *, size_t); }; -#define LOADADDR ((caddr_t)0x4000) +#define PROM_LOADADDR 0x4000 #define DDB_MAGIC0 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('0') ) #define DDB_MAGIC1 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('1') ) #define DDB_MAGIC DDB_MAGIC0 @@ -58,14 +58,20 @@ extern int hz; extern int cputyp, nbpg, pgofset, pgshift; extern int debug; -extern void prom_init(void); +void prom_init(void); +struct idprom *prom_getidprom(void); +void prom_interpret(char *); /* Note: dvma_*() routines are for "oldmon" machines only */ -extern void dvma_init(void); -extern char *dvma_mapin(char *, size_t); -extern char *dvma_mapout(char *, size_t); -extern char *dvma_alloc(int); -extern void dvma_free(char *, int); +void dvma_init(void); +char *dvma_mapin(char *, size_t); +char *dvma_mapout(char *, size_t); +char *dvma_alloc(int); +void dvma_free(char *, int); + +int mmu_init(void); +extern int (*pmap_map)(vaddr_t, paddr_t, psize_t); +extern int (*pmap_extract)(vaddr_t, paddr_t *); /* * duplicates from pmap.c for mapping device on "oldmon" machines. @@ -80,8 +86,8 @@ extern void dvma_free(char *, int); #define setsegmap(va, pmeg) (cputyp == CPU_SUN4C \ ? stba(va, ASI_SEGMAP, pmeg) \ : stha(va, ASI_SEGMAP, pmeg)) -#define getregmap(va) ((unsigned)lduha(va+2, ASI_REGMAP) >> 8) -#define setregmap(va, smeg) stha(va+2, ASI_REGMAP, (smeg << 8)) +#define getregmap(va) ((unsigned)lduha((va) + 2, ASI_REGMAP) >> 8) +#define setregmap(va, smeg) stha((va) + 2, ASI_REGMAP, (smeg << 8)) #define getpte(va) lda(va, ASI_PTE) #define setpte(va, pte) sta(va, ASI_PTE, pte) |