From owner-svn-src-head@FreeBSD.ORG Thu Dec 11 15:56:31 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E05B1065673; Thu, 11 Dec 2008 15:56:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C4178FC0C; Thu, 11 Dec 2008 15:56:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBBFuVaa069173; Thu, 11 Dec 2008 15:56:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBFuU05069167; Thu, 11 Dec 2008 15:56:30 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200812111556.mBBFuU05069167@svn.freebsd.org> From: John Baldwin Date: Thu, 11 Dec 2008 15:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185933 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 15:56:31 -0000 Author: jhb Date: Thu Dec 11 15:56:30 2008 New Revision: 185933 URL: http://svn.freebsd.org/changeset/base/185933 Log: Add constants for fields in the local APIC error status register and a routine to read it. Modified: head/sys/amd64/amd64/local_apic.c head/sys/amd64/include/apicreg.h head/sys/amd64/include/apicvar.h head/sys/i386/i386/local_apic.c head/sys/i386/include/apicreg.h head/sys/i386/include/apicvar.h Modified: head/sys/amd64/amd64/local_apic.c ============================================================================== --- head/sys/amd64/amd64/local_apic.c Thu Dec 11 15:44:53 2008 (r185932) +++ head/sys/amd64/amd64/local_apic.c Thu Dec 11 15:56:30 2008 (r185933) @@ -299,6 +299,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) @@ -644,6 +645,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) { Modified: head/sys/amd64/include/apicreg.h ============================================================================== --- head/sys/amd64/include/apicreg.h Thu Dec 11 15:44:53 2008 (r185932) +++ head/sys/amd64/include/apicreg.h Thu Dec 11 15:56:30 2008 (r185933) @@ -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 Modified: head/sys/amd64/include/apicvar.h ============================================================================== --- head/sys/amd64/include/apicvar.h Thu Dec 11 15:44:53 2008 (r185932) +++ head/sys/amd64/include/apicvar.h Thu Dec 11 15:56:30 2008 (r185933) @@ -200,6 +200,7 @@ void lapic_create(u_int apic_id, int boo 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); Modified: head/sys/i386/i386/local_apic.c ============================================================================== --- head/sys/i386/i386/local_apic.c Thu Dec 11 15:44:53 2008 (r185932) +++ head/sys/i386/i386/local_apic.c Thu Dec 11 15:56:30 2008 (r185933) @@ -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) { Modified: head/sys/i386/include/apicreg.h ============================================================================== --- head/sys/i386/include/apicreg.h Thu Dec 11 15:44:53 2008 (r185932) +++ head/sys/i386/include/apicreg.h Thu Dec 11 15:56:30 2008 (r185933) @@ -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 Modified: head/sys/i386/include/apicvar.h ============================================================================== --- head/sys/i386/include/apicvar.h Thu Dec 11 15:44:53 2008 (r185932) +++ head/sys/i386/include/apicvar.h Thu Dec 11 15:56:30 2008 (r185933) @@ -211,6 +211,7 @@ void lapic_create(u_int apic_id, int boo 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);