Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ofisa Allow devices to declare themselves an "ofisa_...



details:   https://anonhg.NetBSD.org/src/rev/ab513d63d9f8
branches:  trunk
changeset: 378928:ab513d63d9f8
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Apr 30 02:13:15 2021 +0000

description:
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:

 sys/dev/ofisa/files.ofisa |   5 ++++-
 sys/dev/ofisa/ofisa.c     |  20 +++++++++++++++-----
 sys/dev/ofisa/ofisavar.h  |   6 +++++-
 3 files changed, 24 insertions(+), 7 deletions(-)

diffs (98 lines):

diff -r 25fe296dfdf7 -r ab513d63d9f8 sys/dev/ofisa/files.ofisa
--- a/sys/dev/ofisa/files.ofisa Fri Apr 30 02:11:37 2021 +0000
+++ b/sys/dev/ofisa/files.ofisa Fri Apr 30 02:13:15 2021 +0000
@@ -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 -r 25fe296dfdf7 -r ab513d63d9f8 sys/dev/ofisa/ofisa.c
--- a/sys/dev/ofisa/ofisa.c     Fri Apr 30 02:11:37 2021 +0000
+++ b/sys/dev/ofisa/ofisa.c     Fri Apr 30 02:13:15 2021 +0000
@@ -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 @@
 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);
 
+CFATTACH_DECL_NEW(ofisa_subclass, 0,
+    ofisa_subclass_match, ofisaattach, NULL, NULL);
+
 extern struct cfdriver ofisa_cd;
 
-static int     ofisaprint(void *, const char *);
-
-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)
 {
diff -r 25fe296dfdf7 -r ab513d63d9f8 sys/dev/ofisa/ofisavar.h
--- a/sys/dev/ofisa/ofisavar.h  Fri Apr 30 02:11:37 2021 +0000
+++ b/sys/dev/ofisa/ofisavar.h  Fri Apr 30 02:13:15 2021 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index