Current-Users archive

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

[PATCH] ACPI relation patchs



Hi! all,


I make two patchs.
  1. ACPI resource support Extended IRQ.
     (From FreeBSD)
  2. com@acpi support memory space.


port-ia64 users needs this fix.  ;-)



By the way, I looks like the 'sc->sc_regs.cr_iot' seems not to be
initialized here.  Maybe it is initializing in macro COM_INIT_REGS().

-----
                goto out;
        }

        if (!com_is_console(aa->aa_iot, io->ar_base, &ioh)) {
                if (bus_space_map(sc->sc_regs.cr_iot, io->ar_base, 
io->ar_length,
                    0, &ioh)) {
                        aprint_error_dev(self, "can't map i/o space\n");
                        goto out;
                }
        }
        COM_INIT_REGS(sc->sc_regs, aa->aa_iot, ioh, io->ar_base);

        aprint_normal("%s", device_xname(self));

-----


Thanks,
--
kiyohara
Index: acpi_resource.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_resource.c,v
retrieving revision 1.27
diff -u -r1.27 acpi_resource.c
--- acpi_resource.c     17 Feb 2009 12:46:01 -0000      1.27
+++ acpi_resource.c     14 Apr 2009 12:11:03 -0000
@@ -297,8 +297,20 @@
                break;
 
        case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
-               ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
-                                    "ExtendedIrq unimplemented\n"));
+               if (res->Data.ExtendedIrq.ProducerConsumer != ACPI_CONSUMER) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+                           "ignored ExtIRQ producer\n"));
+                       break;
+               }
+               for (i = 0; i < res->Data.ExtendedIrq.InterruptCount; i++) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+                                    "ExtIRQ %d\n",
+                                    res->Data.ExtendedIrq.Interrupts[i]));
+                       if (ops->irq)
+                               (*ops->irq)(arg->dev, arg->context,
+                                   res->Data.ExtendedIrq.Interrupts[i],
+                                   res->Data.ExtendedIrq.Triggering);
+               }
                break;
 
        case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
Index: com_acpi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/com_acpi.c,v
retrieving revision 1.28
diff -u -r1.28 com_acpi.c
--- com_acpi.c  17 Feb 2009 12:46:01 -0000      1.28
+++ com_acpi.c  14 Apr 2009 12:11:03 -0000
@@ -100,8 +100,12 @@
        struct acpi_attach_args *aa = aux;
        struct acpi_resources res;
        struct acpi_io *io;
+       struct acpi_mem *mem;
        struct acpi_irq *irq;
+       bus_space_tag_t iot;
        bus_space_handle_t ioh;
+       bus_addr_t base;
+       bus_size_t size;
        ACPI_STATUS rv;
 
        sc->sc_dev = self;
@@ -114,10 +118,21 @@
 
        /* find our i/o registers */
        io = acpi_res_io(&res, 0);
-       if (io == NULL) {
-               aprint_error_dev(self,
-                   "unable to find i/o register resource\n");
-               goto out;
+       if (io != NULL) {
+               iot = aa->aa_iot;
+               base = io->ar_base;
+               size = io->ar_length;
+       } else {
+               mem = acpi_res_mem(&res, 0);
+               if (mem != NULL) {
+                       iot = aa->aa_memt;
+                       base = mem->ar_base;
+                       size = mem->ar_length;
+               } else {
+                       aprint_error_dev(self,
+                           "unable to find i/o register and memory 
resource\n");
+                       goto out;
+               }
        }
 
        /* find our IRQ */
@@ -127,14 +142,12 @@
                goto out;
        }
 
-       if (!com_is_console(aa->aa_iot, io->ar_base, &ioh)) {
-               if (bus_space_map(sc->sc_regs.cr_iot, io->ar_base, 
io->ar_length,
-                   0, &ioh)) {
+       if (!com_is_console(iot, base, &ioh))
+               if (bus_space_map(iot, base, size, 0, &ioh)) {
                        aprint_error_dev(self, "can't map i/o space\n");
                        goto out;
                }
-       }
-       COM_INIT_REGS(sc->sc_regs, aa->aa_iot, ioh, io->ar_base);
+       COM_INIT_REGS(sc->sc_regs, iot, ioh, base);
 
        aprint_normal("%s", device_xname(self));
 


Home | Main Index | Thread Index | Old Index