Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Add MD functions for establishing and disestablishi...
details: https://anonhg.NetBSD.org/src/rev/8a24f85f4bf4
branches: trunk
changeset: 445900:8a24f85f4bf4
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Nov 16 23:03:55 2018 +0000
description:
Add MD functions for establishing and disestablishing interrupt handlers.
diffstat:
sys/arch/arm/acpi/acpi_machdep.c | 23 +++++++++++------
sys/arch/arm/include/acpi_machdep.h | 5 +++-
sys/arch/ia64/acpi/acpi_machdep.c | 48 +++++++++++++++++++++++++----------
sys/arch/ia64/include/acpi_machdep.h | 6 +++-
sys/arch/x86/acpi/acpi_machdep.c | 25 +++++++++++++++++-
sys/arch/x86/include/acpi_machdep.h | 6 +++-
6 files changed, 86 insertions(+), 27 deletions(-)
diffs (243 lines):
diff -r ef3ce41efda2 -r 8a24f85f4bf4 sys/arch/arm/acpi/acpi_machdep.c
--- a/sys/arch/arm/acpi/acpi_machdep.c Fri Nov 16 20:49:08 2018 +0000
+++ b/sys/arch/arm/acpi/acpi_machdep.c Fri Nov 16 23:03:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.5 2018/11/12 12:56:05 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.6 2018/11/16 23:03:55 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include "pci.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.5 2018/11/12 12:56:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.6 2018/11/16 23:03:55 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -83,12 +83,7 @@
acpi_md_OsInstallInterruptHandler(UINT32 irq, ACPI_OSD_HANDLER handler, void *context,
void **cookiep, const char *xname)
{
- const int ipl = IPL_TTY;
- const int type = IST_LEVEL; /* TODO: MADT */
-
- *cookiep = intr_establish(irq, ipl, type, (int (*)(void *))handler, context);
-
- return *cookiep == NULL ? AE_NO_MEMORY : AE_OK;
+ return AE_NOT_IMPLEMENTED;
}
void
@@ -200,6 +195,18 @@
cpsid(I32_bit);
}
+void *
+acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *), void *arg, bool mpsafe, const char *xname)
+{
+ return intr_establish_xname(irq, ipl, type | (mpsafe ? IST_MPSAFE : 0), handler, arg, xname);
+}
+
+void
+acpi_md_intr_disestablish(void *ih)
+{
+ intr_disestablish(ih);
+}
+
int
acpi_md_sleep(int state)
{
diff -r ef3ce41efda2 -r 8a24f85f4bf4 sys/arch/arm/include/acpi_machdep.h
--- a/sys/arch/arm/include/acpi_machdep.h Fri Nov 16 20:49:08 2018 +0000
+++ b/sys/arch/arm/include/acpi_machdep.h Fri Nov 16 23:03:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.h,v 1.1 2018/10/12 22:12:12 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.h,v 1.2 2018/11/16 23:03:55 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -46,6 +46,9 @@
BOOLEAN acpi_md_OsWritable(void *, UINT32);
void acpi_md_OsEnableInterrupt(void);
void acpi_md_OsDisableInterrupt(void);
+void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *),
+ void *, bool, const char *);
+void acpi_md_intr_disestablish(void *);
int acpi_md_sleep(int);
uint32_t acpi_md_pdc(void);
uint32_t acpi_md_ncpus(void);
diff -r ef3ce41efda2 -r 8a24f85f4bf4 sys/arch/ia64/acpi/acpi_machdep.c
--- a/sys/arch/ia64/acpi/acpi_machdep.c Fri Nov 16 20:49:08 2018 +0000
+++ b/sys/arch/ia64/acpi/acpi_machdep.c Fri Nov 16 23:03:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.7 2018/03/20 12:14:52 bouyer Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.8 2018/11/16 23:03:55 jmcneill Exp $ */
/*
* Copyright (c) 2009 KIYOHARA Takashi
* All rights reserved.
@@ -28,7 +28,7 @@
* Machine-dependent routines for ACPICA.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.7 2018/03/20 12:14:52 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.8 2018/11/16 23:03:55 jmcneill Exp $");
#include <sys/param.h>
@@ -74,29 +74,34 @@
return acpi_root_phys;
}
-ACPI_STATUS
-acpi_md_OsInstallInterruptHandler(UINT32 InterruptNumber,
- ACPI_OSD_HANDLER ServiceRoutine,
- void *Context, void **cookiep,
- const char *xname)
+static int
+acpi_isa_irq_to_vector(UINT32 irq)
{
static int isa_irq_to_vector_map[16] = {
/* i8259 IRQ translation, first 16 entries */
0x2f, 0x20, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29,
0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21,
};
- int irq;
- void *ih;
+
+ if (has_i8259 && irq < 16)
+ return isa_irq_to_vector_map[InterruptNumber];
+
+ return irq;
+}
- if (has_i8259 && InterruptNumber < 16)
- irq = isa_irq_to_vector_map[InterruptNumber];
- else
- irq = InterruptNumber;
+ACPI_STATUS
+acpi_md_OsInstallInterruptHandler(UINT32 InterruptNumber,
+ ACPI_OSD_HANDLER ServiceRoutine,
+ void *Context, void **cookiep,
+ const char *xname)
+{
+ const int vec = acpi_isa_irq_to_vector(irq);
+ void *ih;
/*
* XXX probably, IPL_BIO is enough.
*/
- ih = intr_establish(irq, IST_LEVEL, IPL_TTY,
+ ih = intr_establish(vec, IST_LEVEL, IPL_TTY,
(int (*)(void *)) ServiceRoutine, Context);
if (ih == NULL)
return AE_NO_MEMORY;
@@ -111,6 +116,21 @@
intr_disestablish(cookie);
}
+void *
+acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *),
+ void *arg, bool mpsafe, const char *xname)
+{
+ const int vec = acpi_isa_irq_to_vector(irq);
+
+ return intr_establish(vec, type, ipl, handler, arg);
+}
+
+void
+acpi_md_intr_disestablish(void *ih)
+{
+ intr_disestablish(ih);
+}
+
ACPI_STATUS
acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, UINT32 Length,
void **LogicalAddress)
diff -r ef3ce41efda2 -r 8a24f85f4bf4 sys/arch/ia64/include/acpi_machdep.h
--- a/sys/arch/ia64/include/acpi_machdep.h Fri Nov 16 20:49:08 2018 +0000
+++ b/sys/arch/ia64/include/acpi_machdep.h Fri Nov 16 23:03:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.h,v 1.7 2018/03/20 12:14:52 bouyer Exp $ */
+/* $NetBSD: acpi_machdep.h,v 1.8 2018/11/16 23:03:55 jmcneill Exp $ */
ACPI_STATUS acpi_md_OsInitialize(void);
ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void);
@@ -25,6 +25,10 @@
void acpi_md_OsEnableInterrupt(void);
void acpi_md_OsDisableInterrupt(void);
+void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *),
+ void *, bool, const char *);
+void acpi_md_intr_disestablish(void *);
+
int acpi_md_sleep(int);
uint32_t acpi_md_pdc(void);
uint32_t acpi_md_ncpus(void);
diff -r ef3ce41efda2 -r 8a24f85f4bf4 sys/arch/x86/acpi/acpi_machdep.c
--- a/sys/arch/x86/acpi/acpi_machdep.c Fri Nov 16 20:49:08 2018 +0000
+++ b/sys/arch/x86/acpi/acpi_machdep.c Fri Nov 16 23:03:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.19 2018/03/20 12:14:52 bouyer Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.20 2018/11/16 23:03:55 jmcneill Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.19 2018/03/20 12:14:52 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.20 2018/11/16 23:03:55 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -265,6 +265,27 @@
intr_disestablish(cookie);
}
+void *
+acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *),
+ void *arg, bool mpsafe, const char *xname)
+{
+ struct pic *pic;
+ int pin;
+
+ pic = intr_findpic(irq);
+ if (pic == NULL)
+ return NULL;
+ pin = irq - pic->pic_vecbase;
+
+ return intr_establish_xname(irq, pic, pin, type, ipl, handler, arg, mpsafe, xname);
+}
+
+void
+acpi_md_intr_disestablish(void *ih)
+{
+ intr_disestablish(ih);
+}
+
ACPI_STATUS
acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress,
uint32_t Length, void **LogicalAddress)
diff -r ef3ce41efda2 -r 8a24f85f4bf4 sys/arch/x86/include/acpi_machdep.h
--- a/sys/arch/x86/include/acpi_machdep.h Fri Nov 16 20:49:08 2018 +0000
+++ b/sys/arch/x86/include/acpi_machdep.h Fri Nov 16 23:03:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.h,v 1.12 2018/03/20 12:14:52 bouyer Exp $ */
+/* $NetBSD: acpi_machdep.h,v 1.13 2018/11/16 23:03:55 jmcneill Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -70,6 +70,10 @@
void acpi_md_OsDisableInterrupt(void);
void acpi_md_OsEnableInterrupt(void);
+void * acpi_md_intr_establish(uint32_t, int, int, int (*)(void *),
+ void *, bool, const char *);
+void acpi_md_intr_disestablish(void *);
+
int acpi_md_sleep(int);
void acpi_md_sleep_init(void);
Home |
Main Index |
Thread Index |
Old Index