Subject: Maple bus should be direct config
To: None <port-dreamcast@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-dreamcast
Date: 01/19/2001 13:03:35
Looks the the Maple bus is a direct config bus. The patch below should
make it behave like a direct config bus in the NetBSD kernel. I don't
know if this compiles yet (don't have my cross compile environment up),
but you can get the idea about that should happen from the patch.
This, or something like it, should be committed to the tree.
--
-- Jason R. Thorpe <thorpej@zembu.com>
Index: conf/GENERIC
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/dreamcast/conf/GENERIC,v
retrieving revision 1.3
diff -c -r1.3 GENERIC
*** conf/GENERIC 2001/01/16 00:33:50 1.3
--- conf/GENERIC 2001/01/19 20:57:25
***************
*** 115,121 ****
pvr0 at shb?
! mkbd* at maple?
wsdisplay* at pvr? console ?
wskbd* at mkbd? console ?
--- 115,121 ----
pvr0 at shb?
! mkbd* at maple? port ? subunit ?
wsdisplay* at pvr? console ?
wskbd* at mkbd? console ?
Index: conf/files.dreamcast
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/dreamcast/conf/files.dreamcast,v
retrieving revision 1.3
diff -c -r1.3 files.dreamcast
*** conf/files.dreamcast 2001/01/17 00:07:23 1.3
--- conf/files.dreamcast 2001/01/19 20:57:25
***************
*** 18,24 ****
BSC_RTCSR_VAL BSC_RTCNT_VAL BSC_RTCOR_VAL BSC_RFCR_VAL
BSC_PCR_VAL FRQCR_VAL PFC_SCPCR_VAL
! device maple { }
attach maple at shb
file arch/dreamcast/dev/maple/maple.c maple
--- 18,24 ----
BSC_RTCSR_VAL BSC_RTCNT_VAL BSC_RTCOR_VAL BSC_RFCR_VAL
BSC_PCR_VAL FRQCR_VAL PFC_SCPCR_VAL
! device maple { [port = -1], [subunit = -1] }
attach maple at shb
file arch/dreamcast/dev/maple/maple.c maple
Index: dev/maple/maple.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/dreamcast/dev/maple/maple.c,v
retrieving revision 1.2
diff -c -r1.2 maple.c
*** dev/maple/maple.c 2001/01/19 20:27:31 1.2
--- dev/maple/maple.c 2001/01/19 20:57:25
***************
*** 62,67 ****
--- 62,68 ----
static int maplematch __P((struct device *, struct cfdata *, void *));
static void mapleattach __P((struct device *, struct device *, void *));
static int mapleprint __P((void *, const char *));
+ static int maplesubmatch __P((struct device *, struct cfdata *, void *));
static void maple_attach_dev __P((struct maple_softc *, int, int));
static void maple_begin_txbuf __P((struct maple_softc *));
static int maple_end_txbuf __P((struct maple_softc *));
***************
*** 88,95 ****
sizeof(struct maple_softc), maplematch, mapleattach
};
- int maplesearch __P((struct device *, struct cfdata *, void *));
-
static int
maplematch(parent, cf, aux)
struct device *parent;
--- 89,94 ----
***************
*** 105,111 ****
return (1);
}
-
static void
maple_attach_dev(sc, port, subunit)
struct maple_softc *sc;
--- 104,109 ----
***************
*** 113,122 ****
int subunit;
{
struct maple_attach_args ma;
ma.ma_port = port;
ma.ma_subunit = subunit;
ma.ma_devinfo = &sc->sc_unit[port][subunit].devinfo;
! config_search(maplesearch, &sc->sc_dev, &ma);
}
static void
--- 111,122 ----
int subunit;
{
struct maple_attach_args ma;
+
ma.ma_port = port;
ma.ma_subunit = subunit;
ma.ma_devinfo = &sc->sc_unit[port][subunit].devinfo;
!
! (void) config_found_sm(&sc->sc_dev, &ma, mapleprint, maplesubmatch);
}
static void
***************
*** 394,400 ****
uvm_pglistfree(&mlist);
}
-
static void
mapleattach(parent, self, aux)
struct device *parent, *self;
--- 394,399 ----
***************
*** 454,479 ****
struct maple_attach_args *ma = aux;
if (pnp != NULL)
! printf("%s", pnp);
! printf(" port %c", ma->ma_port+'A');
if (ma->ma_subunit != 0)
! printf("%d", ma->ma_subunit);
return (UNCONF);
}
! int
! maplesearch(parent, cf, aux)
struct device *parent;
! struct cfdata *cf;
void *aux;
{
! if ((*cf->cf_attach->ca_match)(parent, cf, aux) > 0)
! config_attach(parent, cf, aux, mapleprint);
! return (0);
}
u_int32_t
--- 453,486 ----
struct maple_attach_args *ma = aux;
if (pnp != NULL)
! printf("%s %s at %s", ma->ma_devinfo->di_product_license,
! ma->ma_devinfo->di_product_name, pnp);
! printf(" port %d", ma->ma_port);
if (ma->ma_subunit != 0)
! printf(" subunit %d", ma->ma_subunit);
return (UNCONF);
}
! static int
! maplesubmatch(parent, match, aux)
struct device *parent;
! struct cfdata *match;
void *aux;
{
! struct maple_attach_args *ma = aux;
! if (match->cf_loc[MAPLECF_PORT] != MAPLECF_PORT_DEDFAULT &&
! match->cf_loc[MAPLECF_PORT] != ma->ma_port)
! return (0);
!
! if (match->cf_loc[MAPLECF_SUBUNIT] != MAPLECF_SUBUNIT_DEFAULT &&
! match->cf_loc[MAPLECF_SUBUNIT] != ma->ma_subunit)
! return (0);
!
! return ((*match->cf_attach->ca_match)(parent, match, aux));
}
u_int32_t
***************
*** 492,495 ****
break;
return (0);
}
-
--- 499,501 ----