From owner-p4-projects Sat Dec 28 2:20:36 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6873037B405; Sat, 28 Dec 2002 02:20:32 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EFDBE37B401 for ; Sat, 28 Dec 2002 02:20:31 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9AE8243ED4 for ; Sat, 28 Dec 2002 02:20:31 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gBSAKVfh092960 for ; Sat, 28 Dec 2002 02:20:31 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gBSAKUM7092941 for perforce@freebsd.org; Sat, 28 Dec 2002 02:20:30 -0800 (PST) Date: Sat, 28 Dec 2002 02:20:30 -0800 (PST) Message-Id: <200212281020.gBSAKUM7092941@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 22834 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=22834 Change 22834 by marcel@marcel_nfs on 2002/12/28 02:20:18 Don't hardcode the address of the Processor Interrupt Block (PIB), also known as the Local APIC. By default the PAL will allocate it at 0xfee00000 and we'll initialize the variable (ia64_lapic_address) with that address. We'll set it to the address in the MADT header if we scan the MADT table and override that address again when we encounter the Local APIC override structure. Affected files ... .. //depot/projects/ia64/sys/ia64/acpica/madt.c#12 edit .. //depot/projects/ia64/sys/ia64/ia64/mp_machdep.c#24 edit .. //depot/projects/ia64/sys/ia64/ia64/sapic.c#16 edit .. //depot/projects/ia64/sys/ia64/include/intr.h#2 edit Differences ... ==== //depot/projects/ia64/sys/ia64/acpica/madt.c#12 (text+ko) ==== @@ -30,6 +30,8 @@ #include +extern u_int64_t ia64_lapic_address; + struct sapic *sapic_create(int, int, u_int64_t); #pragma pack(1) @@ -71,6 +73,13 @@ UINT32 FlagsReserved: 31; } LOCAL_SAPIC; +typedef struct /* LOCAL APIC OVERRIDE */ +{ + APIC_HEADER Header; + UINT16 Reserved; + UINT64 LocalApicAddress; +} LAPIC_OVERRIDE; + typedef struct /* PLATFORM INTERRUPT SOURCE */ { APIC_HEADER Header; @@ -123,6 +132,15 @@ } static void +parse_lapic_override(LAPIC_OVERRIDE *lapic) +{ + if (bootverbose) + printf("\t\tLocal APIC address=0x%lx\n", + lapic->LocalApicAddress); + ia64_lapic_address = lapic->LocalApicAddress; +} + +static void parse_platform_interrupt(PLATFORM_INTERRUPT_SOURCE *source) { if (bootverbose) @@ -163,6 +181,12 @@ return (cpus); } + /* Save the address of the processor interrupt block. */ + if (bootverbose) + printf("\tLocal APIC address=0x%x\n", + madt->LocalApicAddress); + ia64_lapic_address = madt->LocalApicAddress; + for (p = (char *)(madt + 1); p < end; ) { APIC_HEADER *head = (APIC_HEADER *)p; @@ -201,6 +225,7 @@ case APIC_LOCAL_APIC_OVERRIDE: if (bootverbose) printf("Local APIC override entry\n"); + parse_lapic_override((LAPIC_OVERRIDE*)head); break; case APIC_IO_SAPIC: ==== //depot/projects/ia64/sys/ia64/ia64/mp_machdep.c#24 (text+ko) ==== @@ -59,6 +59,7 @@ void ia64_ap_startup(void); extern vm_offset_t vhpt_base, vhpt_size; +extern u_int64_t ia64_lapic_address; #define LID_SAPIC_ID(x) ((int)((x) >> 24) & 0xff) #define LID_SAPIC_EID(x) ((int)((x) >> 16) & 0xff) @@ -349,7 +350,7 @@ volatile u_int64_t *pipi; u_int64_t vector; - pipi = ia64_memory_address(PAL_PIB_DEFAULT_ADDR | + pipi = ia64_memory_address(ia64_lapic_address | ((lid & LID_SAPIC_MASK) >> 12)); vector = (u_int64_t)(ipi_vector[ipi] & 0xff); CTR3(KTR_SMP, "ipi_send(%p, %ld), cpuid=%d", pipi, vector, ==== //depot/projects/ia64/sys/ia64/ia64/sapic.c#16 (text+ko) ==== @@ -36,6 +36,7 @@ #include #include #include +#include #include static MALLOC_DEFINE(M_SAPIC, "sapic", "I/O SAPIC devices"); @@ -48,6 +49,8 @@ struct sapic *ia64_sapics[16]; /* XXX make this resizable */ int ia64_sapic_count; +u_int64_t ia64_lapic_address = PAL_PIB_DEFAULT_ADDR; + struct sapic_rte { u_int64_t rte_vector :8; u_int64_t rte_delivery_mode :3; ==== //depot/projects/ia64/sys/ia64/include/intr.h#2 (text+ko) ==== @@ -43,8 +43,10 @@ u_int8_t ib_reserved4[0x1fff0]; }; +extern u_int64_t ia64_lapic_address; + #define IA64_INTERRUPT_BLOCK \ - (struct ia64_interrupt_block *)IA64_PHYS_TO_RR6(0xfee00000) + (struct ia64_interrupt_block *)IA64_PHYS_TO_RR6(ia64_lapic_address) struct sapic; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message