diff options
| author | thorpej <thorpej@NetBSD.org> | 2021-04-30 02:13:15 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2021-04-30 02:13:15 +0000 |
| commit | 4953375e71e1f5b7f95215727df90eda832a397e (patch) | |
| tree | 13721d2bca1b06e2ad2a7eb5d2ebd71242d2bc23 /sys/dev | |
| parent | e2e893624f4f9e1a40f9abdc87a20381f90f19a3 (diff) | |
Allow devices to declare themselves an "ofisa_subclass", allowing
that device to beat "ofisa" in match, but then attach an "ofisa"
instance as a logical child at the same OFW node.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ofisa/files.ofisa | 5 | ||||
| -rw-r--r-- | sys/dev/ofisa/ofisa.c | 20 | ||||
| -rw-r--r-- | sys/dev/ofisa/ofisavar.h | 6 |
3 files changed, 24 insertions, 7 deletions
diff --git a/sys/dev/ofisa/files.ofisa b/sys/dev/ofisa/files.ofisa index 953aa17a4f6..2ae2e39a2dc 100644 --- a/sys/dev/ofisa/files.ofisa +++ b/sys/dev/ofisa/files.ofisa @@ -1,4 +1,4 @@ -# $NetBSD: files.ofisa,v 1.15 2021/04/27 21:39:39 thorpej Exp $ +# $NetBSD: files.ofisa,v 1.16 2021/04/30 02:13:15 thorpej Exp $ # OFW ISA bus support # XXX eventually we should do something with these locators @@ -7,6 +7,9 @@ device ofisa: ofisa attach ofisa at ofbus file dev/ofisa/ofisa.c ofisa +define ofisa_subclass { } +attach ofisa at ofisa_subclass with ofisa_subclass + # attachment for MI pckbc driver attach pckbc at ofisa with pckbc_ofisa file dev/ofisa/pckbc_ofisa.c pckbc_ofisa diff --git a/sys/dev/ofisa/ofisa.c b/sys/dev/ofisa/ofisa.c index cf4268f20a9..2b994b0448c 100644 --- a/sys/dev/ofisa/ofisa.c +++ b/sys/dev/ofisa/ofisa.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofisa.c,v 1.32 2021/04/27 21:39:39 thorpej Exp $ */ +/* $NetBSD: ofisa.c,v 1.33 2021/04/30 02:13:15 thorpej Exp $ */ /* * Copyright 1997, 1998 @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ofisa.c,v 1.32 2021/04/27 21:39:39 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofisa.c,v 1.33 2021/04/30 02:13:15 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -54,14 +54,17 @@ __KERNEL_RCSID(0, "$NetBSD: ofisa.c,v 1.32 2021/04/27 21:39:39 thorpej Exp $"); static int ofisamatch(device_t, cfdata_t, void *); static void ofisaattach(device_t, device_t, void *); +static int ofisa_subclass_match(device_t, cfdata_t, void *); + CFATTACH_DECL_NEW(ofisa, 0, ofisamatch, ofisaattach, NULL, NULL); -extern struct cfdriver ofisa_cd; +CFATTACH_DECL_NEW(ofisa_subclass, 0, + ofisa_subclass_match, ofisaattach, NULL, NULL); -static int ofisaprint(void *, const char *); +extern struct cfdriver ofisa_cd; -static int +int ofisaprint(void *aux, const char *pnp) { struct ofbus_attach_args *oba = aux; @@ -95,6 +98,13 @@ ofisamatch(device_t parent, cfdata_t cf, void *aux) return (rv); } +int +ofisa_subclass_match(device_t parent, cfdata_t cf, void *aux) +{ + /* We're attaching "ofisa" to something that knows what it's doing. */ + return 5; +} + void ofisaattach(device_t parent, device_t self, void *aux) { diff --git a/sys/dev/ofisa/ofisavar.h b/sys/dev/ofisa/ofisavar.h index 55df0499a65..b2b6f05de06 100644 --- a/sys/dev/ofisa/ofisavar.h +++ b/sys/dev/ofisa/ofisavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ofisavar.h,v 1.7 2016/12/09 17:18:35 christos Exp $ */ +/* $NetBSD: ofisavar.h,v 1.8 2021/04/30 02:13:15 thorpej Exp $ */ /* * Copyright 1998 @@ -36,6 +36,9 @@ #ifndef _DEV_OFISA_OFISAVAR_H_ #define _DEV_OFISA_OFISAVAR_H_ +#include <dev/ofw/openfirm.h> +#include <dev/isa/isavar.h> + struct ofisa_attach_args { struct ofbus_attach_args oba; /* common */ @@ -99,5 +102,6 @@ int ofisa_dma_count(int); int ofisa_dma_get(int, struct ofisa_dma_desc *, int); void ofisa_dma_print(struct ofisa_dma_desc *, int); void ofisa_print_model(device_t, int); +int ofisaprint(void *, const char *); #endif /* _DEV_OFISA_OFISAVAR_H_ */ |
