Sync. with the sun3x (mostly cosmetic changes).
This commit is contained in:
parent
fc2200d8a4
commit
5a1f692161
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: idprom.c,v 1.20 1997/10/06 19:58:06 gwr Exp $ */
|
||||
/* $NetBSD: idprom.c,v 1.21 1997/10/17 03:26:20 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -57,25 +57,17 @@
|
||||
*/
|
||||
struct idprom identity_prom;
|
||||
|
||||
/*
|
||||
* This is called very early during startup to
|
||||
* get a copy of the idprom from control space.
|
||||
*/
|
||||
static int idprom_hostid __P((void));
|
||||
|
||||
void
|
||||
idprom_init()
|
||||
{
|
||||
struct idprom *idp;
|
||||
char *dst;
|
||||
u_char *dst;
|
||||
vm_offset_t src;
|
||||
int len, x, xorsum;
|
||||
union {
|
||||
long l;
|
||||
char c[4];
|
||||
} hid;
|
||||
|
||||
/* Copy the IDPROM contents and do the checksum. */
|
||||
idp = &identity_prom;
|
||||
dst = (char*)idp;
|
||||
dst = (u_char *) &identity_prom;
|
||||
src = IDPROM_BASE;
|
||||
len = IDPROM_SIZE;
|
||||
xorsum = 0; /* calculated as xor of data */
|
||||
@ -87,10 +79,23 @@ idprom_init()
|
||||
} while (--len > 0);
|
||||
|
||||
if (xorsum != 0)
|
||||
mon_printf("idprom: bad checksum=%d\n", xorsum);
|
||||
if (idp->idp_format < 1)
|
||||
mon_printf("idprom: bad version=%d\n", idp->idp_format);
|
||||
mon_printf("idprom: bad checksum\n");
|
||||
if (identity_prom.idp_format < 1)
|
||||
mon_printf("idprom: bad version\n");
|
||||
|
||||
hostid = idprom_hostid();
|
||||
}
|
||||
|
||||
static int
|
||||
idprom_hostid()
|
||||
{
|
||||
struct idprom *idp;
|
||||
union {
|
||||
long l;
|
||||
char c[4];
|
||||
} hid;
|
||||
|
||||
idp = &identity_prom;
|
||||
/*
|
||||
* Construct the hostid from the idprom contents.
|
||||
* This appears to be the way SunOS does it.
|
||||
@ -99,19 +104,13 @@ idprom_init()
|
||||
hid.c[1] = idp->idp_serialnum[0];
|
||||
hid.c[2] = idp->idp_serialnum[1];
|
||||
hid.c[3] = idp->idp_serialnum[2];
|
||||
hostid = hid.l;
|
||||
return (hid.l);
|
||||
}
|
||||
|
||||
void
|
||||
idprom_etheraddr(eaddrp)
|
||||
u_char *eaddrp;
|
||||
{
|
||||
u_char *src, *dst;
|
||||
int len = 6;
|
||||
|
||||
src = identity_prom.idp_etheraddr;
|
||||
dst = eaddrp;
|
||||
|
||||
do *dst++ = *src++;
|
||||
while (--len > 0);
|
||||
bcopy(identity_prom.idp_etheraddr, eaddrp, 6);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bus_subr.c,v 1.2 1997/04/25 18:06:45 gwr Exp $ */
|
||||
/* $NetBSD: bus_subr.c,v 1.3 1997/10/17 03:25:05 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -153,7 +153,8 @@ static const int bustype_to_ptetype[4] = {
|
||||
* Try the access using peek_*
|
||||
* Clean up temp. mapping
|
||||
*/
|
||||
int bus_peek(bustype, paddr, sz)
|
||||
int
|
||||
bus_peek(bustype, paddr, sz)
|
||||
int bustype, paddr, sz;
|
||||
{
|
||||
int off, pte, rv;
|
||||
@ -194,7 +195,7 @@ int bus_peek(bustype, paddr, sz)
|
||||
/* All mappings in tmp_vpages are non-cached, so no flush. */
|
||||
set_pte(pgva, PG_INVAL);
|
||||
|
||||
return rv;
|
||||
return (rv);
|
||||
}
|
||||
|
||||
static const int bustype_to_pmaptype[4] = {
|
||||
@ -205,22 +206,22 @@ static const int bustype_to_pmaptype[4] = {
|
||||
};
|
||||
|
||||
void *
|
||||
bus_mapin(bustype, paddr, sz)
|
||||
int bustype, paddr, sz;
|
||||
bus_mapin(bustype, pa, sz)
|
||||
int bustype, pa, sz;
|
||||
{
|
||||
int off, pa, pmt;
|
||||
vm_offset_t va, retval;
|
||||
int off;
|
||||
|
||||
if (bustype & ~3)
|
||||
return (NULL);
|
||||
|
||||
off = paddr & PGOFSET;
|
||||
pa = paddr - off;
|
||||
off = pa & PGOFSET;
|
||||
pa -= off;
|
||||
sz += off;
|
||||
sz = round_page(sz);
|
||||
sz = m68k_round_page(sz);
|
||||
|
||||
pmt = bustype_to_pmaptype[bustype];
|
||||
pmt |= PMAP_NC; /* non-cached */
|
||||
pa |= bustype_to_pmaptype[bustype];
|
||||
pa |= PMAP_NC; /* non-cached */
|
||||
|
||||
/* Get some kernel virtual address space. */
|
||||
va = kmem_alloc_wait(kernel_map, sz);
|
||||
@ -229,15 +230,16 @@ bus_mapin(bustype, paddr, sz)
|
||||
retval = va + off;
|
||||
|
||||
/* Map it to the specified bus. */
|
||||
#if 0 /* XXX */
|
||||
#if 0
|
||||
/* This has a problem with wrap-around... */
|
||||
pmap_map((int)va, pa | pmt, pa + sz, VM_PROT_ALL);
|
||||
pmap_map((int)va, pa, pa + sz, VM_PROT_ALL);
|
||||
#else
|
||||
do {
|
||||
pmap_enter(pmap_kernel(), va, pa | pmt, VM_PROT_ALL, FALSE);
|
||||
pmap_enter(pmap_kernel(), va, pa, VM_PROT_ALL, FALSE);
|
||||
va += NBPG;
|
||||
pa += NBPG;
|
||||
} while ((sz -= NBPG) > 0);
|
||||
sz -= NBPG;
|
||||
} while (sz > 0);
|
||||
#endif
|
||||
|
||||
return ((void*)retval);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: idprom.c,v 1.20 1997/10/06 19:58:06 gwr Exp $ */
|
||||
/* $NetBSD: idprom.c,v 1.21 1997/10/17 03:26:20 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -57,25 +57,17 @@
|
||||
*/
|
||||
struct idprom identity_prom;
|
||||
|
||||
/*
|
||||
* This is called very early during startup to
|
||||
* get a copy of the idprom from control space.
|
||||
*/
|
||||
static int idprom_hostid __P((void));
|
||||
|
||||
void
|
||||
idprom_init()
|
||||
{
|
||||
struct idprom *idp;
|
||||
char *dst;
|
||||
u_char *dst;
|
||||
vm_offset_t src;
|
||||
int len, x, xorsum;
|
||||
union {
|
||||
long l;
|
||||
char c[4];
|
||||
} hid;
|
||||
|
||||
/* Copy the IDPROM contents and do the checksum. */
|
||||
idp = &identity_prom;
|
||||
dst = (char*)idp;
|
||||
dst = (u_char *) &identity_prom;
|
||||
src = IDPROM_BASE;
|
||||
len = IDPROM_SIZE;
|
||||
xorsum = 0; /* calculated as xor of data */
|
||||
@ -87,10 +79,23 @@ idprom_init()
|
||||
} while (--len > 0);
|
||||
|
||||
if (xorsum != 0)
|
||||
mon_printf("idprom: bad checksum=%d\n", xorsum);
|
||||
if (idp->idp_format < 1)
|
||||
mon_printf("idprom: bad version=%d\n", idp->idp_format);
|
||||
mon_printf("idprom: bad checksum\n");
|
||||
if (identity_prom.idp_format < 1)
|
||||
mon_printf("idprom: bad version\n");
|
||||
|
||||
hostid = idprom_hostid();
|
||||
}
|
||||
|
||||
static int
|
||||
idprom_hostid()
|
||||
{
|
||||
struct idprom *idp;
|
||||
union {
|
||||
long l;
|
||||
char c[4];
|
||||
} hid;
|
||||
|
||||
idp = &identity_prom;
|
||||
/*
|
||||
* Construct the hostid from the idprom contents.
|
||||
* This appears to be the way SunOS does it.
|
||||
@ -99,19 +104,13 @@ idprom_init()
|
||||
hid.c[1] = idp->idp_serialnum[0];
|
||||
hid.c[2] = idp->idp_serialnum[1];
|
||||
hid.c[3] = idp->idp_serialnum[2];
|
||||
hostid = hid.l;
|
||||
return (hid.l);
|
||||
}
|
||||
|
||||
void
|
||||
idprom_etheraddr(eaddrp)
|
||||
u_char *eaddrp;
|
||||
{
|
||||
u_char *src, *dst;
|
||||
int len = 6;
|
||||
|
||||
src = identity_prom.idp_etheraddr;
|
||||
dst = eaddrp;
|
||||
|
||||
do *dst++ = *src++;
|
||||
while (--len > 0);
|
||||
bcopy(identity_prom.idp_etheraddr, eaddrp, 6);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user