Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/cardbus Change cardbus API. The first argument of c...



details:   https://anonhg.NetBSD.org/src/rev/ea38044ffb2b
branches:  trunk
changeset: 477670:ea38044ffb2b
user:      haya <haya%NetBSD.org@localhost>
date:      Wed Oct 27 10:04:41 1999 +0000

description:
Change cardbus API.  The first argument of cardbus_mapreg_map() is
changed to struct cardbus_softc * from cardbus_devfunc_t.  The old
function is renamed to Cardbus_mapreg_map().

diffstat:

 sys/dev/cardbus/cardbus_map.c   |  28 +++++++++++++++-------------
 sys/dev/cardbus/cardbusvar.h    |   9 +++++++--
 sys/dev/cardbus/if_ex_cardbus.c |  12 ++++--------
 sys/dev/cardbus/ohci_cardbus.c  |  10 +++-------
 4 files changed, 29 insertions(+), 30 deletions(-)

diffs (192 lines):

diff -r 68671fa7a530 -r ea38044ffb2b sys/dev/cardbus/cardbus_map.c
--- a/sys/dev/cardbus/cardbus_map.c     Wed Oct 27 09:29:18 1999 +0000
+++ b/sys/dev/cardbus/cardbus_map.c     Wed Oct 27 10:04:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cardbus_map.c,v 1.3 1999/10/15 10:59:57 augustss Exp $ */
+/*     $NetBSD: cardbus_map.c,v 1.4 1999/10/27 10:04:41 haya Exp $     */
 
 /*
  * Copyright (c) 1999
@@ -220,7 +220,7 @@
 
 
 /*
- * int cardbus_mapreg_map(cardbus_devfunc_t, int, cardbusreg_t,
+ * int cardbus_mapreg_map(struct cardbus_softc *, int, int, cardbusreg_t,
  *                       int bus_space_tag_t *, bus_space_handle_t *,
  *                       bus_addr_t *, bus_size_t *)
  *    This function maps bus-space on the value of Base Address
@@ -230,17 +230,17 @@
  *   written on the BAR.
  */
 int
-cardbus_mapreg_map(ct, reg, type, busflags, tagp, handlep, basep, sizep)
-     cardbus_devfunc_t ct;
-     int reg, busflags;
+cardbus_mapreg_map(sc, func, reg, type, busflags, tagp, handlep, basep, sizep)
+     struct cardbus_softc *sc;
+     int func, reg, busflags;
      cardbusreg_t type;
      bus_space_tag_t *tagp;
      bus_space_handle_t *handlep;
      bus_addr_t *basep;
      bus_size_t *sizep;
 {
-  cardbus_chipset_tag_t cc = ct->ct_cc;
-  cardbus_function_tag_t cf = ct->ct_cf;
+  cardbus_chipset_tag_t cc = sc->sc_cc;
+  cardbus_function_tag_t cf = sc->sc_cf;
   bus_space_tag_t bustag;
 #if rbus
   rbus_tag_t rbustag;
@@ -251,26 +251,26 @@
   int flags;
   int status = 0;
 
-  cardbustag_t tag = cardbus_make_tag(cc, cf, ct->ct_bus, ct->ct_dev, ct->ct_func);
+  cardbustag_t tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, func);
 
-  DPRINTF(("cardbus_mapreg_map called: %s %x\n", ct->ct_sc->sc_dev.dv_xname,
+  DPRINTF(("cardbus_mapreg_map called: %s %x\n", sc->sc_dev.dv_xname,
           type));
 
   if (PCI_MAPREG_TYPE(type) == PCI_MAPREG_TYPE_IO) {
     if (cardbus_io_find(cc, cf, tag, reg, type, &base, &size, &flags)) {
       status = 1;
     }
-    bustag = ct->ct_sc->sc_iot;
+    bustag = sc->sc_iot;
 #if rbus
-    rbustag = ct->ct_sc->sc_rbus_iot;
+    rbustag = sc->sc_rbus_iot;
 #endif
   } else {
     if (cardbus_mem_find(cc, cf, tag, reg, type, &base, &size, &flags)){
       status = 1;
     }
-    bustag = ct->ct_sc->sc_memt;
+    bustag = sc->sc_memt;
 #if rbus
-    rbustag = ct->ct_sc->sc_rbus_memt;
+    rbustag = sc->sc_rbus_memt;
 #endif
   }
   if (status == 0) {
@@ -311,6 +311,8 @@
   if (sizep != 0) {
     *sizep = size;
   }
+  cardbus_free_tag(cc, cf, tag);
+
   return 0;
 }
 
diff -r 68671fa7a530 -r ea38044ffb2b sys/dev/cardbus/cardbusvar.h
--- a/sys/dev/cardbus/cardbusvar.h      Wed Oct 27 09:29:18 1999 +0000
+++ b/sys/dev/cardbus/cardbusvar.h      Wed Oct 27 10:04:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cardbusvar.h,v 1.3 1999/10/15 11:10:58 augustss Exp $  */
+/*     $NetBSD: cardbusvar.h,v 1.4 1999/10/27 10:04:41 haya Exp $      */
 
 /*
  * Copyright (c) 1998 and 1999
@@ -384,7 +384,7 @@
 void *cardbus_intr_establish __P((cardbus_chipset_tag_t, cardbus_function_tag_t, cardbus_intr_handle_t irq, int level, int (*func) (void *), void *arg));
 void cardbus_intr_disestablish __P((cardbus_chipset_tag_t, cardbus_function_tag_t, void *handler));
 
-int cardbus_mapreg_map __P((cardbus_devfunc_t, int, cardbusreg_t,
+int cardbus_mapreg_map __P((struct cardbus_softc *, int, int, cardbusreg_t,
                            int, bus_space_tag_t *, bus_space_handle_t *,
                            bus_addr_t *, bus_size_t *));
 
@@ -394,10 +394,15 @@
 int cardbus_function_enable __P((cardbus_devfunc_t));
 int cardbus_function_disable __P((cardbus_devfunc_t));
 
+#define Cardbus_mapreg_map(ct, reg, type, busflags, tagp, handlep, basep, sizep) \
+       cardbus_mapreg_map((ct)->ct_sc, (ct->ct_func), (reg), (type),\
+                          (busflags), (tagp), (handlep), (basep), (sizep))
+
 #define Cardbus_make_tag(ct) (*(ct)->ct_cf->cardbus_make_tag)((ct)->ct_cc, (ct)->ct_bus, (ct)->ct_dev, (ct)->ct_func)
 #define cardbus_make_tag(cc, cf, bus, device, function) ((cf)->cardbus_make_tag)((cc), (bus), (device), (function))
 
 #define Cardbus_free_tag(ct, tag) (*(ct)->ct_cf->cardbus_free_tag)((ct)->ct_cc, (tag))
+#define cardbus_free_tag(cc, cf, tag) (*(cf)->cardbus_free_tag)(cc, (tag))
 
 #define Cardbus_conf_read(ct, tag, offs) (*(ct)->ct_cf->cardbus_conf_read)((ct)->ct_cf, (tag), (offs))
 #define cardbus_conf_read(cc, cf, tag, offs) ((cf)->cardbus_conf_read)((cc), (tag), (offs))
diff -r 68671fa7a530 -r ea38044ffb2b sys/dev/cardbus/if_ex_cardbus.c
--- a/sys/dev/cardbus/if_ex_cardbus.c   Wed Oct 27 09:29:18 1999 +0000
+++ b/sys/dev/cardbus/if_ex_cardbus.c   Wed Oct 27 10:04:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ex_cardbus.c,v 1.4 1999/10/25 19:18:10 drochner Exp $       */
+/*     $NetBSD: if_ex_cardbus.c,v 1.5 1999/10/27 10:04:41 haya Exp $   */
 
 /*
  * CardBus specific routines for 3Com 3C575-family CardBus ethernet adapter
@@ -72,13 +72,9 @@
 #if defined pciinc
 #include <dev/pci/pcidevs.h>
 #endif
-#if pccard
-#include <dev/pccard/cardbusvar.h>
-#include <dev/pccard/pccardcis.h>
-#else
+
 #include <dev/cardbus/cardbusvar.h>
 #include <dev/cardbus/cardbusdevs.h>
-#endif
 
 #include <dev/mii/miivar.h>
 
@@ -187,7 +183,7 @@
   bus_addr_t adr;
 
 
-  if (cardbus_mapreg_map(ct, CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO, 0,
+  if (Cardbus_mapreg_map(ct, CARDBUS_BASE0_REG, CARDBUS_MAPREG_TYPE_IO, 0,
                         &(sc->sc_iot), &ioh, &adr, NULL)) {
     panic("io alloc in ex_attach_cardbus\n");
   }
@@ -216,7 +212,7 @@
                CARDBUS_COMMAND_MEM_ENABLE | CARDBUS_COMMAND_MASTER_ENABLE);
 
     /* Cardbus function status window */
-    if (cardbus_mapreg_map(ct, CARDBUS_3C575BTX_FUNCSTAT_PCIREG,
+    if (Cardbus_mapreg_map(ct, CARDBUS_3C575BTX_FUNCSTAT_PCIREG,
                           CARDBUS_MAPREG_TYPE_MEM, 0,
                           &psc->sc_funct, &psc->sc_funch, 0, NULL)) {
       panic("mem alloc in ex_attach_cardbus\n");
diff -r 68671fa7a530 -r ea38044ffb2b sys/dev/cardbus/ohci_cardbus.c
--- a/sys/dev/cardbus/ohci_cardbus.c    Wed Oct 27 09:29:18 1999 +0000
+++ b/sys/dev/cardbus/ohci_cardbus.c    Wed Oct 27 10:04:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci_cardbus.c,v 1.1 1999/10/15 11:52:45 augustss Exp $        */
+/*     $NetBSD: ohci_cardbus.c,v 1.2 1999/10/27 10:04:41 haya Exp $    */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -56,13 +56,9 @@
 #if defined pciinc
 #include <dev/pci/pcidevs.h>
 #endif
-#if pccard
-#include <dev/pccard/cardbusvar.h>
-#include <dev/pccard/pccardcis.h>
-#else
+
 #include <dev/cardbus/cardbusvar.h>
 #include <dev/cardbus/cardbusdevs.h>
-#endif
 
 #include <dev/usb/usb.h>
 #include <dev/usb/usbdi.h>
@@ -132,7 +128,7 @@
               CARDBUS_REVISION(ca->ca_class));
 
        /* Map I/O registers */
-       if (cardbus_mapreg_map(ct, CARDBUS_CBMEM, CARDBUS_MAPREG_TYPE_MEM, 0,
+       if (Cardbus_mapreg_map(ct, CARDBUS_CBMEM, CARDBUS_MAPREG_TYPE_MEM, 0,
                           &sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc_size)) {
                printf("%s: can't map mem space\n", devname);
                return;



Home | Main Index | Thread Index | Old Index