I have included some diffs below that I have been accumulating.

a) sys/dev/acpi/acpi.c & sys/dev/acpi/acpicpu.c

This diff is to support ACPI in a Xen HVM. I posted this previously
(http://marc.info/?l=openbsd-tech&m=128120981015035&w=2), but my
timing was poor - it was late in a release cycle and deemed too
intrusive at the time.

Index: sys/dev/acpi/acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.224
diff -u -p -u -p -r1.224 acpi.c
--- sys/dev/acpi/acpi.c 27 Apr 2011 20:55:42 -0000      1.224
+++ sys/dev/acpi/acpi.c 2 Jun 2011 14:37:44 -0000
@@ -610,15 +610,6 @@ acpi_attach(struct device *parent, struc
        }

        /*
-        * Check if we are able to enable ACPI control
-        */
-       if (!sc->sc_fadt->smi_cmd ||
-           (!sc->sc_fadt->acpi_enable && !sc->sc_fadt->acpi_disable)) {
-               printf(", ACPI control unavailable\n");
-               return;
-       }
-
-       /*
         * Set up a pointer to the firmware control structure
         */
        if (sc->sc_fadt->hdr_revision < 3 || sc->sc_fadt->x_firmware_ctl == 0)
@@ -696,14 +687,18 @@ acpi_attach(struct device *parent, struc
         * This may prevent thermal control on some systems where
         * that actually does work
         */
-       acpi_write_pmreg(sc, ACPIREG_SMICMD, 0, sc->sc_fadt->acpi_enable);
-       idx = 0;
-       do {
-               if (idx++ > ACPIEN_RETRIES) {
-                       printf(", can't enable ACPI\n");
-                       return;
-               }
-       } while (!(acpi_read_pmreg(sc, ACPIREG_PM1_CNT, 0) & ACPI_PM1_SCI_EN));
+       if (sc->sc_fadt->smi_cmd && sc->sc_fadt->acpi_enable) {
+               acpi_write_pmreg(sc, ACPIREG_SMICMD, 0,
+                   sc->sc_fadt->acpi_enable);
+               idx = 0;
+               do {
+                       if (idx++ > ACPIEN_RETRIES) {
+                               printf(", can't enable ACPI\n");
+                               return;
+                       }
+               } while (!(acpi_read_pmreg(sc, ACPIREG_PM1_CNT, 0) &
+                   ACPI_PM1_SCI_EN));
+       }

        printf("\n%s: tables", DEVNAME(sc));
        SIMPLEQ_FOREACH(entry, &sc->sc_tables, q_next) {

Index: sys/dev/acpi/acpicpu.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpicpu.c,v
retrieving revision 1.57
diff -u -p -u -p -r1.57 acpicpu.c
--- sys/dev/acpi/acpicpu.c      21 Jul 2010 19:35:15 -0000      1.57
+++ sys/dev/acpi/acpicpu.c      2 Jun 2011 14:37:44 -0000
@@ -394,7 +394,8 @@ acpicpu_attach(struct device *parent, st
                        sc->sc_flags |= FLAGS_NOPCT;
                else if (sc->sc_pss_len > 0) {
                        /* Notify BIOS we are handing p-states */
-                       if (sc->sc_acpi->sc_fadt->pstate_cnt)
+                       if (sc->sc_acpi->sc_fadt->smi_cmd &&
+                           sc->sc_acpi->sc_fadt->pstate_cnt)
                                acpi_write_pmreg(sc->sc_acpi, ACPIREG_SMICMD, 0,
                                sc->sc_acpi->sc_fadt->pstate_cnt);



b) sys/arch/i386/conf/files.i386

arch/i386/i386/hibernate_machdep.c will not compile without acpi
(requires hibernate_resume_machine etc  from
arch/i386/i386/acpi_wakecode.S).

Index: sys/arch/i386/conf/files.i386
===================================================================
RCS file: /cvs/src/sys/arch/i386/conf/files.i386,v
retrieving revision 1.203
diff -u -p -u -p -r1.203 files.i386
--- sys/arch/i386/conf/files.i386       23 May 2011 09:54:20 -0000      1.203
+++ sys/arch/i386/conf/files.i386       2 Jun 2011 14:37:41 -0000
@@ -24,7 +24,7 @@ file  arch/i386/i386/est.c            !small_kernel
 file   arch/i386/i386/gdt.c
 file   arch/i386/i386/in_cksum.s       inet
 file   arch/i386/i386/machdep.c
-file   arch/i386/i386/hibernate_machdep.c
+file   arch/i386/i386/hibernate_machdep.c      acpi & !small_kernel
 file   arch/i386/i386/via.c
 file   arch/i386/i386/amd64errata.c    !small_kernel
 file   arch/i386/i386/kgdb_machdep.c   kgdb


c) sys/arch/i386/pci/pci_machdep.c

pci_machdep.c will no longer compile without ioapic.

Index: sys/arch/i386/pci/pci_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/pci/pci_machdep.c,v
retrieving revision 1.62
diff -u -p -u -p -r1.62 pci_machdep.c
--- sys/arch/i386/pci/pci_machdep.c     30 May 2011 19:24:28 -0000      1.62
+++ sys/arch/i386/pci/pci_machdep.c     2 Jun 2011 14:37:42 -0000
@@ -587,6 +587,7 @@ not2:
 int
 pci_intr_map_msi(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
 {
+#if NIOAPIC > 0
        pci_chipset_tag_t pc = pa->pa_pc;
        pcitag_t tag = pa->pa_tag;

@@ -598,6 +599,9 @@ pci_intr_map_msi(struct pci_attach_args
        ihp->line = APIC_INT_VIA_MSG;
        ihp->pin = 0;
        return 0;
+#else
+       return 1;
+#endif
 }

 int
@@ -763,6 +767,8 @@ pci_intr_establish(pci_chipset_tag_t pc,
        void *ret;
        int bus, dev;
        int l = ih.line & APIC_INT_LINE_MASK;
+
+#if NIOAPIC > 0
        pcitag_t tag = ih.tag;

        if (ih.line & APIC_INT_VIA_MSG) {
@@ -803,6 +809,7 @@ pci_intr_establish(pci_chipset_tag_t pc,
                pci_conf_write(pc, tag, off, reg | PCI_MSI_MC_MSIE);
                return (ih);
        }
+#endif

        pci_decompose_tag(pc, ih.tag, &bus, &dev, NULL);
 #if NACPIPRT > 0


Nathanael

Reply via email to