Convert all foo_match() functions to use a `struct cfdata *' for their

second argument.  The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
This commit is contained in:
scottr 1996-12-16 16:17:02 +00:00
parent a00e49c200
commit 9b4055eb72
23 changed files with 398 additions and 371 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: adb.c,v 1.12 1996/10/13 03:21:13 christos Exp $ */ /* $NetBSD: adb.c,v 1.13 1996/12/16 16:17:02 scottr Exp $ */
/*- /*-
* Copyright (C) 1994 Bradley A. Grantham * Copyright (C) 1994 Bradley A. Grantham
@ -50,7 +50,7 @@ e* notice, this list of conditions and the following disclaimer in the
/* /*
* Function declarations. * Function declarations.
*/ */
static int adbmatch __P((struct device *, void *, void *)); static int adbmatch __P((struct device *, struct cfdata *, void *));
static void adbattach __P((struct device *, struct device *, void *)); static void adbattach __P((struct device *, struct device *, void *));
/* /*
@ -95,9 +95,10 @@ struct cfdriver adb_cd = {
}; };
static int static int
adbmatch(pdp, match, auxp) adbmatch(parent, cf, aux)
struct device *pdp; struct device *parent;
void *match, *auxp; struct cfdata *cf;
void *aux;
{ {
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc.c,v 1.14 1996/11/09 17:26:26 briggs Exp $ */ /* $NetBSD: asc.c,v 1.15 1996/12/16 16:17:02 scottr Exp $ */
/*- /*-
* Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
@ -61,7 +61,7 @@ static int bell_length = 10;
static int bell_volume = 100; static int bell_volume = 100;
static int bell_ringing = 0; static int bell_ringing = 0;
static int ascmatch __P((struct device *, void *, void *)); static int ascmatch __P((struct device *, struct cfdata *, void *));
static void ascattach __P((struct device *, struct device *, void *)); static void ascattach __P((struct device *, struct device *, void *));
struct cfattach asc_ca = { struct cfattach asc_ca = {
@ -73,9 +73,10 @@ struct cfdriver asc_cd = {
}; };
static int static int
ascmatch(pdp, match, auxp) ascmatch(parent, cf, aux)
struct device *pdp; struct device *parent;
void *match, *auxp; struct cfdata *cf;
void *aux;
{ {
if (badbaddr((unsigned char *) ASCBase)) if (badbaddr((unsigned char *) ASCBase))
return 0; return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp.c,v 1.5 1996/12/10 21:27:39 thorpej Exp $ */ /* $NetBSD: esp.c,v 1.6 1996/12/16 16:17:04 scottr Exp $ */
/* /*
* Copyright (c) 1996 Charles M. Hannum. All rights reserved. * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
@ -201,7 +201,7 @@ dma_intr(sc)
int esp_debug = 0; /*ESP_SHOWPHASE|ESP_SHOWMISC|ESP_SHOWTRAC|ESP_SHOWCMDS;*/ int esp_debug = 0; /*ESP_SHOWPHASE|ESP_SHOWMISC|ESP_SHOWTRAC|ESP_SHOWCMDS;*/
/*static*/ void espattach __P((struct device *, struct device *, void *)); /*static*/ void espattach __P((struct device *, struct device *, void *));
/*static*/ int espmatch __P((struct device *, void *, void *)); /*static*/ int espmatch __P((struct device *, struct cfdata *, void *));
/*static*/ u_int esp_adapter_info __P((struct esp_softc *)); /*static*/ u_int esp_adapter_info __P((struct esp_softc *));
/*static*/ void espreadregs __P((struct esp_softc *)); /*static*/ void espreadregs __P((struct esp_softc *));
/*static*/ void esp_select __P((struct esp_softc *, struct esp_ecb *)); /*static*/ void esp_select __P((struct esp_softc *, struct esp_ecb *));
@ -250,11 +250,11 @@ struct scsi_device esp_dev = {
}; };
int int
espmatch(parent, vcf, aux) espmatch(parent, cf, aux)
struct device *parent; struct device *parent;
void *vcf, *aux; struct cfdata *cf;
void *aux;
{ {
struct cfdata *cf = vcf;
#ifdef SPARC_DRIVER #ifdef SPARC_DRIVER
register struct confargs *ca = aux; register struct confargs *ca = aux;
register struct romaux *ra = &ca->ca_ra; register struct romaux *ra = &ca->ca_ra;

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf.c,v 1.38 1996/10/13 03:21:17 christos Exp $ */ /* $NetBSD: grf.c,v 1.39 1996/12/16 16:17:05 scottr Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -82,7 +82,7 @@
#define iteoff(u,f) #define iteoff(u,f)
#endif #endif
int grfmatch __P((struct device *, void *, void *)); int grfmatch __P((struct device *, struct cfdata *, void *));
void grfattach __P((struct device *, struct device *, void *)); void grfattach __P((struct device *, struct device *, void *));
struct cfdriver grf_cd = { struct cfdriver grf_cd = {
@ -102,9 +102,10 @@ static int grfdebug = (GDB_DEVNO|GDB_MMAP|GDB_IOMAP|GDB_LOCK);
#endif #endif
int int
grfmatch(parent, match, aux) grfmatch(parent, cf, aux)
struct device *parent; struct device *parent;
void *match, *aux; struct cfdata *cf;
void *aux;
{ {
struct grfbus_attach_args *ga = aux; struct grfbus_attach_args *ga = aux;

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_iv.c,v 1.15 1996/10/13 03:21:18 christos Exp $ */ /* $NetBSD: grf_iv.c,v 1.16 1996/12/16 16:17:06 scottr Exp $ */
/* /*
* Copyright (c) 1995 Allen Briggs. All rights reserved. * Copyright (c) 1995 Allen Briggs. All rights reserved.
@ -57,7 +57,7 @@ extern unsigned long videosize;
static int grfiv_mode __P((struct grf_softc *gp, int cmd, void *arg)); static int grfiv_mode __P((struct grf_softc *gp, int cmd, void *arg));
static caddr_t grfiv_phys __P((struct grf_softc *gp, vm_offset_t addr)); static caddr_t grfiv_phys __P((struct grf_softc *gp, vm_offset_t addr));
static int grfiv_match __P((struct device *, void *, void *)); static int grfiv_match __P((struct device *, struct cfdata *, void *));
static void grfiv_attach __P((struct device *, struct device *, void *)); static void grfiv_attach __P((struct device *, struct device *, void *));
struct cfdriver intvid_cd = { struct cfdriver intvid_cd = {
@ -69,9 +69,10 @@ struct cfattach intvid_ca = {
}; };
static int static int
grfiv_match(pdp, match, auxp) grfiv_match(parent, cf, aux)
struct device *pdp; struct device *parent;
void *match, *auxp; struct cfdata *cf;
void *aux;
{ {
static int internal_video_found = 0; static int internal_video_found = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_mv.c,v 1.14 1996/10/13 03:21:19 christos Exp $ */ /* $NetBSD: grf_mv.c,v 1.15 1996/12/16 16:17:06 scottr Exp $ */
/* /*
* Copyright (c) 1995 Allen Briggs. All rights reserved. * Copyright (c) 1995 Allen Briggs. All rights reserved.
@ -51,13 +51,12 @@
static void load_image_data __P((caddr_t data, struct image_data *image)); static void load_image_data __P((caddr_t data, struct image_data *image));
static void grfmv_intr __P((void *vsc, int slot)); static void grfmv_intr __P((void *vsc, int slot));
static int get_vrsrcid __P((nubus_slot *slot));
static char zero = 0; static char zero = 0;
static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg)); static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg));
static caddr_t grfmv_phys __P((struct grf_softc *gp, vm_offset_t addr)); static caddr_t grfmv_phys __P((struct grf_softc *gp, vm_offset_t addr));
static int grfmv_match __P((struct device *, void *, void *)); static int grfmv_match __P((struct device *, struct cfdata *, void *));
static void grfmv_attach __P((struct device *, struct device *, void *)); static void grfmv_attach __P((struct device *, struct device *, void *));
struct cfdriver macvid_cd = { struct cfdriver macvid_cd = {
@ -107,61 +106,20 @@ grfmv_intr(vsc, slot)
} }
static int static int
get_vrsrcid(slot) grfmv_match(parent, cf, aux)
nubus_slot *slot;
{
extern u_short mac68k_vrsrc_vec[];
int i;
for (i = 0 ; i < 6 ; i++)
if ((mac68k_vrsrc_vec[i] & 0xff) == slot->slot)
return ((mac68k_vrsrc_vec[i] >> 8) & 0xff);
return 0x80;
}
static int
grfmv_match(parent, self, aux)
struct device *parent; struct device *parent;
void *self, *aux; struct cfdata *cf;
void *aux;
{ {
struct grfbus_softc *sc; struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
nubus_slot *slot = (nubus_slot *) aux;
nubus_dir dir, *dirp, *dirp2;
nubus_dirent dirent, *direntp;
nubus_type slottype;
int vrsrc;
sc = (struct grfbus_softc *) self; /* XXX: indirect brokenness */ if (na->category != NUBUS_CATEGORY_DISPLAY)
dirp = &dir;
direntp = &dirent;
nubus_get_main_dir(slot, dirp);
vrsrc = get_vrsrcid(slot);
if (nubus_find_rsrc(slot, dirp, vrsrc, direntp) <= 0) {
if ( (vrsrc != 128)
|| (nubus_find_rsrc(slot, dirp, 129, direntp) <= 0)) {
return 0;
}
}
dirp2 = (nubus_dir *) &sc->board_dir;
nubus_get_dir_from_rsrc(slot, direntp, dirp2);
if (nubus_find_rsrc(slot, dirp2, NUBUS_RSRC_TYPE, direntp) <= 0)
/* Type is a required entry... This should never happen. */
return 0; return 0;
if (nubus_get_ind_data(slot, direntp, if (na->type != NUBUS_TYPE_VIDEO)
(caddr_t) &slottype, sizeof(nubus_type)) <= 0)
return 0; return 0;
if (slottype.category != NUBUS_CATEGORY_DISPLAY) if (na->drsw != NUBUS_DRSW_APPLE)
return 0;
if (slottype.type != NUBUS_TYPE_VIDEO)
return 0;
if (slottype.drsw != NUBUS_DRSW_APPLE)
return 0; return 0;
/* /*
@ -171,12 +129,6 @@ grfmv_match(parent, self, aux)
* proceed like it is. * proceed like it is.
*/ */
sc->card_id = slottype.drhw;
sc->sc_slot = *slot;
/* Need to load display info (and driver?), etc... */
return 1; return 1;
} }
@ -185,16 +137,31 @@ grfmv_attach(parent, self, aux)
struct device *parent, *self; struct device *parent, *self;
void *aux; void *aux;
{ {
struct grfbus_softc *sc; struct grfbus_softc *sc = (struct grfbus_softc *) self;
struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
struct image_data image_store, image; struct image_data image_store, image;
struct grfmode *gm; struct grfmode *gm;
char cardname[CARD_NAME_LEN]; char cardname[CARD_NAME_LEN];
nubus_dirent dirent; nubus_dirent dirent;
nubus_dir mode_dir; nubus_dir dir, mode_dir;
int mode; int mode;
sc = (struct grfbus_softc *) self; sc->card_id = na->drhw;
gm = &sc->curr_mode;
bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot));
nubus_get_main_dir(&sc->sc_slot, &dir);
if (nubus_find_rsrc(&sc->sc_slot, &dir, na->rsrcid, &dirent) <= 0)
return;
nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir);
if (nubus_find_rsrc(&sc->sc_slot, &sc->board_dir,
NUBUS_RSRC_TYPE, &dirent) <= 0)
if ((na->rsrcid != 128) ||
(nubus_find_rsrc(&sc->sc_slot, &dir, 129, &dirent) <= 0))
return;
mode = NUBUS_RSRC_FIRSTMODE; mode = NUBUS_RSRC_FIRSTMODE;
if (nubus_find_rsrc(&sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) { if (nubus_find_rsrc(&sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) {
@ -219,8 +186,11 @@ grfmv_attach(parent, self, aux)
return; return;
} }
/* Need to load display info (and driver?), etc... (?) */
load_image_data((caddr_t) &image_store, &image); load_image_data((caddr_t) &image_store, &image);
gm = &sc->curr_mode;
gm->mode_id = mode; gm->mode_id = mode;
gm->fbbase = (caddr_t) (sc->sc_slot.virtual_base + image.offset); gm->fbbase = (caddr_t) (sc->sc_slot.virtual_base + image.offset);
gm->fboff = image.offset; gm->fboff = image.offset;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ae.c,v 1.48 1996/10/13 03:21:20 christos Exp $ */ /* $NetBSD: if_ae.c,v 1.49 1996/12/16 16:17:07 scottr Exp $ */
/* /*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@ -103,10 +103,10 @@ struct ae_softc {
u_char next_packet; /* pointer to next unread RX packet */ u_char next_packet; /* pointer to next unread RX packet */
}; };
static int ae_id_card __P((nubus_slot *slot, struct ae_softc *sc)); static int ae_card_vendor __P((struct nubus_attach_args *na));
static int ae_size_card_memory __P((struct ae_softc *sc)); static int ae_size_card_memory __P((caddr_t addr));
int aeprobe __P((struct device *, void *, void *)); int aematch __P((struct device *, struct cfdata *, void *));
void aeattach __P((struct device *, struct device *, void *)); void aeattach __P((struct device *, struct device *, void *));
void aeintr __P((void *, int)); void aeintr __P((void *, int));
int aeioctl __P((struct ifnet *, u_long, caddr_t)); int aeioctl __P((struct ifnet *, u_long, caddr_t));
@ -130,7 +130,7 @@ static inline caddr_t ae_ring_copy __P((
struct ae_softc *, caddr_t, caddr_t, int)); struct ae_softc *, caddr_t, caddr_t, int));
struct cfattach ae_ca = { struct cfattach ae_ca = {
sizeof(struct ae_softc), aeprobe, aeattach sizeof(struct ae_softc), aematch, aeattach
}; };
struct cfdriver ae_cd = { struct cfdriver ae_cd = {
@ -188,81 +188,54 @@ byte_copy(a, b, len)
} }
static int static int
ae_id_card(slot, sc) ae_card_vendor(na)
nubus_slot *slot; struct nubus_attach_args *na;
struct ae_softc *sc;
{ {
nubus_dir dir; int vendor;
nubus_dirent dirent;
nubus_type slottype;
nubus_get_main_dir(slot, &dir); switch (na->drsw) {
if (nubus_find_rsrc(slot, &dir, 0x80, &dirent) <= 0)
return 0;
nubus_get_dir_from_rsrc(slot, &dirent, &dir);
if (nubus_find_rsrc(slot, &dir, NUBUS_RSRC_TYPE, &dirent) <= 0)
return 0;
if (nubus_get_ind_data(slot, &dirent,
(caddr_t) &slottype, sizeof(nubus_type)) <= 0)
return 0;
if (slottype.category != NUBUS_CATEGORY_NETWORK)
return 0;
if (slottype.type != NUBUS_TYPE_ETHERNET)
return 0;
switch (slottype.drsw) {
case NUBUS_DRSW_3COM: case NUBUS_DRSW_3COM:
case NUBUS_DRSW_APPLE: case NUBUS_DRSW_APPLE:
case NUBUS_DRSW_TECHWORKS: case NUBUS_DRSW_TECHWORKS:
sc->vendor = AE_VENDOR_APPLE; vendor = AE_VENDOR_APPLE;
break; break;
case NUBUS_DRSW_ASANTE: case NUBUS_DRSW_ASANTE:
sc->vendor = AE_VENDOR_ASANTE; vendor = AE_VENDOR_ASANTE;
break; break;
case NUBUS_DRSW_FARALLON: case NUBUS_DRSW_FARALLON:
sc->vendor = AE_VENDOR_FARALLON; vendor = AE_VENDOR_FARALLON;
break; break;
case NUBUS_DRSW_FOCUS: case NUBUS_DRSW_FOCUS:
sc->vendor = AE_VENDOR_FOCUS; vendor = AE_VENDOR_FOCUS;
break; break;
case NUBUS_DRSW_GATOR: case NUBUS_DRSW_GATOR:
switch (slottype.drhw) { switch (na->drhw) {
default: default:
case NUBUS_DRHW_INTERLAN: case NUBUS_DRHW_INTERLAN:
sc->vendor = AE_VENDOR_INTERLAN; vendor = AE_VENDOR_INTERLAN;
break; break;
case NUBUS_DRHW_KINETICS: case NUBUS_DRHW_KINETICS:
sc->vendor = AE_VENDOR_DAYNA; vendor = AE_VENDOR_DAYNA;
break; break;
} }
break; break;
default: default:
printf("Unknown ethernet drsw: %x\n", slottype.drsw); #ifdef AE_DEBUG
sc->vendor = AE_VENDOR_UNKNOWN; printf("Unknown ethernet drsw: %x\n", na->drsw);
return 0; #endif
vendor = AE_VENDOR_UNKNOWN;
} }
return vendor;
strncpy(sc->type_str, nubus_get_card_name(slot), INTERFACE_NAME_LEN);
sc->type_str[INTERFACE_NAME_LEN-1] = '\0';
return 1;
} }
static int static int
ae_size_card_memory(sc) ae_size_card_memory(addr)
struct ae_softc *sc; caddr_t addr;
{ {
u_short *p; u_short *p;
u_short i1, i2, i3, i4; u_short i1, i2, i3, i4;
p = (u_short *) sc->mem_start; p = (u_short *) addr;
/* /*
* very simple size memory, assuming it's installed in 8k * very simple size memory, assuming it's installed in 8k
@ -294,31 +267,65 @@ ae_size_card_memory(sc)
} }
int int
aeprobe(parent, match, aux) aematch(parent, cf, aux)
struct device *parent; struct device *parent;
void *match, *aux; struct cfdata *cf;
void *aux;
{ {
struct ae_softc *sc = match; struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
nubus_slot *nu = (nubus_slot *) aux;
caddr_t addr;
int i, memsize;
int flags = 0;
if (ae_id_card(nu, sc) <= 0) if (na->category != NUBUS_CATEGORY_NETWORK)
return 0; return 0;
sc->regs_rev = 0; if (na->type != NUBUS_TYPE_ETHERNET)
return 0;
addr = (caddr_t) nu->virtual_base; switch (ae_card_vendor(na)) {
case AE_VENDOR_APPLE:
case AE_VENDOR_ASANTE:
case AE_VENDOR_FARALLON:
case AE_VENDOR_INTERLAN:
break;
case AE_VENDOR_DAYNA:
case AE_VENDOR_FOCUS:
default:
return 0;
}
return 1;
}
/*
* Install interface into kernel networking data structures
*/
void
aeattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct ae_softc *sc = (struct ae_softc *) self;
struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
caddr_t addr;
int i, memsize;
int flags = 0;
sc->regs_rev = 0;
sc->vendor = ae_card_vendor(na);
strncpy(sc->type_str, nubus_get_card_name(na->fmt),
INTERFACE_NAME_LEN);
sc->type_str[INTERFACE_NAME_LEN-1] = '\0';
addr = (caddr_t) na->fmt->virtual_base;
switch (sc->vendor) { switch (sc->vendor) {
case AE_VENDOR_INTERLAN: case AE_VENDOR_INTERLAN:
sc->nic_addr = addr + GC_NIC_OFFSET; sc->nic_addr = addr + GC_NIC_OFFSET;
sc->rom_addr = addr + GC_ROM_OFFSET; sc->rom_addr = addr + GC_ROM_OFFSET;
sc->mem_start = addr + GC_DATA_OFFSET; sc->mem_start = addr + GC_DATA_OFFSET;
if ((memsize = ae_size_card_memory(sc)) == 0) { if ((memsize = ae_size_card_memory(sc->mem_start)) == 0) {
printf("Failed to determine size of RAM.\n"); printf(": failed to determine size of RAM.\n");
return 0; return;
} }
/* reset the NIC chip */ /* reset the NIC chip */
@ -336,9 +343,9 @@ aeprobe(parent, match, aux)
sc->nic_addr = addr + AE_NIC_OFFSET; sc->nic_addr = addr + AE_NIC_OFFSET;
sc->rom_addr = addr + AE_ROM_OFFSET; sc->rom_addr = addr + AE_ROM_OFFSET;
sc->mem_start = addr + AE_DATA_OFFSET; sc->mem_start = addr + AE_DATA_OFFSET;
if ((memsize = ae_size_card_memory(sc)) == 0) { if ((memsize = ae_size_card_memory(sc->mem_start)) == 0) {
printf("Failed to determine size of RAM.\n"); printf(": failed to determine size of RAM.\n");
return (0); return;
} }
/* Get station address from on-board ROM */ /* Get station address from on-board ROM */
@ -347,7 +354,6 @@ aeprobe(parent, match, aux)
break; break;
case AE_VENDOR_DAYNA: case AE_VENDOR_DAYNA:
printf("We think we are a Dayna card, but ");
sc->nic_addr = addr + DP_NIC_OFFSET; sc->nic_addr = addr + DP_NIC_OFFSET;
sc->rom_addr = addr + DP_ROM_OFFSET; sc->rom_addr = addr + DP_ROM_OFFSET;
sc->mem_start = addr + DP_DATA_OFFSET; sc->mem_start = addr + DP_DATA_OFFSET;
@ -356,30 +362,27 @@ aeprobe(parent, match, aux)
/* Get station address from on-board ROM */ /* Get station address from on-board ROM */
for (i = 0; i < ETHER_ADDR_LEN; ++i) for (i = 0; i < ETHER_ADDR_LEN; ++i)
sc->sc_arpcom.ac_enaddr[i] = *(sc->rom_addr + i * 2); sc->sc_arpcom.ac_enaddr[i] = *(sc->rom_addr + i * 2);
printf("it is dangerous to continue.\n");
return (0); /* Since we don't work yet... */ printf(": unsupported Dayna hardware\n");
break; return;
case AE_VENDOR_FARALLON: case AE_VENDOR_FARALLON:
sc->regs_rev = 1; sc->regs_rev = 1;
sc->rom_addr = addr + FE_ROM_OFFSET; sc->rom_addr = addr + FE_ROM_OFFSET;
sc->nic_addr = addr + AE_NIC_OFFSET; sc->nic_addr = addr + AE_NIC_OFFSET;
sc->mem_start = addr + AE_DATA_OFFSET; sc->mem_start = addr + AE_DATA_OFFSET;
if ((memsize = ae_size_card_memory(sc)) == 0) { if ((memsize = ae_size_card_memory(sc->mem_start)) == 0) {
printf("Failed to determine size of RAM.\n"); printf(": failed to determine size of RAM.\n");
return (0); return;
} }
/* Get station address from on-board ROM */ /* Get station address from on-board ROM */
for (i = 0; i < ETHER_ADDR_LEN; ++i) for (i = 0; i < ETHER_ADDR_LEN; ++i)
sc->sc_arpcom.ac_enaddr[i] = *(sc->rom_addr + i); sc->sc_arpcom.ac_enaddr[i] = *(sc->rom_addr + i);
break; break;
case AE_VENDOR_FOCUS: case AE_VENDOR_FOCUS:
printf("Focus EtherLAN card detected, but not supported.\n"); printf(": unsupported Focus hardware\n");
default: return;
return (0);
break;
} }
sc->cr_proto = ED_CR_RD2; sc->cr_proto = ED_CR_RD2;
@ -401,28 +404,13 @@ aeprobe(parent, match, aux)
bszero((u_short *) sc->mem_start, memsize / 2); bszero((u_short *) sc->mem_start, memsize / 2);
for (i = 0; i < memsize; ++i) for (i = 0; i < memsize; ++i)
if (sc->mem_start[i]) { if (sc->mem_start[i])
printf("%s: failed to clear shared memory at %p - check configuration\n", printf("%s: failed to clear shared memory at %p - check configuration\n",
sc->sc_dev.dv_xname, sc->sc_dev.dv_xname,
sc->mem_start + i); sc->mem_start + i);
return (0);
}
bcopy(nu, &sc->sc_slot, sizeof(nubus_slot)); bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot));
return (1);
}
/*
* Install interface into kernel networking data structures
*/
void
aeattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct ae_softc *sc = (void *) self;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
/* Set interface to stopped condition (reset). */ /* Set interface to stopped condition (reset). */
aestop(sc); aestop(sc);
@ -443,7 +431,7 @@ aeattach(parent, self, aux)
/* Print additional info when attached. */ /* Print additional info when attached. */
printf(": address %s, ", ether_sprintf(sc->sc_arpcom.ac_enaddr)); printf(": address %s, ", ether_sprintf(sc->sc_arpcom.ac_enaddr));
printf("type %s, %ldk mem.\n", sc->type_str, sc->mem_size / 1024); printf("type %s, %ldKB memory\n", sc->type_str, sc->mem_size / 1024);
#if NBPFILTER > 0 #if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.28 1996/11/19 07:17:47 scottr Exp $ */ /* $NetBSD: ite.c,v 1.29 1996/12/16 16:17:08 scottr Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -110,7 +110,7 @@ static void putc_getpars __P((char));
static void putc_square __P((char)); static void putc_square __P((char));
static void ite_putchar __P((char)); static void ite_putchar __P((char));
static int ite_pollforchar __P((void)); static int ite_pollforchar __P((void));
static int itematch __P((struct device *, void *, void *)); static int itematch __P((struct device *, struct cfdata *, void *));
static void iteattach __P((struct device *, struct device *, void *)); static void iteattach __P((struct device *, struct device *, void *));
#define dprintf if (0) printf #define dprintf if (0) printf
@ -847,9 +847,10 @@ struct cfdriver ite_cd = {
}; };
static int static int
itematch(parent, match, aux) itematch(parent, cf, aux)
struct device *parent; struct device *parent;
void *match, *aux; struct cfdata *cf;
void *aux;
{ {
struct grfbus_attach_args *ga = aux; struct grfbus_attach_args *ga = aux;
struct grfmode *gm = ga->ga_grfmode; struct grfmode *gm = ga->ga_grfmode;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr5380.c,v 1.36 1996/12/10 21:27:38 thorpej Exp $ */ /* $NetBSD: ncr5380.c,v 1.37 1996/12/16 16:17:09 scottr Exp $ */
/* /*
* Copyright (c) 1995 Leo Weppelman. * Copyright (c) 1995 Leo Weppelman.
@ -202,7 +202,7 @@ extern __inline__ void finish_req(SC_REQ *reqp)
* Auto config stuff.... * Auto config stuff....
*/ */
void ncr_attach __P((struct device *, struct device *, void *)); void ncr_attach __P((struct device *, struct device *, void *));
int ncr_match __P((struct device *, void *, void *)); int ncr_match __P((struct device *, struct cfdata *, void *));
/* /*
* Tricks to make driver-name configurable * Tricks to make driver-name configurable
@ -220,9 +220,10 @@ struct cfdriver CFNAME(DRNAME) = {
}; };
int int
ncr_match(pdp, match, auxp) ncr_match(parent, cf, aux)
struct device *pdp; struct device *parent;
void *match, *auxp; struct cfdata *cf;
void *auxp;
{ {
return (machine_match(pdp, match, auxp, &CFNAME(DRNAME))); return (machine_match(pdp, match, auxp, &CFNAME(DRNAME)));
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: nubus.c,v 1.27 1996/10/21 05:42:23 scottr Exp $ */ /* $NetBSD: nubus.c,v 1.28 1996/12/16 16:17:10 scottr Exp $ */
/* /*
* Copyright (c) 1995 Allen Briggs. All rights reserved. * Copyright (c) 1995 Allen Briggs. All rights reserved.
@ -47,9 +47,10 @@ static int nubus_debug = 0x01;
#define NDB_ARITH 0x4 #define NDB_ARITH 0x4
#endif #endif
static int nubusprint __P((void *, const char *)); static int nubus_print __P((void *, const char *));
static int nubusmatch __P((struct device *, void *, void *)); static int nubus_match __P((struct device *, struct cfdata *, void *));
static void nubusattach __P((struct device *, struct device *, void *)); static void nubus_attach __P((struct device *, struct device *, void *));
int nubus_video_resource __P((int));
static int probe_slot __P((int slot, nubus_slot *fmt)); static int probe_slot __P((int slot, nubus_slot *fmt));
static u_long IncPtr __P((nubus_slot *fmt, u_long base, long amt)); static u_long IncPtr __P((nubus_slot *fmt, u_long base, long amt));
@ -61,62 +62,105 @@ static u_char GetByte __P((nubus_slot *fmt, u_long ptr));
static u_long GetLong __P((nubus_slot *fmt, u_long ptr)); static u_long GetLong __P((nubus_slot *fmt, u_long ptr));
struct cfattach nubus_ca = { struct cfattach nubus_ca = {
sizeof(struct nubus_softc), nubusmatch, nubusattach sizeof(struct nubus_softc), nubus_match, nubus_attach
}; };
struct cfdriver nubus_cd = { struct cfdriver nubus_cd = {
NULL, "nubus", DV_DULL, 1 NULL, "nubus", DV_DULL,
}; };
static int static int
nubusmatch(parent, vcf, aux) nubus_match(parent, cf, aux)
struct device *parent; struct device *parent;
void *vcf, *aux; struct cfdata *cf;
void *aux;
{ {
struct confargs *ca = aux; struct confargs *ca = aux;
if (ca->ca_bustype != BUS_NUBUS) if (ca->ca_bustype != BUS_NUBUS)
return (0); return 0;
return(1); return 1;
} }
static void static void
nubusattach(parent, self, aux) nubus_attach(parent, self, aux)
struct device *parent, *self; struct device *parent, *self;
void *aux; void *aux;
{ {
nubus_slot fmtblock; struct nubus_attach_args na_args;
int i; nubus_slot fmtblock;
nubus_dir dir;
nubus_dirent dirent;
nubus_type slottype;
int i, rsrcid;
printf("\n"); printf("\n");
for (i = NUBUS_MIN_SLOT; i <= NUBUS_MAX_SLOT; i++) { for (i = NUBUS_MIN_SLOT; i <= NUBUS_MAX_SLOT; i++) {
if (probe_slot(i, &fmtblock)) { if (probe_slot(i, &fmtblock) <= 0)
/*config_search(bus_scan, &fmtblock, nubusprint);*/ continue;
config_found(self, &fmtblock, nubusprint);
} if ((rsrcid = nubus_video_resource(i)) == (-1))
rsrcid = 0x80;
nubus_get_main_dir(&fmtblock, &dir);
if (nubus_find_rsrc(&fmtblock, &dir, rsrcid, &dirent) <= 0)
continue;
nubus_get_dir_from_rsrc(&fmtblock, &dirent, &dir);
if (nubus_find_rsrc(&fmtblock, &dir, NUBUS_RSRC_TYPE,
&dirent) <= 0)
continue;
if (nubus_get_ind_data(&fmtblock, &dirent,
(caddr_t) &slottype, sizeof(nubus_type)) <= 0)
continue;
na_args.slot = i;
na_args.rsrcid = rsrcid;
na_args.category = slottype.category;
na_args.type = slottype.type;
na_args.drsw = slottype.drsw;
na_args.drhw = slottype.drhw;
na_args.fmt = &fmtblock;
config_found(self, &na_args, nubus_print);
} }
} }
static int static int
nubusprint(aux, name) nubus_print(aux, name)
void *aux; void *aux;
const char *name; const char *name;
{ {
nubus_slot *fmt; struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
fmt = (nubus_slot *) aux;
if (name) { if (name) {
printf("%s: slot %x: %s ", name, fmt->slot, printf("%s: slot %x: %s ", name, na->fmt->slot,
nubus_get_card_name(fmt)); nubus_get_card_name(na->fmt));
printf("(Vendor: %s, ", printf("(Vendor: %s, ",
nubus_get_vendor(fmt, NUBUS_RSRC_VEND_ID)); nubus_get_vendor(na->fmt, NUBUS_RSRC_VEND_ID));
printf("Part: %s) ", printf("Part: %s)",
nubus_get_vendor(fmt, NUBUS_RSRC_VEND_PART)); nubus_get_vendor(na->fmt, NUBUS_RSRC_VEND_PART));
} }
return (UNCONF); return (UNCONF);
} }
int
nubus_video_resource(slot)
int slot;
{
extern u_int16_t mac68k_vrsrc_vec[];
int i;
for (i = 0 ; i < 6 ; i++)
if ((mac68k_vrsrc_vec[i] & 0xff) == slot)
return ((mac68k_vrsrc_vec[i] >> 8) & 0xff);
return (-1);
}
/* /*
* Probe a given nubus slot. If a card is there and we can get the * Probe a given nubus slot. If a card is there and we can get the
* format block from it's clutching decl. ROMs, fill the format block * format block from it's clutching decl. ROMs, fill the format block

View File

@ -1,4 +1,4 @@
/* $NetBSD: obio.c,v 1.3 1996/10/13 03:21:26 christos Exp $ */ /* $NetBSD: obio.c,v 1.4 1996/12/16 16:17:11 scottr Exp $ */
/* /*
* Copyright (c) 1994 Gordon W. Ross * Copyright (c) 1994 Gordon W. Ross
@ -38,7 +38,7 @@
#include <machine/autoconf.h> #include <machine/autoconf.h>
#include <machine/pte.h> #include <machine/pte.h>
static int obio_match __P((struct device *, void *, void *)); static int obio_match __P((struct device *, struct cfdata *, void *));
static void obio_attach __P((struct device *, struct device *, void *)); static void obio_attach __P((struct device *, struct device *, void *));
struct cfattach obio_ca = { struct cfattach obio_ca = {
@ -50,9 +50,10 @@ struct cfdriver obio_cd = {
}; };
static int static int
obio_match(parent, vcf, aux) obio_match(parent, cf, aux)
struct device *parent; struct device *parent;
void *vcf, *aux; struct cfdata *cf;
void *aux;
{ {
struct confargs *ca = aux; struct confargs *ca = aux;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbc.c,v 1.14 1996/11/13 07:02:17 thorpej Exp $ */ /* $NetBSD: sbc.c,v 1.15 1996/12/16 16:17:12 scottr Exp $ */
/* /*
* Copyright (c) 1996 Scott Reynolds * Copyright (c) 1996 Scott Reynolds
@ -160,7 +160,7 @@ struct sbc_softc {
#define SBC_OPTIONS_BITS "\10\3RESELECT\2INTR\1PDMA" #define SBC_OPTIONS_BITS "\10\3RESELECT\2INTR\1PDMA"
int sbc_options = SBC_PDMA; int sbc_options = SBC_PDMA;
static int sbc_match __P((struct device *, void *, void *)); static int sbc_match __P((struct device *, struct cfdata *, void *));
static void sbc_attach __P((struct device *, struct device *, void *)); static void sbc_attach __P((struct device *, struct device *, void *));
static void sbc_minphys __P((struct buf *bp)); static void sbc_minphys __P((struct buf *bp));
@ -211,9 +211,10 @@ struct cfdriver sbc_cd = {
static int static int
sbc_match(parent, match, args) sbc_match(parent, cf, args)
struct device *parent; struct device *parent;
void *match, *args; struct cfdata *cf;
void *args;
{ {
if (!mac68k_machine.scsi80) if (!mac68k_machine.scsi80)
return 0; return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: z8530tty.c,v 1.8 1996/10/15 06:57:44 scottr Exp $ */ /* $NetBSD: z8530tty.c,v 1.9 1996/12/16 16:17:12 scottr Exp $ */
/* /*
* Copyright (c) 1994 Gordon W. Ross * Copyright (c) 1994 Gordon W. Ross
@ -86,7 +86,7 @@ struct zstty_stats z8530tty_stats;
/* Definition of the driver for autoconfig. */ /* Definition of the driver for autoconfig. */
static int zstty_match(struct device *, void *, void *); static int zstty_match(struct device *, struct cfdata *, void *);
static void zstty_attach(struct device *, struct device *, void *); static void zstty_attach(struct device *, struct device *, void *);
struct cfattach zstty_ca = { struct cfattach zstty_ca = {
@ -116,11 +116,11 @@ static int zsgetbaud __P((register struct zs_chanstate *,
* zstty_match: how is this zs channel configured? * zstty_match: how is this zs channel configured?
*/ */
int int
zstty_match(parent, match, aux) zstty_match(parent, cf, aux)
struct device *parent; struct device *parent;
void *match, *aux; struct cfdata *cf;
void *aux;
{ {
struct cfdata *cf = match;
struct zsc_attach_args *args = aux; struct zsc_attach_args *args = aux;
/* Exact match is better than wildcard. */ /* Exact match is better than wildcard. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: zs.c,v 1.10 1996/10/13 03:21:31 christos Exp $ */ /* $NetBSD: zs.c,v 1.11 1996/12/16 16:17:13 scottr Exp $ */
/* /*
* Copyright (c) 1995 Gordon W. Ross * Copyright (c) 1995 Gordon W. Ross
@ -182,7 +182,7 @@ static u_char zs_init_reg[16] = {
****************************************************************/ ****************************************************************/
/* Definition of the driver for autoconfig. */ /* Definition of the driver for autoconfig. */
static int zsc_match __P((struct device *, void *, void *)); static int zsc_match __P((struct device *, struct cfdata *, void *));
static void zsc_attach __P((struct device *, struct device *, void *)); static void zsc_attach __P((struct device *, struct device *, void *));
static int zsc_print __P((void *aux, const char *name)); static int zsc_print __P((void *aux, const char *name));
@ -202,9 +202,9 @@ int zssoft __P((void *));
* Is the zs chip present? * Is the zs chip present?
*/ */
static int static int
zsc_match(parent, vcf, aux) zsc_match(parent, cf, aux)
struct device *parent; struct device *parent;
void *vcf; struct cfdata *cf;
void *aux; void *aux;
{ {
return 1; return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.h,v 1.3 1996/09/14 05:43:25 scottr Exp $ */ /* $NetBSD: autoconf.h,v 1.4 1996/12/16 16:17:15 scottr Exp $ */
/* /*
* Copyright (c) 1994 Gordon W. Ross * Copyright (c) 1994 Gordon W. Ross
@ -56,7 +56,7 @@ void setconf __P((void));
void configure __P((void)); void configure __P((void));
/* mainbus.c */ /* mainbus.c */
int bus_scan __P((struct device *, void *, void *)); int bus_scan __P((struct device *, struct cfdata *, void *));
int bus_print __P((void *, const char *)); int bus_print __P((void *, const char *));
int bus_peek __P((int, vm_offset_t, int)); int bus_peek __P((int, vm_offset_t, int));
char *bus_mapin __P((int, int, int)); char *bus_mapin __P((int, int, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu.c,v 1.20 1996/12/09 17:56:03 thorpej Exp $ */ /* $NetBSD: fpu.c,v 1.21 1996/12/16 16:17:16 scottr Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@ int fputype;
extern int *nofault; extern int *nofault;
static int fpu_match __P((struct device *, void *, void *)); static int fpu_match __P((struct device *, struct cfdata *, void *));
static void fpu_attach __P((struct device *, struct device *, void *)); static void fpu_attach __P((struct device *, struct device *, void *));
static int fpu_probe __P((void)); static int fpu_probe __P((void));
@ -71,9 +71,10 @@ struct cfdriver fpu_cd = {
}; };
static int static int
fpu_match(pdp, match, auxp) fpu_match(parent, cf, aux)
struct device *pdp; struct device *parent;
void *match, *auxp; struct cfdata *cf;
void *aux;
{ {
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.5 1996/10/21 01:59:32 briggs Exp $ */ /* $NetBSD: mainbus.c,v 1.6 1996/12/16 16:17:17 scottr Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -104,17 +104,15 @@
* Just prints out the final (non-default) locators. * Just prints out the final (non-default) locators.
*/ */
int int
bus_scan(parent, child, aux) bus_scan(parent, cf, aux)
struct device *parent; struct device *parent;
void *child, *aux; struct cfdata *cf;
void *aux;
{ {
struct cfdata *cf = child;
struct confargs *ca = aux; struct confargs *ca = aux;
cfmatch_t mf; cfmatch_t mf;
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
if (parent->dv_cfdata->cf_driver->cd_indirect)
panic("bus_scan: indirect?");
if (cf->cf_fstate == FSTATE_STAR) if (cf->cf_fstate == FSTATE_STAR)
panic("bus_scan: FSTATE_STAR"); panic("bus_scan: FSTATE_STAR");
#endif #endif
@ -249,14 +247,15 @@ bus_mapin(bustype, paddr, sz)
return ((char*)retval); return ((char*)retval);
} }
static int mainbus_match __P((struct device *, void *, void *)); static int mainbus_match __P((struct device *, struct cfdata *, void *));
static void mainbus_attach __P((struct device *parent, static void mainbus_attach __P((struct device *parent,
struct device *self, void *aux)); struct device *self, void *aux));
static int static int
mainbus_match(parent, match, aux) mainbus_match(parent, cf, aux)
struct device *parent; struct device *parent;
void *match, *aux; struct cfdata *cf;
void *aux;
{ {
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_nubus.c,v 1.14 1996/10/13 03:21:19 christos Exp $ */ /* $NetBSD: grf_nubus.c,v 1.15 1996/12/16 16:17:06 scottr Exp $ */
/* /*
* Copyright (c) 1995 Allen Briggs. All rights reserved. * Copyright (c) 1995 Allen Briggs. All rights reserved.
@ -51,13 +51,12 @@
static void load_image_data __P((caddr_t data, struct image_data *image)); static void load_image_data __P((caddr_t data, struct image_data *image));
static void grfmv_intr __P((void *vsc, int slot)); static void grfmv_intr __P((void *vsc, int slot));
static int get_vrsrcid __P((nubus_slot *slot));
static char zero = 0; static char zero = 0;
static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg)); static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg));
static caddr_t grfmv_phys __P((struct grf_softc *gp, vm_offset_t addr)); static caddr_t grfmv_phys __P((struct grf_softc *gp, vm_offset_t addr));
static int grfmv_match __P((struct device *, void *, void *)); static int grfmv_match __P((struct device *, struct cfdata *, void *));
static void grfmv_attach __P((struct device *, struct device *, void *)); static void grfmv_attach __P((struct device *, struct device *, void *));
struct cfdriver macvid_cd = { struct cfdriver macvid_cd = {
@ -107,61 +106,20 @@ grfmv_intr(vsc, slot)
} }
static int static int
get_vrsrcid(slot) grfmv_match(parent, cf, aux)
nubus_slot *slot;
{
extern u_short mac68k_vrsrc_vec[];
int i;
for (i = 0 ; i < 6 ; i++)
if ((mac68k_vrsrc_vec[i] & 0xff) == slot->slot)
return ((mac68k_vrsrc_vec[i] >> 8) & 0xff);
return 0x80;
}
static int
grfmv_match(parent, self, aux)
struct device *parent; struct device *parent;
void *self, *aux; struct cfdata *cf;
void *aux;
{ {
struct grfbus_softc *sc; struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
nubus_slot *slot = (nubus_slot *) aux;
nubus_dir dir, *dirp, *dirp2;
nubus_dirent dirent, *direntp;
nubus_type slottype;
int vrsrc;
sc = (struct grfbus_softc *) self; /* XXX: indirect brokenness */ if (na->category != NUBUS_CATEGORY_DISPLAY)
dirp = &dir;
direntp = &dirent;
nubus_get_main_dir(slot, dirp);
vrsrc = get_vrsrcid(slot);
if (nubus_find_rsrc(slot, dirp, vrsrc, direntp) <= 0) {
if ( (vrsrc != 128)
|| (nubus_find_rsrc(slot, dirp, 129, direntp) <= 0)) {
return 0;
}
}
dirp2 = (nubus_dir *) &sc->board_dir;
nubus_get_dir_from_rsrc(slot, direntp, dirp2);
if (nubus_find_rsrc(slot, dirp2, NUBUS_RSRC_TYPE, direntp) <= 0)
/* Type is a required entry... This should never happen. */
return 0; return 0;
if (nubus_get_ind_data(slot, direntp, if (na->type != NUBUS_TYPE_VIDEO)
(caddr_t) &slottype, sizeof(nubus_type)) <= 0)
return 0; return 0;
if (slottype.category != NUBUS_CATEGORY_DISPLAY) if (na->drsw != NUBUS_DRSW_APPLE)
return 0;
if (slottype.type != NUBUS_TYPE_VIDEO)
return 0;
if (slottype.drsw != NUBUS_DRSW_APPLE)
return 0; return 0;
/* /*
@ -171,12 +129,6 @@ grfmv_match(parent, self, aux)
* proceed like it is. * proceed like it is.
*/ */
sc->card_id = slottype.drhw;
sc->sc_slot = *slot;
/* Need to load display info (and driver?), etc... */
return 1; return 1;
} }
@ -185,16 +137,31 @@ grfmv_attach(parent, self, aux)
struct device *parent, *self; struct device *parent, *self;
void *aux; void *aux;
{ {
struct grfbus_softc *sc; struct grfbus_softc *sc = (struct grfbus_softc *) self;
struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
struct image_data image_store, image; struct image_data image_store, image;
struct grfmode *gm; struct grfmode *gm;
char cardname[CARD_NAME_LEN]; char cardname[CARD_NAME_LEN];
nubus_dirent dirent; nubus_dirent dirent;
nubus_dir mode_dir; nubus_dir dir, mode_dir;
int mode; int mode;
sc = (struct grfbus_softc *) self; sc->card_id = na->drhw;
gm = &sc->curr_mode;
bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot));
nubus_get_main_dir(&sc->sc_slot, &dir);
if (nubus_find_rsrc(&sc->sc_slot, &dir, na->rsrcid, &dirent) <= 0)
return;
nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir);
if (nubus_find_rsrc(&sc->sc_slot, &sc->board_dir,
NUBUS_RSRC_TYPE, &dirent) <= 0)
if ((na->rsrcid != 128) ||
(nubus_find_rsrc(&sc->sc_slot, &dir, 129, &dirent) <= 0))
return;
mode = NUBUS_RSRC_FIRSTMODE; mode = NUBUS_RSRC_FIRSTMODE;
if (nubus_find_rsrc(&sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) { if (nubus_find_rsrc(&sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) {
@ -219,8 +186,11 @@ grfmv_attach(parent, self, aux)
return; return;
} }
/* Need to load display info (and driver?), etc... (?) */
load_image_data((caddr_t) &image_store, &image); load_image_data((caddr_t) &image_store, &image);
gm = &sc->curr_mode;
gm->mode_id = mode; gm->mode_id = mode;
gm->fbbase = (caddr_t) (sc->sc_slot.virtual_base + image.offset); gm->fbbase = (caddr_t) (sc->sc_slot.virtual_base + image.offset);
gm->fboff = image.offset; gm->fboff = image.offset;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nubus.c,v 1.27 1996/10/21 05:42:23 scottr Exp $ */ /* $NetBSD: nubus.c,v 1.28 1996/12/16 16:17:10 scottr Exp $ */
/* /*
* Copyright (c) 1995 Allen Briggs. All rights reserved. * Copyright (c) 1995 Allen Briggs. All rights reserved.
@ -47,9 +47,10 @@ static int nubus_debug = 0x01;
#define NDB_ARITH 0x4 #define NDB_ARITH 0x4
#endif #endif
static int nubusprint __P((void *, const char *)); static int nubus_print __P((void *, const char *));
static int nubusmatch __P((struct device *, void *, void *)); static int nubus_match __P((struct device *, struct cfdata *, void *));
static void nubusattach __P((struct device *, struct device *, void *)); static void nubus_attach __P((struct device *, struct device *, void *));
int nubus_video_resource __P((int));
static int probe_slot __P((int slot, nubus_slot *fmt)); static int probe_slot __P((int slot, nubus_slot *fmt));
static u_long IncPtr __P((nubus_slot *fmt, u_long base, long amt)); static u_long IncPtr __P((nubus_slot *fmt, u_long base, long amt));
@ -61,62 +62,105 @@ static u_char GetByte __P((nubus_slot *fmt, u_long ptr));
static u_long GetLong __P((nubus_slot *fmt, u_long ptr)); static u_long GetLong __P((nubus_slot *fmt, u_long ptr));
struct cfattach nubus_ca = { struct cfattach nubus_ca = {
sizeof(struct nubus_softc), nubusmatch, nubusattach sizeof(struct nubus_softc), nubus_match, nubus_attach
}; };
struct cfdriver nubus_cd = { struct cfdriver nubus_cd = {
NULL, "nubus", DV_DULL, 1 NULL, "nubus", DV_DULL,
}; };
static int static int
nubusmatch(parent, vcf, aux) nubus_match(parent, cf, aux)
struct device *parent; struct device *parent;
void *vcf, *aux; struct cfdata *cf;
void *aux;
{ {
struct confargs *ca = aux; struct confargs *ca = aux;
if (ca->ca_bustype != BUS_NUBUS) if (ca->ca_bustype != BUS_NUBUS)
return (0); return 0;
return(1); return 1;
} }
static void static void
nubusattach(parent, self, aux) nubus_attach(parent, self, aux)
struct device *parent, *self; struct device *parent, *self;
void *aux; void *aux;
{ {
nubus_slot fmtblock; struct nubus_attach_args na_args;
int i; nubus_slot fmtblock;
nubus_dir dir;
nubus_dirent dirent;
nubus_type slottype;
int i, rsrcid;
printf("\n"); printf("\n");
for (i = NUBUS_MIN_SLOT; i <= NUBUS_MAX_SLOT; i++) { for (i = NUBUS_MIN_SLOT; i <= NUBUS_MAX_SLOT; i++) {
if (probe_slot(i, &fmtblock)) { if (probe_slot(i, &fmtblock) <= 0)
/*config_search(bus_scan, &fmtblock, nubusprint);*/ continue;
config_found(self, &fmtblock, nubusprint);
} if ((rsrcid = nubus_video_resource(i)) == (-1))
rsrcid = 0x80;
nubus_get_main_dir(&fmtblock, &dir);
if (nubus_find_rsrc(&fmtblock, &dir, rsrcid, &dirent) <= 0)
continue;
nubus_get_dir_from_rsrc(&fmtblock, &dirent, &dir);
if (nubus_find_rsrc(&fmtblock, &dir, NUBUS_RSRC_TYPE,
&dirent) <= 0)
continue;
if (nubus_get_ind_data(&fmtblock, &dirent,
(caddr_t) &slottype, sizeof(nubus_type)) <= 0)
continue;
na_args.slot = i;
na_args.rsrcid = rsrcid;
na_args.category = slottype.category;
na_args.type = slottype.type;
na_args.drsw = slottype.drsw;
na_args.drhw = slottype.drhw;
na_args.fmt = &fmtblock;
config_found(self, &na_args, nubus_print);
} }
} }
static int static int
nubusprint(aux, name) nubus_print(aux, name)
void *aux; void *aux;
const char *name; const char *name;
{ {
nubus_slot *fmt; struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
fmt = (nubus_slot *) aux;
if (name) { if (name) {
printf("%s: slot %x: %s ", name, fmt->slot, printf("%s: slot %x: %s ", name, na->fmt->slot,
nubus_get_card_name(fmt)); nubus_get_card_name(na->fmt));
printf("(Vendor: %s, ", printf("(Vendor: %s, ",
nubus_get_vendor(fmt, NUBUS_RSRC_VEND_ID)); nubus_get_vendor(na->fmt, NUBUS_RSRC_VEND_ID));
printf("Part: %s) ", printf("Part: %s)",
nubus_get_vendor(fmt, NUBUS_RSRC_VEND_PART)); nubus_get_vendor(na->fmt, NUBUS_RSRC_VEND_PART));
} }
return (UNCONF); return (UNCONF);
} }
int
nubus_video_resource(slot)
int slot;
{
extern u_int16_t mac68k_vrsrc_vec[];
int i;
for (i = 0 ; i < 6 ; i++)
if ((mac68k_vrsrc_vec[i] & 0xff) == slot)
return ((mac68k_vrsrc_vec[i] >> 8) & 0xff);
return (-1);
}
/* /*
* Probe a given nubus slot. If a card is there and we can get the * Probe a given nubus slot. If a card is there and we can get the
* format block from it's clutching decl. ROMs, fill the format block * format block from it's clutching decl. ROMs, fill the format block

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc.c,v 1.14 1996/11/09 17:26:26 briggs Exp $ */ /* $NetBSD: asc.c,v 1.15 1996/12/16 16:17:02 scottr Exp $ */
/*- /*-
* Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
@ -61,7 +61,7 @@ static int bell_length = 10;
static int bell_volume = 100; static int bell_volume = 100;
static int bell_ringing = 0; static int bell_ringing = 0;
static int ascmatch __P((struct device *, void *, void *)); static int ascmatch __P((struct device *, struct cfdata *, void *));
static void ascattach __P((struct device *, struct device *, void *)); static void ascattach __P((struct device *, struct device *, void *));
struct cfattach asc_ca = { struct cfattach asc_ca = {
@ -73,9 +73,10 @@ struct cfdriver asc_cd = {
}; };
static int static int
ascmatch(pdp, match, auxp) ascmatch(parent, cf, aux)
struct device *pdp; struct device *parent;
void *match, *auxp; struct cfdata *cf;
void *aux;
{ {
if (badbaddr((unsigned char *) ASCBase)) if (badbaddr((unsigned char *) ASCBase))
return 0; return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp.c,v 1.5 1996/12/10 21:27:39 thorpej Exp $ */ /* $NetBSD: esp.c,v 1.6 1996/12/16 16:17:04 scottr Exp $ */
/* /*
* Copyright (c) 1996 Charles M. Hannum. All rights reserved. * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
@ -201,7 +201,7 @@ dma_intr(sc)
int esp_debug = 0; /*ESP_SHOWPHASE|ESP_SHOWMISC|ESP_SHOWTRAC|ESP_SHOWCMDS;*/ int esp_debug = 0; /*ESP_SHOWPHASE|ESP_SHOWMISC|ESP_SHOWTRAC|ESP_SHOWCMDS;*/
/*static*/ void espattach __P((struct device *, struct device *, void *)); /*static*/ void espattach __P((struct device *, struct device *, void *));
/*static*/ int espmatch __P((struct device *, void *, void *)); /*static*/ int espmatch __P((struct device *, struct cfdata *, void *));
/*static*/ u_int esp_adapter_info __P((struct esp_softc *)); /*static*/ u_int esp_adapter_info __P((struct esp_softc *));
/*static*/ void espreadregs __P((struct esp_softc *)); /*static*/ void espreadregs __P((struct esp_softc *));
/*static*/ void esp_select __P((struct esp_softc *, struct esp_ecb *)); /*static*/ void esp_select __P((struct esp_softc *, struct esp_ecb *));
@ -250,11 +250,11 @@ struct scsi_device esp_dev = {
}; };
int int
espmatch(parent, vcf, aux) espmatch(parent, cf, aux)
struct device *parent; struct device *parent;
void *vcf, *aux; struct cfdata *cf;
void *aux;
{ {
struct cfdata *cf = vcf;
#ifdef SPARC_DRIVER #ifdef SPARC_DRIVER
register struct confargs *ca = aux; register struct confargs *ca = aux;
register struct romaux *ra = &ca->ca_ra; register struct romaux *ra = &ca->ca_ra;

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_obio.c,v 1.15 1996/10/13 03:21:18 christos Exp $ */ /* $NetBSD: grf_obio.c,v 1.16 1996/12/16 16:17:06 scottr Exp $ */
/* /*
* Copyright (c) 1995 Allen Briggs. All rights reserved. * Copyright (c) 1995 Allen Briggs. All rights reserved.
@ -57,7 +57,7 @@ extern unsigned long videosize;
static int grfiv_mode __P((struct grf_softc *gp, int cmd, void *arg)); static int grfiv_mode __P((struct grf_softc *gp, int cmd, void *arg));
static caddr_t grfiv_phys __P((struct grf_softc *gp, vm_offset_t addr)); static caddr_t grfiv_phys __P((struct grf_softc *gp, vm_offset_t addr));
static int grfiv_match __P((struct device *, void *, void *)); static int grfiv_match __P((struct device *, struct cfdata *, void *));
static void grfiv_attach __P((struct device *, struct device *, void *)); static void grfiv_attach __P((struct device *, struct device *, void *));
struct cfdriver intvid_cd = { struct cfdriver intvid_cd = {
@ -69,9 +69,10 @@ struct cfattach intvid_ca = {
}; };
static int static int
grfiv_match(pdp, match, auxp) grfiv_match(parent, cf, aux)
struct device *pdp; struct device *parent;
void *match, *auxp; struct cfdata *cf;
void *aux;
{ {
static int internal_video_found = 0; static int internal_video_found = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: obio.c,v 1.3 1996/10/13 03:21:26 christos Exp $ */ /* $NetBSD: obio.c,v 1.4 1996/12/16 16:17:11 scottr Exp $ */
/* /*
* Copyright (c) 1994 Gordon W. Ross * Copyright (c) 1994 Gordon W. Ross
@ -38,7 +38,7 @@
#include <machine/autoconf.h> #include <machine/autoconf.h>
#include <machine/pte.h> #include <machine/pte.h>
static int obio_match __P((struct device *, void *, void *)); static int obio_match __P((struct device *, struct cfdata *, void *));
static void obio_attach __P((struct device *, struct device *, void *)); static void obio_attach __P((struct device *, struct device *, void *));
struct cfattach obio_ca = { struct cfattach obio_ca = {
@ -50,9 +50,10 @@ struct cfdriver obio_cd = {
}; };
static int static int
obio_match(parent, vcf, aux) obio_match(parent, cf, aux)
struct device *parent; struct device *parent;
void *vcf, *aux; struct cfdata *cf;
void *aux;
{ {
struct confargs *ca = aux; struct confargs *ca = aux;