Module Name: src Committed By: thorpej Date: Fri Apr 30 02:13:15 UTC 2021
Modified Files: src/sys/dev/ofisa: files.ofisa ofisa.c ofisavar.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ofisa/files.ofisa cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ofisa/ofisa.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ofisa/ofisavar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ofisa/files.ofisa diff -u src/sys/dev/ofisa/files.ofisa:1.15 src/sys/dev/ofisa/files.ofisa:1.16 --- src/sys/dev/ofisa/files.ofisa:1.15 Tue Apr 27 21:39:39 2021 +++ src/sys/dev/ofisa/files.ofisa Fri Apr 30 02:13:15 2021 @@ -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 Index: src/sys/dev/ofisa/ofisa.c diff -u src/sys/dev/ofisa/ofisa.c:1.32 src/sys/dev/ofisa/ofisa.c:1.33 --- src/sys/dev/ofisa/ofisa.c:1.32 Tue Apr 27 21:39:39 2021 +++ src/sys/dev/ofisa/ofisa.c Fri Apr 30 02:13:15 2021 @@ -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. 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, 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) { Index: src/sys/dev/ofisa/ofisavar.h diff -u src/sys/dev/ofisa/ofisavar.h:1.7 src/sys/dev/ofisa/ofisavar.h:1.8 --- src/sys/dev/ofisa/ofisavar.h:1.7 Fri Dec 9 17:18:35 2016 +++ src/sys/dev/ofisa/ofisavar.h Fri Apr 30 02:13:15 2021 @@ -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_ */