Source-Changes-D archive

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

Re: CVS commit: src/sys



On 09/01/2011 05:10 PM, Christos Zoulas wrote:
Module Name:    src
Committed By:   christos
Date:           Thu Sep  1 15:10:32 UTC 2011

Modified Files:
        src/sys/arch/i386/eisa: eisa_machdep.c
        src/sys/arch/i386/mca: mca_machdep.c
        src/sys/arch/x86/include: bus_private.h
        src/sys/arch/x86/isa: isa_machdep.c
        src/sys/arch/x86/pci: pci_machdep.c
        src/sys/arch/x86/x86: bus_dma.c
        src/sys/arch/xen/xen: isa_machdep.c xpci_xenbus.c
        src/sys/sys: bus.h

Log Message:
Add bus_dma overrides. From dyoung

Should NULL be allowed as first argument of bus_dma_tag_create?
I would prefer for NULL to be allowed to make my life easier in
the drmgem port from OpenBSD.  But maybe requiring non-NULL would
make more sense if this shall be used from MI device drivers only?

+int
+bus_dma_tag_create(bus_dma_tag_t obdt, const uint64_t present,
+    const struct bus_dma_overrides *ov, void *ctx, bus_dma_tag_t *bdtp)
  {
+       uint64_t bit, bits, nbits;
+       bus_dma_tag_t bdt;
+       const void *fp;

-       (*tag->_dmatag_destroy)(tag);
+       if (ov == NULL || present == 0)
+               return EINVAL;
+
+       bdt = kmem_alloc(sizeof(struct x86_bus_dma_tag), KM_SLEEP);
+
+       if (bdt == NULL)
+               return ENOMEM;
+
+       bdt->bdt_super = obdt;
+
+       for (bits = present; bits != 0; bits = nbits) {
+               nbits = bits&  (bits - 1);
+               bit = nbits ^ bits;
+               if ((fp = bit_to_function_pointer(ov, bit)) == NULL) {
+#ifdef DEBUG
+                       printf("%s: missing bit %" PRIx64 "\n", __func__, bit);
+#endif
+                       goto einval;
+               }
+       }
+
+       bdt->bdt_ov = ov;
+       bdt->bdt_exists = obdt->bdt_exists | present;

Here obdt might be NULL.

Note: bus_space_tag_create has the same issue.

Grégoire


Home | Main Index | Thread Index | Old Index