Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/dreamcast Implement pci_decompose_tag().



details:   https://anonhg.NetBSD.org/src/rev/4a79c6a8c36b
branches:  trunk
changeset: 527003:4a79c6a8c36b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed May 15 17:09:04 2002 +0000

description:
Implement pci_decompose_tag().

diffstat:

 sys/arch/dreamcast/dev/g2/gapspci_pci.c  |  29 ++++++++++++++++++++++++++++-
 sys/arch/dreamcast/include/pci_machdep.h |   6 +++++-
 2 files changed, 33 insertions(+), 2 deletions(-)

diffs (84 lines):

diff -r 9ead3bb8b915 -r 4a79c6a8c36b sys/arch/dreamcast/dev/g2/gapspci_pci.c
--- a/sys/arch/dreamcast/dev/g2/gapspci_pci.c   Wed May 15 16:57:41 2002 +0000
+++ b/sys/arch/dreamcast/dev/g2/gapspci_pci.c   Wed May 15 17:09:04 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gapspci_pci.c,v 1.3 2002/03/24 18:21:24 uch Exp $      */
+/*     $NetBSD: gapspci_pci.c,v 1.4 2002/05/15 17:09:04 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -57,6 +57,7 @@
                    struct pcibus_attach_args *);
 int            gaps_bus_maxdevs(void *, int);
 pcitag_t       gaps_make_tag(void *, int, int, int);
+void           gaps_decompose_tag(void *, pcitag_t, int *, int *, int *);
 pcireg_t       gaps_conf_read(void *, pcitag_t, int);
 void           gaps_conf_write(void *, pcitag_t, int, pcireg_t);
 
@@ -76,6 +77,7 @@
        pc->pc_attach_hook = gaps_attach_hook;
        pc->pc_bus_maxdevs = gaps_bus_maxdevs;
        pc->pc_make_tag = gaps_make_tag;
+       pc->pc_decompose_tag = gaps_decompose_tag;
        pc->pc_conf_read = gaps_conf_read;
        pc->pc_conf_write = gaps_conf_write;
        pc->pc_conf_v = sc;
@@ -126,6 +128,31 @@
        return (0);
 }
 
+void
+gaps_decompose_tag(void *v, pcitag_t tag, int *bp, int *dp, int *fp)
+{
+       int b, d, f;
+
+       if (tag == GAPS_PCITAG_MAGIC)
+               b = d = f = 0;
+       else {
+               /*
+                * Invalid for GAPS.  These values ensure that a valid
+                * tag cannot be built.
+                */
+               b = 0xff;
+               d = 0x1f;
+               f = 0x7;
+       }
+
+       if (bp != NULL)
+               *bp = b;
+       if (dp != NULL)
+               *dp = d;
+       if (fp != NULL)
+               *fp = f;
+}
+
 pcireg_t
 gaps_conf_read(void *v, pcitag_t tag, int reg)
 {
diff -r 9ead3bb8b915 -r 4a79c6a8c36b sys/arch/dreamcast/include/pci_machdep.h
--- a/sys/arch/dreamcast/include/pci_machdep.h  Wed May 15 16:57:41 2002 +0000
+++ b/sys/arch/dreamcast/include/pci_machdep.h  Wed May 15 17:09:04 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.h,v 1.1 2001/01/31 18:38:26 thorpej Exp $  */
+/*     $NetBSD: pci_machdep.h,v 1.2 2002/05/15 17:09:05 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -58,6 +58,8 @@
                             struct device *, struct pcibus_attach_args *);
         int             (*pc_bus_maxdevs)(void *, int);
         pcitag_t        (*pc_make_tag)(void *, int, int, int);
+       void            (*pc_decompose_tag)(void *, pcitag_t, int *,
+                           int *, int *);
         pcireg_t        (*pc_conf_read)(void *, pcitag_t, int);
         void            (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
 
@@ -77,6 +79,8 @@
     (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
 #define pci_make_tag(c, b, d, f)                                        \
     (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
+#define        pci_decompose_tag(c, t, bp, dp, fp)                             \
+    (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
 #define pci_conf_read(c, t, r)                                          \
     (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
 #define pci_conf_write(c, t, r, v)                                      \



Home | Main Index | Thread Index | Old Index