Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/sommerfeld_i386mp_1]: src/sys/arch/i386 - Disable Interrput before execu...
details: https://anonhg.NetBSD.org/src/rev/af5f5026214a
branches: sommerfeld_i386mp_1
changeset: 482566:af5f5026214a
user: kanaoka <kanaoka%NetBSD.org@localhost>
date: Thu Jul 18 12:05:13 2002 +0000
description:
- Disable Interrput before execute AcpiEnterSleepState().
- Add acpi_md_OsDisableInterrupt() for this.
diffstat:
sys/arch/i386/i386/acpi_machdep.c | 200 +++++++++++++++++++++++++++++++++++
sys/arch/i386/include/acpi_machdep.h | 75 +++++++++++++
2 files changed, 275 insertions(+), 0 deletions(-)
diffs (283 lines):
diff -r 42606e183141 -r af5f5026214a sys/arch/i386/i386/acpi_machdep.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/i386/acpi_machdep.c Thu Jul 18 12:05:13 2002 +0000
@@ -0,0 +1,200 @@
+/* $NetBSD: acpi_machdep.c,v 1.4.2.2 2002/07/18 12:05:13 kanaoka Exp $ */
+
+/*
+ * Copyright 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Machine-dependent routines for ACPICA.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.4.2.2 2002/07/18 12:05:13 kanaoka Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/bus.h>
+#include <machine/cpufunc.h>
+
+#include <dev/acpi/acpica.h>
+#include <dev/acpi/acpivar.h>
+
+#include <machine/acpi_machdep.h>
+
+#include <dev/pci/pcivar.h>
+
+#include <dev/isa/isareg.h>
+#include <dev/isa/isavar.h>
+
+ACPI_STATUS
+acpi_md_OsInitialize(void)
+{
+
+ /* Nothing to do, yet. */
+ return (AE_OK);
+}
+
+ACPI_STATUS
+acpi_md_OsTerminate(void)
+{
+
+ /* Nothing to do, yet. */
+ return (AE_OK);
+}
+
+ACPI_STATUS
+acpi_md_OsGetRootPointer(UINT32 Flags, ACPI_POINTER *PhysicalAddress)
+{
+
+ return (AcpiFindRootPointer(Flags, PhysicalAddress));
+}
+
+ACPI_STATUS
+acpi_md_OsInstallInterruptHandler(UINT32 InterruptNumber,
+ OSD_HANDLER ServiceRoutine, void *Context, void **cookiep)
+{
+ void *ih;
+
+ /*
+ * XXX We currently just use InterruptNumber as a
+ * "pre-mapped" PCI IRQ -- double-check that this
+ * is OK (talk to Sommerfeld).
+ */
+ ih = pci_intr_establish(NULL, InterruptNumber, IPL_HIGH /* XXX */,
+ (int (*)(void *)) ServiceRoutine, Context);
+ if (ih == NULL)
+ return (AE_NO_MEMORY);
+ *cookiep = ih;
+ return (AE_OK);
+}
+
+void
+acpi_md_OsRemoveInterruptHandler(void *cookie)
+{
+
+ pci_intr_disestablish(NULL, cookie);
+}
+
+ACPI_STATUS
+acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress,
+ UINT32 Length, void **LogicalAddress)
+{
+
+ if (_i386_memio_map(I386_BUS_SPACE_MEM, PhysicalAddress, Length,
+ 0, (bus_space_handle_t *) LogicalAddress) == 0)
+ return (AE_OK);
+
+ return (AE_NO_MEMORY);
+}
+
+void
+acpi_md_OsUnmapMemory(void *LogicalAddress, UINT32 Length)
+{
+
+ (void) _i386_memio_unmap(I386_BUS_SPACE_MEM,
+ (bus_space_handle_t) LogicalAddress, Length, NULL);
+}
+
+ACPI_STATUS
+acpi_md_OsGetPhysicalAddress(void *LogicalAddress,
+ ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
+{
+ paddr_t pa;
+
+ if (pmap_extract(pmap_kernel(), (vaddr_t) LogicalAddress, &pa)) {
+ *PhysicalAddress = pa;
+ return (AE_OK);
+ }
+
+ return (AE_ERROR);
+}
+
+BOOLEAN
+acpi_md_OsReadable(void *Pointer, UINT32 Length)
+{
+ BOOLEAN rv = TRUE;
+ vaddr_t sva, eva;
+ pt_entry_t *pte;
+
+ sva = trunc_page((vaddr_t) Pointer);
+ eva = round_page((vaddr_t) Pointer + Length);
+
+ if (sva < VM_MIN_KERNEL_ADDRESS)
+ return (FALSE);
+
+ for (; sva < eva; sva += PAGE_SIZE) {
+ pte = kvtopte(sva);
+ if ((*pte & PG_V) == 0) {
+ rv = FALSE;
+ break;
+ }
+ }
+
+ return (rv);
+}
+
+BOOLEAN
+acpi_md_OsWritable(void *Pointer, UINT32 Length)
+{
+ BOOLEAN rv = FALSE;
+ vaddr_t sva, eva;
+ pt_entry_t *pte;
+
+ sva = trunc_page((vaddr_t) Pointer);
+ eva = round_page((vaddr_t) Pointer + Length);
+
+ if (sva < VM_MIN_KERNEL_ADDRESS)
+ return (FALSE);
+
+ for (; sva < eva; sva += PAGE_SIZE) {
+ pte = kvtopte(sva);
+ if ((*pte & (PG_V|PG_W)) != (PG_V|PG_W)) {
+ rv = FALSE;
+ break;
+ }
+ }
+
+ return (rv);
+}
+
+void
+acpi_md_OsDisableInterrupt(void)
+{
+ disable_intr();
+}
+
diff -r 42606e183141 -r af5f5026214a sys/arch/i386/include/acpi_machdep.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/include/acpi_machdep.h Thu Jul 18 12:05:13 2002 +0000
@@ -0,0 +1,75 @@
+/* $NetBSD: acpi_machdep.h,v 1.5.2.2 2002/07/18 12:05:13 kanaoka Exp $ */
+
+/*
+ * Copyright 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Machine-dependent code for ACPI. This is provided to the Osd
+ * portion of the ACPICA.
+ */
+
+#include <machine/pio.h>
+
+ACPI_STATUS acpi_md_OsInitialize(void);
+ACPI_STATUS acpi_md_OsTerminate(void);
+ACPI_STATUS acpi_md_OsGetRootPointer(UINT32, ACPI_POINTER *);
+
+#define acpi_md_OsIn8(x) inb((x))
+#define acpi_md_OsIn16(x) inw((x))
+#define acpi_md_OsIn32(x) inl((x))
+
+#define acpi_md_OsOut8(x, v) outb((x), (v))
+#define acpi_md_OsOut16(x, v) outw((x), (v))
+#define acpi_md_OsOut32(x, v) outl((x), (v))
+
+ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32, OSD_HANDLER, void *,
+ void **);
+void acpi_md_OsRemoveInterruptHandler(void *);
+
+ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **);
+void acpi_md_OsUnmapMemory(void *, UINT32);
+ACPI_STATUS acpi_md_OsGetPhysicalAddress(void *LogicalAddress,
+ ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
+
+BOOLEAN acpi_md_OsReadable(void *, UINT32);
+BOOLEAN acpi_md_OsWritable(void *, UINT32);
+void acpi_md_OsDisableInterrupt(void);
+
+int acpi_md_sleep(int);
+
+#ifdef ACPI_MACHDEP_PRIVATE
+u_int32_t acpi_md_get_npages_of_wakecode(void);
+void acpi_md_install_wakecode(paddr_t);
+#endif
Home |
Main Index |
Thread Index |
Old Index