Allow for multiple virtual PROM addresses.

This commit is contained in:
pk 1995-03-08 15:51:03 +00:00
parent ad4540a424
commit d61b2703ef
2 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.h,v 1.8 1995/02/01 12:37:44 pk Exp $ */
/* $NetBSD: autoconf.h,v 1.9 1995/03/08 15:51:03 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@ -56,12 +56,15 @@
* (which `is' the CPU, in some sense) gets just the node, with a
* fake name ("mainbus").
*/
#define RA_MAXVADDR 4 /* max (virtual) addresses per device */
#define RA_MAXREG 2 /* max # of register banks per device */
#define RA_MAXINTR 8 /* max interrupts per device */
struct romaux {
const char *ra_name; /* name from FORTH PROM */
int ra_node; /* FORTH PROM node ID */
void *ra_vaddr; /* ROM mapped virtual address, or 0 */
void *ra_vaddrs[RA_MAXVADDR];/* ROM mapped virtual addresses */
int ra_nvaddrs; /* # of ra_vaddrs[]s, may be 0 */
#define ra_vaddr ra_vaddrs[0] /* compatibility */
struct rom_reg {
int rr_iospace; /* register space (obio, etc) */
void *rr_paddr; /* register physical address */

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.24 1995/03/01 21:18:57 pk Exp $ */
/* $NetBSD: autoconf.c,v 1.25 1995/03/08 15:53:50 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@ -543,9 +543,20 @@ romprop(rp, cp, node)
rp->ra_node = node;
rp->ra_name = cp;
rp->ra_nreg = len / sizeof(struct rom_reg);
bcopy(u.rr, rp->ra_reg, rp->ra_nreg * sizeof(struct rom_reg));
bcopy(u.rr, rp->ra_reg, len);
rp->ra_vaddr = (caddr_t)getpropint(node, "address", 0);
len = getprop(node, "address", (void *)rp->ra_vaddrs,
sizeof(rp->ra_vaddrs));
if (len == -1)
len = 0;
if (len & 3) {
printf("%s \"address\" %s = %d (need multiple of 4)\n",
cp, pl, len);
len = 0;
}
rp->ra_nvaddrs = len >> 2;
len = getprop(node, "intr", (void *)&rp->ra_intr, sizeof rp->ra_intr);
if (len == -1)
len = 0;