From owner-p4-projects@FreeBSD.ORG Sat Nov 22 19:30:41 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0DE3616A4D0; Sat, 22 Nov 2003 19:30:41 -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 C230C16A4CE for ; Sat, 22 Nov 2003 19:30:40 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 90F1043FD7 for ; Sat, 22 Nov 2003 19:30:38 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hAN3UcXJ047713 for ; Sat, 22 Nov 2003 19:30:38 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hAN3UbFH047710 for perforce@freebsd.org; Sat, 22 Nov 2003 19:30:37 -0800 (PST) (envelope-from sam@freebsd.org) Date: Sat, 22 Nov 2003 19:30:37 -0800 (PST) Message-Id: <200311230330.hAN3UbFH047710@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 42944 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2003 03:30:41 -0000 http://perforce.freebsd.org/chv.cgi?CH=42944 Change 42944 by sam@sam_ebb on 2003/11/22 19:29:37 IFC @ 42943 Affected files ... .. //depot/projects/netperf/sys/alpha/alpha/mp_machdep.c#5 integrate .. //depot/projects/netperf/sys/amd64/amd64/amd64_mem.c#4 integrate .. //depot/projects/netperf/sys/amd64/amd64/autoconf.c#5 integrate .. //depot/projects/netperf/sys/amd64/amd64/genassym.c#5 integrate .. //depot/projects/netperf/sys/amd64/amd64/identcpu.c#4 integrate .. //depot/projects/netperf/sys/amd64/amd64/initcpu.c#3 integrate .. //depot/projects/netperf/sys/amd64/amd64/legacy.c#3 integrate .. //depot/projects/netperf/sys/amd64/amd64/machdep.c#10 integrate .. //depot/projects/netperf/sys/amd64/amd64/mp_machdep.c#2 integrate .. //depot/projects/netperf/sys/amd64/amd64/nexus.c#5 integrate .. //depot/projects/netperf/sys/amd64/amd64/pmap.c#17 integrate .. //depot/projects/netperf/sys/amd64/amd64/sys_machdep.c#4 integrate .. //depot/projects/netperf/sys/amd64/amd64/trap.c#10 integrate .. //depot/projects/netperf/sys/amd64/amd64/vm_machdep.c#9 integrate .. //depot/projects/netperf/sys/amd64/conf/GENERIC#7 integrate .. //depot/projects/netperf/sys/amd64/include/_limits.h#2 integrate .. //depot/projects/netperf/sys/amd64/include/_stdint.h#2 integrate .. //depot/projects/netperf/sys/amd64/include/acpica_machdep.h#3 integrate .. //depot/projects/netperf/sys/amd64/include/asmacros.h#3 integrate .. //depot/projects/netperf/sys/amd64/include/atomic.h#3 integrate .. //depot/projects/netperf/sys/amd64/include/bus_dma.h#4 integrate .. //depot/projects/netperf/sys/amd64/include/limits.h#2 integrate .. //depot/projects/netperf/sys/amd64/include/pcpu.h#3 integrate .. //depot/projects/netperf/sys/amd64/include/proc.h#2 integrate .. //depot/projects/netperf/sys/amd64/include/specialreg.h#4 integrate .. //depot/projects/netperf/sys/amd64/isa/atpic.c#2 integrate .. //depot/projects/netperf/sys/amd64/isa/clock.c#7 integrate .. //depot/projects/netperf/sys/amd64/isa/isa.c#3 integrate .. //depot/projects/netperf/sys/amd64/isa/isa_dma.c#3 integrate .. //depot/projects/netperf/sys/boot/i386/loader/loader.rc#2 integrate .. //depot/projects/netperf/sys/conf/majors#7 integrate .. //depot/projects/netperf/sys/conf/newvers.sh#3 integrate .. //depot/projects/netperf/sys/contrib/dev/acpica/dsmthdat.c#2 integrate .. //depot/projects/netperf/sys/contrib/dev/acpica/exfldio.c#3 integrate .. //depot/projects/netperf/sys/contrib/dev/acpica/utdelete.c#2 integrate .. //depot/projects/netperf/sys/dev/acpica/acpi_pci_link.c#5 integrate .. //depot/projects/netperf/sys/dev/acpica/acpi_pcib.c#5 integrate .. //depot/projects/netperf/sys/dev/ata/ata-chipset.c#11 integrate .. //depot/projects/netperf/sys/i386/i386/machdep.c#13 integrate .. //depot/projects/netperf/sys/i386/i386/mp_machdep.c#15 integrate .. //depot/projects/netperf/sys/i386/include/pcpu.h#5 integrate .. //depot/projects/netperf/sys/ia64/ia64/mp_machdep.c#5 integrate .. //depot/projects/netperf/sys/kern/subr_smp.c#4 integrate .. //depot/projects/netperf/sys/netinet/in_pcb.c#19 integrate .. //depot/projects/netperf/sys/netinet6/raw_ip6.c#10 integrate .. //depot/projects/netperf/sys/nfs4client/nfs4_vfsops.c#2 integrate .. //depot/projects/netperf/sys/nfsclient/nfs.h#4 integrate .. //depot/projects/netperf/sys/nfsclient/nfs_bio.c#6 integrate .. //depot/projects/netperf/sys/nfsclient/nfs_subs.c#6 integrate .. //depot/projects/netperf/sys/nfsclient/nfs_vfsops.c#11 integrate .. //depot/projects/netperf/sys/nfsclient/nfsmount.h#3 integrate .. //depot/projects/netperf/sys/nfsclient/nfsnode.h#4 integrate .. //depot/projects/netperf/sys/powerpc/powerpc/mp_machdep.c#2 integrate .. //depot/projects/netperf/sys/sparc64/sparc64/mp_machdep.c#4 integrate .. //depot/projects/netperf/sys/sys/pcpu.h#2 integrate .. //depot/projects/netperf/sys/sys/smp.h#2 integrate .. //depot/projects/netperf/sys/sys/soundcard.h#3 integrate Differences ... ==== //depot/projects/netperf/sys/alpha/alpha/mp_machdep.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.48 2003/08/17 06:42:07 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.49 2003/11/21 22:23:25 jhb Exp $"); #include "opt_kstack_pages.h" @@ -64,6 +64,7 @@ u_int boot_cpu_id; static void release_aps(void *dummy); +static int smp_cpu_enabled(struct pcs *pcsp); extern void smp_init_secondary_glue(void); static int smp_send_secondary_command(const char *command, int cpuid); static int smp_start_secondary(int cpuid); @@ -301,10 +302,50 @@ /* Other stuff */ +static int +smp_cpu_enabled(struct pcs *pcsp) +{ + + /* Is this CPU present? */ + if ((pcsp->pcs_flags & PCS_PP) == 0) + return (0); + + /* Is this CPU available? */ + if ((pcsp->pcs_flags & PCS_PA) == 0) + /* + * The TurboLaser PCS_PA bit doesn't seem to be set + * correctly. + */ + if (hwrpb->rpb_type != ST_DEC_21000) + return (0); + + /* Is this CPU's PALcode valid? */ + if ((pcsp->pcs_flags & PCS_PV) == 0) + return (0); + + return (1); +} + +void +cpu_mp_setmaxid(void) +{ + int i; + + mp_maxid = 0; + for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { + if (i == PCPU_GET(cpuid)) + continue; + if (!smp_cpu_enabled(LOCATE_PCS(hwrpb, i))) + continue; + if (i > MAXCPU) + continue; + mp_maxid = i; + } +} + int cpu_mp_probe(void) { - struct pcs *pcsp; int i, cpus; /* XXX: Need to check for valid platforms here. */ @@ -315,33 +356,16 @@ all_cpus = 1 << boot_cpu_id; mp_ncpus = 1; - mp_maxid = 0; /* Make sure we have at least one secondary CPU. */ cpus = 0; for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { if (i == PCPU_GET(cpuid)) continue; - pcsp = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off + - (i * hwrpb->rpb_pcs_size)); - if ((pcsp->pcs_flags & PCS_PP) == 0) { + if (!smp_cpu_enabled(LOCATE_PCS(hwrpb, i))) continue; - } - if ((pcsp->pcs_flags & PCS_PA) == 0) { - /* - * The TurboLaser PCS_PA bit doesn't seem to be set - * correctly. - */ - if (hwrpb->rpb_type != ST_DEC_21000) - continue; - } - if ((pcsp->pcs_flags & PCS_PV) == 0) { + if (i > MAXCPU) continue; - } - if (i > MAXCPU) { - continue; - } - mp_maxid = i; cpus++; } return (cpus); @@ -359,8 +383,7 @@ if (i == boot_cpu_id) continue; - pcsp = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off + - (i * hwrpb->rpb_pcs_size)); + pcsp = LOCATE_PCS(hwrpb, i); if ((pcsp->pcs_flags & PCS_PP) == 0) continue; if ((pcsp->pcs_flags & PCS_PA) == 0) { ==== //depot/projects/netperf/sys/amd64/amd64/amd64_mem.c#4 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/amd64_mem.c,v 1.22 2003/10/21 18:28:33 silby Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/amd64_mem.c,v 1.23 2003/11/22 01:11:07 peter Exp $"); #include #include @@ -214,13 +214,13 @@ msrv = rdmsr(msr); mrd->mr_flags = (mrd->mr_flags & ~MDF_ATTRMASK) | amd64_mtrr2mrt(msrv & 0xff); - mrd->mr_base = msrv & 0x000ffffffffff000L; + mrd->mr_base = msrv & 0x000000fffffff000L; msrv = rdmsr(msr + 1); mrd->mr_flags = (msrv & 0x800) ? (mrd->mr_flags | MDF_ACTIVE) : (mrd->mr_flags & ~MDF_ACTIVE); /* Compute the range from the mask. Ick. */ - mrd->mr_len = (~(msrv & 0x000ffffffffff000L) & 0x000fffffffffffffL) + 1; + mrd->mr_len = (~(msrv & 0x000000fffffff000L) & 0x000000ffffffffffL) + 1; if (!mrvalid(mrd->mr_base, mrd->mr_len)) mrd->mr_flags |= MDF_BOGUS; /* If unclaimed and active, must be the BIOS */ @@ -348,7 +348,7 @@ /* base/type register */ omsrv = rdmsr(msr); if (mrd->mr_flags & MDF_ACTIVE) { - msrv = mrd->mr_base & 0x000ffffffffff000L; + msrv = mrd->mr_base & 0x000000fffffff000L; msrv |= amd64_mrt2mtrr(mrd->mr_flags, omsrv); } else { msrv = 0; @@ -357,7 +357,7 @@ /* mask/active register */ if (mrd->mr_flags & MDF_ACTIVE) { - msrv = 0x800 | (~(mrd->mr_len - 1) & 0x000ffffffffff000L); + msrv = 0x800 | (~(mrd->mr_len - 1) & 0x000000fffffff000L); } else { msrv = 0; } @@ -553,7 +553,6 @@ return; } nmdesc = mtrrcap & 0xff; - printf("Pentium Pro MTRR support enabled\n"); /* If fixed MTRRs supported and enabled */ if ((mtrrcap & 0x100) && (mtrrdef & 0x400)) { ==== //depot/projects/netperf/sys/amd64/amd64/autoconf.c#5 (text+ko) ==== @@ -33,11 +33,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)autoconf.c 7.1 (Berkeley) 5/9/91 + * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/autoconf.c,v 1.176 2003/11/17 08:58:12 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/autoconf.c,v 1.177 2003/11/21 03:01:59 peter Exp $"); /* * Setup the system to run on the current machine. ==== //depot/projects/netperf/sys/amd64/amd64/genassym.c#5 (text+ko) ==== @@ -33,11 +33,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)genassym.c 5.11 (Berkeley) 5/10/91 + * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.150 2003/11/17 08:58:12 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.151 2003/11/21 03:01:59 peter Exp $"); #include "opt_compat.h" #include "opt_kstack_pages.h" ==== //depot/projects/netperf/sys/amd64/amd64/identcpu.c#4 (text+ko) ==== @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1992 Terrence R. Lambert. * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. * Copyright (c) 1997 KATO Takenori. @@ -41,7 +41,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.127 2003/11/17 08:58:12 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.128 2003/11/21 03:01:59 peter Exp $"); #include "opt_cpu.h" ==== //depot/projects/netperf/sys/amd64/amd64/initcpu.c#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) KATO Takenori, 1997, 1998. * * All rights reserved. Unpublished rights reserved under the copyright @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/initcpu.c,v 1.46 2003/07/25 21:15:44 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/initcpu.c,v 1.47 2003/11/21 03:01:59 peter Exp $"); #include "opt_cpu.h" ==== //depot/projects/netperf/sys/amd64/amd64/legacy.c#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* +/*- * Copyright 1998 Massachusetts Institute of Technology * * Permission to use, copy, modify, and distribute this software and @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/legacy.c,v 1.51 2003/07/25 21:15:44 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/legacy.c,v 1.52 2003/11/21 03:01:59 peter Exp $"); /* * This code implements a system driver for legacy systems that do not ==== //depot/projects/netperf/sys/amd64/amd64/machdep.c#10 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.599 2003/11/17 08:58:12 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.600 2003/11/20 22:54:44 peter Exp $"); #include "opt_atalk.h" #include "opt_atpic.h" @@ -121,6 +121,9 @@ #include #include +/* Sanity check for __curthread() */ +CTASSERT(offsetof(struct pcpu, pc_curthread) == 0); + extern u_int64_t hammer_time(u_int64_t, u_int64_t); extern void dblfault_handler(void); ==== //depot/projects/netperf/sys/amd64/amd64/mp_machdep.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.226 2003/11/17 08:58:12 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.228 2003/11/21 22:23:25 jhb Exp $"); #include "opt_cpu.h" #include "opt_kstack_pages.h" @@ -130,7 +130,7 @@ } static cpu_info[MAXCPU]; static int cpu_apic_ids[MAXCPU]; -static u_int boot_address; +static u_int boot_address; static void set_logical_apic_ids(void); static int start_all_aps(void); @@ -187,6 +187,26 @@ } +void +cpu_mp_setmaxid(void) +{ + + /* + * mp_maxid should be already set by calls to cpu_add(). + * Just sanity check its value here. + */ + if (mp_ncpus == 0) + KASSERT(mp_maxid == 0, + ("%s: mp_ncpus is zero, but mp_maxid is not", __func__)); + else if (mp_ncpus == 1) + mp_maxid = 0; + else + KASSERT(mp_maxid >= mp_ncpus - 1, + ("%s: counters out of sync: max %d, count %d", __func__, + mp_maxid, mp_ncpus)); + +} + int cpu_mp_probe(void) { @@ -202,8 +222,6 @@ * the variables to represent a system with a single CPU * with an id of 0. */ - KASSERT(mp_maxid == 0, - ("%s: mp_ncpus is zero, but mp_maxid is not", __func__)); mp_ncpus = 1; return (0); } @@ -219,9 +237,6 @@ } /* At least two CPUs were found. */ - KASSERT(mp_maxid >= mp_ncpus - 1, - ("%s: counters out of sync: max %d, count %d", __func__, mp_maxid, - mp_ncpus)); return (1); } ==== //depot/projects/netperf/sys/amd64/amd64/nexus.c#5 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.56 2003/11/17 08:58:13 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.57 2003/11/21 03:00:05 peter Exp $"); /* * This code implements a `root nexus' for Intel Architecture @@ -135,6 +135,7 @@ static int nexus_probe(device_t dev) { + int irq, last; device_quiet(dev); /* suppress attach message for neatness */ @@ -160,12 +161,27 @@ irq_rman.rm_type = RMAN_ARRAY; irq_rman.rm_descr = "Interrupt request lines"; irq_rman.rm_end = NUM_IO_INTS - 1; - if (rman_init(&irq_rman) - || rman_manage_region(&irq_rman, - irq_rman.rm_start, irq_rman.rm_end)) + if (rman_init(&irq_rman)) panic("nexus_probe irq_rman"); /* + * We search for regions of existing IRQs and add those to the IRQ + * resource manager. + */ + last = -1; + for (irq = 0; irq < NUM_IO_INTS; irq++) + if (intr_lookup_source(irq) != NULL) { + if (last == -1) + last = irq; + } else if (last != -1) { + if (rman_manage_region(&irq_rman, last, irq - 1) != 0) + panic("nexus_probe irq_rman add"); + last = -1; + } + if (last != -1 && rman_manage_region(&irq_rman, last, irq - 1) != 0) + panic("nexus_probe irq_rman add"); + + /* * ISA DMA on PCI systems is implemented in the ISA part of each * PCI->ISA bridge and the channels can be duplicated if there are * multiple bridges. (eg: laptops with docking stations) ==== //depot/projects/netperf/sys/amd64/amd64/pmap.c#17 (text+ko) ==== @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1991 Regents of the University of California. * All rights reserved. * Copyright (c) 1994 John S. Dyson @@ -40,7 +40,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)pmap.c 7.7 (Berkeley) 5/12/91 + * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 */ /*- * Copyright (c) 2003 Networks Associates Technology, Inc. @@ -75,7 +75,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.446 2003/11/17 08:58:13 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.447 2003/11/21 03:01:59 peter Exp $"); /* * Manages physical address maps. ==== //depot/projects/netperf/sys/amd64/amd64/sys_machdep.c#4 (text+ko) ==== @@ -31,11 +31,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 + * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/sys_machdep.c,v 1.86 2003/11/08 04:39:21 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/sys_machdep.c,v 1.87 2003/11/21 03:01:59 peter Exp $"); #include #include ==== //depot/projects/netperf/sys/amd64/amd64/trap.c#10 (text+ko) ==== @@ -34,11 +34,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)trap.c 7.4 (Berkeley) 5/13/91 + * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.270 2003/11/17 08:58:13 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.271 2003/11/21 03:01:59 peter Exp $"); /* * AMD64 Trap and System call handling ==== //depot/projects/netperf/sys/amd64/amd64/vm_machdep.c#9 (text+ko) ==== @@ -36,12 +36,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 + * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.223 2003/11/17 08:58:13 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.224 2003/11/21 03:02:00 peter Exp $"); #include "opt_isa.h" #include "opt_kstack_pages.h" ==== //depot/projects/netperf/sys/amd64/conf/GENERIC#7 (text+ko) ==== @@ -16,7 +16,7 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.398 2003/11/19 18:11:27 peter Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.399 2003/11/21 03:19:59 peter Exp $ machine amd64 cpu HAMMER @@ -68,6 +68,7 @@ options SMP # Symmetric MultiProcessor Kernel # Workarounds for some known-to-be-broken chipsets (nVidia nForce3-Pro150) device atpic # 8259A compatability +options NO_MIXED_MODE # Don't penalize working chipsets device acpi device isa ==== //depot/projects/netperf/sys/amd64/include/_limits.h#2 (text+ko) ==== @@ -31,9 +31,7 @@ * SUCH DAMAGE. * * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp - * From: FreeBSD: src/sys/alpha/include/limits.h,v 1.8 2001/11/02 - * $FreeBSD: src/sys/amd64/include/_limits.h,v 1.7 2003/05/19 20:29:06 kan Exp $ + * $FreeBSD: src/sys/amd64/include/_limits.h,v 1.8 2003/11/21 03:02:00 peter Exp $ */ #ifndef _MACHINE__LIMITS_H_ @@ -53,27 +51,26 @@ #define __CHAR_BIT 8 /* number of bits in a char */ #define __SCHAR_MAX 0x7f /* max value for a signed char */ -#define __SCHAR_MIN (-0x7f-1) /* min value for a signed char */ +#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ #define __UCHAR_MAX 0xffU /* max value for an unsigned char */ #define __USHRT_MAX 0xffffU /* max value for an unsigned short */ #define __SHRT_MAX 0x7fff /* max value for a short */ -#define __SHRT_MIN (-0x7fff-1) /* min value for a short */ +#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ #define __UINT_MAX 0xffffffffU /* max value for an unsigned int */ #define __INT_MAX 0x7fffffff /* max value for an int */ -#define __INT_MIN (-0x7fffffff-1) /* min value for an int */ +#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ #define __ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */ #define __LONG_MAX 0x7fffffffffffffffL /* max for a long */ -#define __LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */ +#define __LONG_MIN (-0x7fffffffffffffffL - 1) /* min for a long */ -/* Long longs and longs are the same size on the alpha. */ - /* max for an unsigned long long */ + /* max value for an unsigned long long */ #define __ULLONG_MAX 0xffffffffffffffffULL -#define __LLONG_MAX 0x7fffffffffffffffLL /* max for a long long */ -#define __LLONG_MIN (-0x7fffffffffffffffLL-1) /* min for a long long */ +#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ +#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ #define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ @@ -83,9 +80,9 @@ #define __OFF_MIN __LONG_MIN /* min value for an off_t */ /* Quads and longs are the same on the amd64. Ensure they stay in sync. */ -#define __UQUAD_MAX (__ULONG_MAX) /* max value for a uquad_t */ -#define __QUAD_MAX (__LONG_MAX) /* max value for a quad_t */ -#define __QUAD_MIN (__LONG_MIN) /* min value for a quad_t */ +#define __UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */ +#define __QUAD_MAX __LONG_MAX /* max value for a quad_t */ +#define __QUAD_MIN __LONG_MIN /* min value for a quad_t */ #define __LONG_BIT 64 #define __WORD_BIT 32 ==== //depot/projects/netperf/sys/amd64/include/_stdint.h#2 (text+ko) ==== @@ -34,10 +34,10 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/include/_stdint.h,v 1.1 2002/07/29 17:41:23 mike Exp $ + * $FreeBSD: src/sys/amd64/include/_stdint.h,v 1.2 2003/11/21 03:02:00 peter Exp $ */ -#ifndef _MACHINE__STDINT_H_ +#ifndef _MACHINE__STDINT_H_ #define _MACHINE__STDINT_H_ #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) ==== //depot/projects/netperf/sys/amd64/include/acpica_machdep.h#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/include/acpica_machdep.h,v 1.3 2003/09/22 22:12:46 peter Exp $ + * $FreeBSD: src/sys/amd64/include/acpica_machdep.h,v 1.4 2003/11/21 03:02:00 peter Exp $ */ /****************************************************************************** @@ -103,6 +103,6 @@ #define COMPILER_DEPENDENT_INT64 long #define COMPILER_DEPENDENT_UINT64 unsigned long -void acpi_SetDefaultIntrModel(int model); +void acpi_SetDefaultIntrModel(int model); #endif /* __ACPICA_MACHDEP_H__ */ ==== //depot/projects/netperf/sys/amd64/include/asmacros.h#3 (text+ko) ==== @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/include/asmacros.h,v 1.26 2003/11/17 08:58:14 peter Exp $ + * $FreeBSD: src/sys/amd64/include/asmacros.h,v 1.27 2003/11/21 03:02:00 peter Exp $ */ #ifndef _MACHINE_ASMACROS_H_ @@ -115,7 +115,7 @@ #define CROSSJUMPTARGET(label) \ ALIGN_TEXT; __CONCAT(to,label): ; MCOUNT; jmp label #define ENTRY(name) GEN_ENTRY(name) ; 9: ; MCOUNT -#define FAKE_MCOUNT(caller) pushq caller ; call __mcount ; popl %ecx +#define FAKE_MCOUNT(caller) pushq caller ; call __mcount ; popq %rcx #define MCOUNT call __mcount #define MCOUNT_LABEL(name) GEN_ENTRY(name) ; nop ; ALIGN_TEXT #define MEXITCOUNT call HIDENAME(mexitcount) ==== //depot/projects/netperf/sys/amd64/include/atomic.h#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/include/atomic.h,v 1.31 2003/11/17 08:58:14 peter Exp $ + * $FreeBSD: src/sys/amd64/include/atomic.h,v 1.32 2003/11/21 03:02:00 peter Exp $ */ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ @@ -99,7 +99,8 @@ __asm __volatile(__XSTRING(MPLOCKED) OP \ : "+m" (*p) \ : CONS (V)); \ -} +} \ +struct __hack #else /* !__GNUC__ */ @@ -150,7 +151,7 @@ " movzbq %%al,%0 ; " "1: " "# atomic_cmpset_long" - : "+a" (res) /* 0 (result) %rax, XXX check */ + : "+a" (res) /* 0 (result) */ : "r" (src), /* 1 */ "m" (*(dst)) /* 2 */ : "memory"); @@ -185,7 +186,8 @@ : "+m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ : : "memory"); \ -} +} \ +struct __hack #else /* !defined(__GNUC__) */ @@ -330,7 +332,11 @@ static __inline void * atomic_load_acq_ptr(volatile void *p) { - return (void *)atomic_load_acq_long((volatile u_long *)p); + /* + * The apparently-bogus cast to intptr_t in the following is to + * avoid a warning from "gcc -Wbad-function-cast". + */ + return ((void *)(intptr_t)atomic_load_acq_long((volatile u_long *)p)); } static __inline void ==== //depot/projects/netperf/sys/amd64/include/bus_dma.h#4 (text+ko) ==== @@ -67,7 +67,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $FreeBSD: src/sys/amd64/include/bus_dma.h,v 1.25 2003/11/07 23:29:42 scottl Exp $ */ +/* $FreeBSD: src/sys/amd64/include/bus_dma.h,v 1.26 2003/11/21 03:02:00 peter Exp $ */ #ifndef _AMD64_BUS_DMA_H_ #define _AMD64_BUS_DMA_H_ @@ -78,7 +78,7 @@ #define BUS_DMA_WAITOK 0x00 /* safe to sleep (pseudo-flag) */ #define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */ #define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */ -#define BUS_DMA_COHERENT 0x04 /* hint map memory in a coherent way */ +#define BUS_DMA_COHERENT 0x04 /* hint: map memory in a coherent way */ #define BUS_DMA_ZERO 0x08 /* allocate zero'ed memory */ #define BUS_DMA_BUS1 0x10 /* placeholders for bus functions... */ #define BUS_DMA_BUS2 0x20 @@ -104,7 +104,7 @@ * A machine-dependent opaque type describing the characteristics * of how to perform DMA mappings. This structure encapsultes * information concerning address and alignment restrictions, number - * of S/G segments, amount of data per S/G segment, etc. + * of S/G segments, amount of data per S/G segment, etc. */ typedef struct bus_dma_tag *bus_dma_tag_t; @@ -133,7 +133,7 @@ typedef int bus_dma_filter_t(void *, bus_addr_t); /* - * A function that performs driver-specific syncronization on behalf of + * A function that performs driver-specific synchronization on behalf of * busdma. */ typedef enum { @@ -147,7 +147,7 @@ * Allocate a device specific dma_tag encapsulating the constraints of * the parent tag in addition to other restrictions specified: * - * alignment: alignment for segments. + * alignment: Alignment for segments. * boundary: Boundary that segments cannot cross. * lowaddr: Low restricted address that cannot appear in a mapping. * highaddr: High restricted address that cannot appear in a mapping. @@ -184,21 +184,21 @@ int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp); /* - * Destroy a handle for mapping from kva/uva/physical + * Destroy a handle for mapping from kva/uva/physical * address space into bus device space. */ int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map); /* * Allocate a piece of memory that can be efficiently mapped into - * bus device space based on the constraints lited in the dma tag. + * bus device space based on the constraints listed in the dma tag. * A dmamap to for use with dmamap_load is also allocated. */ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp); /* - * Free a piece of memory and it's allociated dmamap, that was allocated + * Free a piece of memory and its allocated dmamap, that was allocated * via bus_dmamem_alloc. */ void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map); @@ -218,7 +218,7 @@ /* * Like bus_dmamap_callback but includes map size in bytes. This is - * defined as a separate interface to maintain compatiiblity for users + * defined as a separate interface to maintain compatibility for users * of bus_dmamap_callback_t--at some point these interfaces should be merged. */ typedef void bus_dmamap_callback2_t(void *, bus_dma_segment_t *, int, bus_size_t, int); @@ -240,7 +240,7 @@ int flags); /* - * Perform a syncronization operation on the given map. + * Perform a synchronization operation on the given map. */ void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t); #define bus_dmamap_sync(dmat, dmamap, op) \ ==== //depot/projects/netperf/sys/amd64/include/limits.h#2 (text+ko) ==== @@ -31,9 +31,7 @@ * SUCH DAMAGE. * * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp - * From: FreeBSD: src/sys/alpha/include/limits.h,v 1.8 2001/11/02 - * $FreeBSD: src/sys/amd64/include/limits.h,v 1.6 2003/05/19 20:29:06 kan Exp $ + * $FreeBSD: src/sys/amd64/include/limits.h,v 1.7 2003/11/21 03:02:00 peter Exp $ */ #ifndef _MACHINE_LIMITS_H_ ==== //depot/projects/netperf/sys/amd64/include/pcpu.h#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/include/pcpu.h,v 1.40 2003/11/17 08:58:14 peter Exp $ + * $FreeBSD: src/sys/amd64/include/pcpu.h,v 1.42 2003/11/20 23:49:28 peter Exp $ */ #ifndef _MACHINE_PCPU_H_ @@ -159,6 +159,16 @@ #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) +static __inline struct thread * +__curthread(void) +{ + struct thread *td; + + __asm __volatile("movq %%gs:0,%0" : "=r" (td)); + return (td); +} +#define curthread (__curthread()) + #else #error gcc or lint is required to use this file #endif ==== //depot/projects/netperf/sys/amd64/include/proc.h#2 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 - * $FreeBSD: src/sys/amd64/include/proc.h,v 1.20 2003/05/01 01:05:23 peter Exp $ + * $FreeBSD: src/sys/amd64/include/proc.h,v 1.21 2003/11/21 03:02:00 peter Exp $ */ #ifndef _MACHINE_PROC_H_ @@ -41,7 +41,7 @@ * Machine-dependent part of the proc structure for AMD64. */ struct mdthread { - register_t md_savecrit; + register_t md_savecrit; }; struct mdproc { ==== //depot/projects/netperf/sys/amd64/include/specialreg.h#4 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)specialreg.h 7.1 (Berkeley) 5/9/91 - * $FreeBSD: src/sys/amd64/include/specialreg.h,v 1.26 2003/11/08 03:33:38 peter Exp $ + * $FreeBSD: src/sys/amd64/include/specialreg.h,v 1.27 2003/11/21 03:02:00 peter Exp $ */ #ifndef _MACHINE_SPECIALREG_H_ @@ -151,9 +151,9 @@ #define MSR_BBL_CR_TRIG 0x11a #define MSR_BBL_CR_BUSY 0x11b #define MSR_BBL_CR_CTL3 0x11e -#define MSR_SYSENTER_CS_MSR 0x174 -#define MSR_SYSENTER_ESP_MSR 0x175 -#define MSR_SYSENTER_EIP_MSR 0x176 +#define MSR_SYSENTER_CS_MSR 0x174 +#define MSR_SYSENTER_ESP_MSR 0x175 +#define MSR_SYSENTER_EIP_MSR 0x176 #define MSR_MCG_CAP 0x179 #define MSR_MCG_STATUS 0x17a #define MSR_MCG_CTL 0x17b ==== //depot/projects/netperf/sys/amd64/isa/atpic.c#2 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/isa/atpic.c,v 1.6 2003/11/17 08:58:15 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/isa/atpic.c,v 1.7 2003/11/21 02:58:26 peter Exp $"); #include "opt_auto_eoi.h" #include "opt_isa.h" @@ -107,6 +107,8 @@ struct intsrc at_intsrc; int at_irq; /* Relative to PIC base. */ inthand_t *at_intr; + u_long at_count; + u_long at_straycount; }; static void atpic_enable_source(struct intsrc *isrc); @@ -277,28 +279,37 @@ void atpic_startup(void) { + struct atpic_intsrc *ai; + int i; /* Start off with all interrupts disabled. */ imen = 0xffff; i8259_init(&atpics[MASTER], 0); i8259_init(&atpics[SLAVE], 1); atpic_enable_source((struct intsrc *)&atintrs[ICU_SLAVEID]); + + /* Install low-level interrupt handlers for all of our IRQs. */ + for (i = 0; i < sizeof(atintrs) / sizeof(struct atpic_intsrc); i++) { + if (i == ICU_SLAVEID) + continue; + ai = &atintrs[i]; + ai->at_intsrc.is_count = &ai->at_count; + ai->at_intsrc.is_straycount = &ai->at_straycount; + setidt(((struct atpic *)ai->at_intsrc.is_pic)->at_intbase + + ai->at_irq, ai->at_intr, SDT_SYSIGT, SEL_KPL, 0); + } } static void atpic_init(void *dummy __unused) { - struct atpic_intsrc *ai; int i; /* Loop through all interrupt sources and add them. */ for (i = 0; i < sizeof(atintrs) / sizeof(struct atpic_intsrc); i++) { if (i == ICU_SLAVEID) continue; - ai = &atintrs[i]; - setidt(((struct atpic *)ai->at_intsrc.is_pic)->at_intbase + - ai->at_irq, ai->at_intr, SDT_SYSIGT, SEL_KPL, 0); - intr_register_source(&ai->at_intsrc); + intr_register_source(&atintrs[i].at_intsrc); } } SYSINIT(atpic_init, SI_SUB_INTR, SI_ORDER_SECOND + 1, atpic_init, NULL) @@ -311,7 +322,12 @@ KASSERT(vec < ICU_LEN, ("unknown int %d\n", vec)); isrc = &atintrs[vec].at_intsrc; - if (vec == 7 || vec == 15) { + + /* + * If we don't have an ithread, see if this is a spurious + * interrupt. + */ + if (isrc->is_ithread == NULL && (vec == 7 || vec == 15)) { int port, isr; /* ==== //depot/projects/netperf/sys/amd64/isa/clock.c#7 (text+ko) ==== @@ -33,11 +33,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >>> TRUNCATED FOR MAIL (1000 lines) <<<