summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-12-11 15:56:30 +0000
committerjhb <jhb@FreeBSD.org>2008-12-11 15:56:30 +0000
commit160f4765ebc806001eb215709142b3b083b75c15 (patch)
tree69921b69da19ea4249fabb1eac32dbb38ce1ea79 /sys/i386
parent200cc006cbe7c03477d4ce44111850ef854df2d0 (diff)
downloadFreeBSD-src-160f4765ebc806001eb215709142b3b083b75c15.zip
FreeBSD-src-160f4765ebc806001eb215709142b3b083b75c15.tar.gz
Add constants for fields in the local APIC error status register and a
routine to read it.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/local_apic.c13
-rw-r--r--sys/i386/include/apicreg.h8
-rw-r--r--sys/i386/include/apicvar.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/sys/i386/i386/local_apic.c b/sys/i386/i386/local_apic.c
index 7b742db..2394e20 100644
--- a/sys/i386/i386/local_apic.c
+++ b/sys/i386/i386/local_apic.c
@@ -301,6 +301,7 @@ lapic_setup(int boot)
/* Program LINT[01] LVT entries. */
lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
+
#ifdef HWPMC_HOOKS
/* Program the PMC LVT entry if present. */
if (maxlvt >= LVT_PMC)
@@ -646,6 +647,18 @@ lapic_eoi(void)
lapic->eoi = 0;
}
+/*
+ * Read the contents of the error status register. We have to write
+ * to the register first before reading from it.
+ */
+u_int
+lapic_error(void)
+{
+
+ lapic->esr = 0;
+ return (lapic->esr);
+}
+
void
lapic_handle_intr(int vector, struct trapframe *frame)
{
diff --git a/sys/i386/include/apicreg.h b/sys/i386/include/apicreg.h
index d5d5dc3..81c4b7e 100644
--- a/sys/i386/include/apicreg.h
+++ b/sys/i386/include/apicreg.h
@@ -260,6 +260,14 @@ typedef struct IOAPIC ioapic_t;
# define APIC_TPR_INT 0x000000f0
# define APIC_TPR_SUB 0x0000000f
+/* fields in ESR */
+#define APIC_ESR_SEND_CS_ERROR 0x00000001
+#define APIC_ESR_RECEIVE_CS_ERROR 0x00000002
+#define APIC_ESR_SEND_ACCEPT 0x00000004
+#define APIC_ESR_RECEIVE_ACCEPT 0x00000008
+#define APIC_ESR_SEND_ILLEGAL_VECTOR 0x00000020
+#define APIC_ESR_RECEIVE_ILLEGAL_VECTOR 0x00000040
+#define APIC_ESR_ILLEGAL_REGISTER 0x00000080
/* fields in ICR_LOW */
#define APIC_VECTOR_MASK 0x000000ff
diff --git a/sys/i386/include/apicvar.h b/sys/i386/include/apicvar.h
index 2c430b4..c33c0a9 100644
--- a/sys/i386/include/apicvar.h
+++ b/sys/i386/include/apicvar.h
@@ -211,6 +211,7 @@ void lapic_create(u_int apic_id, int boot_cpu);
void lapic_disable(void);
void lapic_dump(const char *str);
void lapic_eoi(void);
+u_int lapic_error(void);
int lapic_id(void);
void lapic_init(vm_paddr_t addr);
int lapic_intr_pending(u_int vector);
OpenPOWER on IntegriCloud