When I added support for sdhc@acpi I made an ugly hack and directly
referenced the bus dma tag in a MD-specific fashion.  That is not
going to work for arm64.  And for arm64 I'll be needing the tag a lot
more.  So set it in amd64/i386-specific code and pass it down.

ok?


Index: dev/acpi/acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.345
diff -u -p -r1.345 acpi.c
--- dev/acpi/acpi.c     25 Jun 2018 22:33:24 -0000      1.345
+++ dev/acpi/acpi.c     25 Jun 2018 23:02:46 -0000
@@ -240,6 +240,7 @@ acpi_attach(struct device *parent, struc
 
        sc->sc_iot = ba->ba_iot;
        sc->sc_memt = ba->ba_memt;
+       sc->sc_dmat = &pci_bus_dma_tag;
 
        acpi_attach_common(sc, ba->ba_acpipbase);
 }
@@ -3006,6 +3007,7 @@ acpi_foundhid(struct aml_node *node, voi
        memset(&aaa, 0, sizeof(aaa));
        aaa.aaa_iot = sc->sc_iot;
        aaa.aaa_memt = sc->sc_memt;
+       aaa.aaa_dmat = sc->sc_dmat;
        aaa.aaa_node = node->parent;
        aaa.aaa_dev = dev;
 
Index: dev/acpi/acpivar.h
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpivar.h,v
retrieving revision 1.91
diff -u -p -r1.91 acpivar.h
--- dev/acpi/acpivar.h  25 Jun 2018 22:33:24 -0000      1.91
+++ dev/acpi/acpivar.h  25 Jun 2018 23:02:46 -0000
@@ -57,6 +57,7 @@ struct acpi_attach_args {
        char            *aaa_name;
        bus_space_tag_t  aaa_iot;
        bus_space_tag_t  aaa_memt;
+       bus_dma_tag_t    aaa_dmat;
        void            *aaa_table;
        struct aml_node *aaa_node;
        const char      *aaa_dev;
@@ -204,10 +205,7 @@ struct acpi_softc {
 
        bus_space_tag_t         sc_iot;
        bus_space_tag_t         sc_memt;
-#if 0
-       bus_space_tag_t         sc_pcit;
-       bus_space_tag_t         sc_smbust;
-#endif
+       bus_dma_tag_t           sc_dmat;
 
        /*
         * First-level ACPI tables
Index: dev/acpi/sdhc_acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/sdhc_acpi.c,v
retrieving revision 1.11
diff -u -p -r1.11 sdhc_acpi.c
--- dev/acpi/sdhc_acpi.c        22 May 2018 21:17:13 -0000      1.11
+++ dev/acpi/sdhc_acpi.c        25 Jun 2018 23:02:46 -0000
@@ -29,8 +29,6 @@
 #include <dev/sdmmc/sdhcvar.h>
 #include <dev/sdmmc/sdmmcvar.h>
 
-extern struct bus_dma_tag pci_bus_dma_tag;
-
 struct sdhc_acpi_softc {
        struct sdhc_softc sc;
        struct acpi_softc *sc_acpi;
@@ -142,7 +140,7 @@ sdhc_acpi_attach(struct device *parent, 
        sdhc_acpi_explore(sc);
 
        sc->sc.sc_host = &sc->sc_host;
-       sc->sc.sc_dmat = &pci_bus_dma_tag;
+       sc->sc.sc_dmat = aaa->aaa_dmat;
        sdhc_host_found(&sc->sc, sc->sc_memt, sc->sc_memh, sc->sc_size, 1, 0);
 }
 

Reply via email to