Improve some diagnostics.
This commit is contained in:
parent
5b69e41858
commit
e3400ad779
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: obio.c,v 1.34 1998/02/05 04:57:44 gwr Exp $ */
|
||||
/* $NetBSD: obio.c,v 1.35 1998/02/08 05:07:06 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -70,7 +70,13 @@ obio_match(parent, cf, aux)
|
||||
return(1);
|
||||
}
|
||||
|
||||
#define OBIO_INCR 0x020000
|
||||
/*
|
||||
* We need control over the order of attachment on OBIO,
|
||||
* so do "direct" style autoconfiguration with addresses
|
||||
* tried in sequence starting at zero and incrementing
|
||||
* by OBIO_INCR. Sun3 OBIO addresses are fixed forever.
|
||||
*/
|
||||
#define OBIO_INCR 0x020000
|
||||
#define OBIO_END 0x200000
|
||||
|
||||
static void
|
||||
@ -144,6 +150,17 @@ obio_submatch(parent, cf, aux)
|
||||
if (cf->cf_paddr != ca->ca_paddr)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Note that the Sun3 does not really support vectored
|
||||
* interrupts on OBIO, but the locator is permitted for
|
||||
* consistency with the Sun3X. Verify its absence...
|
||||
*/
|
||||
#ifdef DIAGNOSTIC
|
||||
if (cf->cf_intvec != -1)
|
||||
panic("obio_submatch: %s%d can not have a vector\n",
|
||||
cf->cf_driver->cd_name, cf->cf_unit);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copy the locators into our confargs for the child.
|
||||
* Note: ca->ca_bustype was set by our parent driver
|
||||
@ -187,15 +204,36 @@ obio_submatch(parent, cf, aux)
|
||||
*/
|
||||
static caddr_t prom_mappings[SAVE_SLOTS];
|
||||
|
||||
caddr_t obio_find_mapping(int pa, int size)
|
||||
/*
|
||||
* Find a virtual address for a device at physical address 'pa'.
|
||||
* If one is found among the mappings already made by the PROM
|
||||
* at power-up time, use it. Otherwise return 0 as a sign that
|
||||
* a mapping will have to be created.
|
||||
*/
|
||||
caddr_t
|
||||
obio_find_mapping(int pa, int sz)
|
||||
{
|
||||
if ((size <= NBPG) &&
|
||||
(pa < SAVE_LAST) &&
|
||||
((pa & SAVE_MASK) == 0))
|
||||
{
|
||||
return prom_mappings[pa >> SAVE_SHIFT];
|
||||
}
|
||||
return (caddr_t)0;
|
||||
int off, va;
|
||||
|
||||
off = pa & PGOFSET;
|
||||
pa -= off;
|
||||
sz += off;
|
||||
|
||||
/* The saved mappings are all one page long. */
|
||||
if (sz > NBPG)
|
||||
return (caddr_t)0;
|
||||
|
||||
/* Within our table? */
|
||||
if (pa >= SAVE_LAST)
|
||||
return (caddr_t)0;
|
||||
|
||||
/* Do we have this one? */
|
||||
va = prom_mappings[pa >> SAVE_SHIFT];
|
||||
if (va == 0)
|
||||
return (caddr_t)0;
|
||||
|
||||
/* Found it! */
|
||||
return ((caddr_t)(va + off));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: obio.c,v 1.9 1998/02/05 04:58:00 gwr Exp $ */
|
||||
/* $NetBSD: obio.c,v 1.10 1998/02/08 05:07:07 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -70,10 +70,9 @@ obio_match(parent, cf, aux)
|
||||
}
|
||||
|
||||
/*
|
||||
* We need some control over the order of attachment on OBIO,
|
||||
* and all OBIO device addresses are known and fixed foerver.
|
||||
* Therefore, this uses a list of addresses to attach.
|
||||
* XXX - Any other way to control search/attach order?
|
||||
* We need control over the order of attachment on OBIO,
|
||||
* so do "direct" style autoconfiguration with addresses
|
||||
* from the list below. OBIO addresses are fixed forever.
|
||||
*
|
||||
* Warning: This whole list is very carefully ordered!
|
||||
* In general, anything not already shown here should
|
||||
@ -81,6 +80,9 @@ obio_match(parent, cf, aux)
|
||||
*/
|
||||
static int obio_alist[] = {
|
||||
|
||||
/* This is used by the Ethernet and SCSI drivers. */
|
||||
OBIO_IOMMU,
|
||||
|
||||
/* Misc. registers - needed by many things */
|
||||
OBIO_ENABLEREG,
|
||||
OBIO_BUSERRREG,
|
||||
@ -103,17 +105,19 @@ static int obio_alist[] = {
|
||||
OBIO_CLOCK1, /* clock.c (3/470) */
|
||||
OBIO_CLOCK2, /* clock.c (3/80) */
|
||||
|
||||
/* This is used by the Ethernet and SCSI drivers. */
|
||||
OBIO_IOMMU,
|
||||
|
||||
OBIO_INTEL_ETHER,
|
||||
OBIO_LANCE_ETHER,
|
||||
|
||||
OBIO_EMULEX_SCSI, /* 3/80 only */
|
||||
|
||||
/* ...todo... */
|
||||
OBIO_FDC,
|
||||
OBIO_PRINTER_PORT,
|
||||
/* Memory subsystem */
|
||||
OBIO_PCACHE_TAGS,
|
||||
OBIO_ECCPARREG,
|
||||
OBIO_IOC_TAGS,
|
||||
OBIO_IOC_FLUSH,
|
||||
|
||||
OBIO_FDC, /* floppy disk (3/80) */
|
||||
OBIO_PRINTER_PORT, /* printer port (3/80 */
|
||||
};
|
||||
#define OBIO_ALIST_LEN (sizeof(obio_alist) / \
|
||||
sizeof(obio_alist[0]))
|
||||
@ -212,10 +216,8 @@ obio_submatch(parent, cf, aux)
|
||||
/*
|
||||
* This is our record of "interesting" OBIO mappings that
|
||||
* the PROM has left in the virtual space reserved for it.
|
||||
* Each non-null array element holds the virtual address
|
||||
* of an OBIO mapping where the OBIO address mapped is:
|
||||
* (array_index * SAVE_INCR)
|
||||
* and the length of the mapping is one page.
|
||||
* Each row of the array holds a virtual address and the
|
||||
* physical address it maps to (if found).
|
||||
*/
|
||||
static struct prom_map {
|
||||
vm_offset_t pa, va;
|
||||
@ -235,16 +237,19 @@ static struct prom_map {
|
||||
* a mapping will have to be created.
|
||||
*/
|
||||
caddr_t
|
||||
obio_find_mapping(int pa, int size)
|
||||
obio_find_mapping(int pa, int sz)
|
||||
{
|
||||
int i, off;
|
||||
|
||||
if (size >= NBPG)
|
||||
return (caddr_t)0;
|
||||
|
||||
off = pa & PGOFSET;
|
||||
pa -= off;
|
||||
sz += off;
|
||||
|
||||
/* The saved mappings are all one page long. */
|
||||
if (sz > NBPG)
|
||||
return (caddr_t)0;
|
||||
|
||||
/* Linear search for it. The list is short. */
|
||||
for (i = 0; i < PROM_MAP_CNT; i++) {
|
||||
if (pa == prom_mappings[i].pa) {
|
||||
return ((caddr_t)(prom_mappings[i].va + off));
|
||||
|
Loading…
Reference in New Issue
Block a user