Module Name: src Committed By: jym Date: Sun May 31 14:32:35 UTC 2009
Modified Files: src/sys/arch/amd64/amd64 [jym-xensuspend]: bios32.c src/sys/arch/amd64/conf [jym-xensuspend]: GENERIC src/sys/arch/amd64/include [jym-xensuspend]: elf_machdep.h src/sys/arch/i386 [jym-xensuspend]: Makefile src/sys/arch/i386/i386 [jym-xensuspend]: bios32.c gdt.c src/sys/arch/i386/include [jym-xensuspend]: elf_machdep.h segments.h src/sys/arch/i386/pci [jym-xensuspend]: glxsb.c src/sys/arch/x86/include [jym-xensuspend]: cacheinfo.h specialreg.h src/sys/arch/x86/x86 [jym-xensuspend]: cpu_topology.c ioapic.c sys_machdep.c src/sys/arch/xen [jym-xensuspend]: Makefile Log Message: Sync with HEAD. To generate a diff of this commit: cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/arch/amd64/amd64/bios32.c cvs rdiff -u -r1.237.2.1 -r1.237.2.2 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.2 -r1.2.8.1 src/sys/arch/amd64/include/elf_machdep.h cvs rdiff -u -r1.36 -r1.36.4.1 src/sys/arch/i386/Makefile cvs rdiff -u -r1.22.14.1 -r1.22.14.2 src/sys/arch/i386/i386/bios32.c cvs rdiff -u -r1.45.14.1 -r1.45.14.2 src/sys/arch/i386/i386/gdt.c cvs rdiff -u -r1.9 -r1.9.138.1 src/sys/arch/i386/include/elf_machdep.h cvs rdiff -u -r1.50.8.1 -r1.50.8.2 src/sys/arch/i386/include/segments.h cvs rdiff -u -r1.6.14.1 -r1.6.14.2 src/sys/arch/i386/pci/glxsb.c cvs rdiff -u -r1.9.12.1 -r1.9.12.2 src/sys/arch/x86/include/cacheinfo.h cvs rdiff -u -r1.31.8.1 -r1.31.8.2 src/sys/arch/x86/include/specialreg.h cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/arch/x86/x86/cpu_topology.c cvs rdiff -u -r1.38.10.1 -r1.38.10.2 src/sys/arch/x86/x86/ioapic.c cvs rdiff -u -r1.16.4.1 -r1.16.4.2 src/sys/arch/x86/x86/sys_machdep.c cvs rdiff -u -r1.5 -r1.5.8.1 src/sys/arch/xen/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/amd64/bios32.c diff -u src/sys/arch/amd64/amd64/bios32.c:1.14.2.1 src/sys/arch/amd64/amd64/bios32.c:1.14.2.2 --- src/sys/arch/amd64/amd64/bios32.c:1.14.2.1 Wed May 13 17:16:08 2009 +++ src/sys/arch/amd64/amd64/bios32.c Sun May 31 14:32:32 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: bios32.c,v 1.14.2.1 2009/05/13 17:16:08 jym Exp $ */ +/* $NetBSD: bios32.c,v 1.14.2.2 2009/05/31 14:32:32 jym Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.14.2.1 2009/05/13 17:16:08 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.14.2.2 2009/05/31 14:32:32 jym Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -306,7 +306,7 @@ if (i == indx) { if (va + len < end) { ret = dest; - memcpy( ret, va, len); + memcpy(ret, va, len); ret[len - 1] = '\0'; } } Index: src/sys/arch/amd64/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.237.2.1 src/sys/arch/amd64/conf/GENERIC:1.237.2.2 --- src/sys/arch/amd64/conf/GENERIC:1.237.2.1 Wed May 13 17:16:08 2009 +++ src/sys/arch/amd64/conf/GENERIC Sun May 31 14:32:33 2009 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.237.2.1 2009/05/13 17:16:08 jym Exp $ +# $NetBSD: GENERIC,v 1.237.2.2 2009/05/31 14:32:33 jym Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.237.2.1 $" +#ident "GENERIC-$Revision: 1.237.2.2 $" maxusers 64 # estimated number of users @@ -783,9 +783,13 @@ umodem* at uhub? port ? configuration ? ucom* at umodem? +# Huawei E220 3G/HSDPA modem +uhmodem* at uhub? port ? configuration ? interface ? +ucom* at uhmodem? portno ? + # USB Mass Storage umass* at uhub? port ? configuration ? interface ? -#wd* at umass? +wd* at umass? # USB audio uaudio* at uhub? port ? configuration ? Index: src/sys/arch/amd64/include/elf_machdep.h diff -u src/sys/arch/amd64/include/elf_machdep.h:1.2 src/sys/arch/amd64/include/elf_machdep.h:1.2.8.1 --- src/sys/arch/amd64/include/elf_machdep.h:1.2 Sun Oct 26 00:08:15 2008 +++ src/sys/arch/amd64/include/elf_machdep.h Sun May 31 14:32:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_machdep.h,v 1.2 2008/10/26 00:08:15 mrg Exp $ */ +/* $NetBSD: elf_machdep.h,v 1.2.8.1 2009/05/31 14:32:33 jym Exp $ */ #ifdef __x86_64__ @@ -36,6 +36,16 @@ #define R_X86_64_8 14 #define R_X86_64_PC8 15 +/* TLS relocations */ +#define R_X86_64_DTPMOD64 16 +#define R_X86_64_DTPOFF64 17 +#define R_X86_64_TPOFF64 18 +#define R_X86_64_TLSGD 19 +#define R_X86_64_TLSLD 20 +#define R_X86_64_DTPOFF32 21 +#define R_X86_64_GOTTPOFF 22 +#define R_X86_64_TPOFF32 23 + #define R_TYPE(name) __CONCAT(R_X86_64_,name) #else /* __x86_64__ */ Index: src/sys/arch/i386/Makefile diff -u src/sys/arch/i386/Makefile:1.36 src/sys/arch/i386/Makefile:1.36.4.1 --- src/sys/arch/i386/Makefile:1.36 Thu Nov 6 00:41:52 2008 +++ src/sys/arch/i386/Makefile Sun May 31 14:32:33 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.36 2008/11/06 00:41:52 dyoung Exp $ +# $NetBSD: Makefile,v 1.36.4.1 2009/05/31 14:32:33 jym Exp $ # Makefile for i386 tags file and boot blocks @@ -11,9 +11,9 @@ ${SYSDIR}/arch/i386/mca/*.[ch] \ ${SYSDIR}/arch/i386/pci/*.[ch] \ ${SYSDIR}/arch/i386/pnpbios/*.[ch] \ - ${SYSDIR}/contrib/dev/ath/*.[ch] \ - ${SYSDIR}/contrib/dev/ath/netbsd/*.[ch] \ - ${SYSDIR}/contrib/dev/ath/public/*.[ch] \ + ${SYSDIR}/external/isc/atheros_hal/dist/*.[ch] \ + ${SYSDIR}/external/isc/atheros_hal/dist/*/*.[ch] \ + ${SYSDIR}/external/isc/atheros_hal/ic/*.[ch] \ ${SYSDIR}/dist/acpica/*.[ch] SI386+= ${SYSDIR}/arch/x86/x86/*.[ch] \ ${SYSDIR}/arch/x86/acpi/*.[ch] \ Index: src/sys/arch/i386/i386/bios32.c diff -u src/sys/arch/i386/i386/bios32.c:1.22.14.1 src/sys/arch/i386/i386/bios32.c:1.22.14.2 --- src/sys/arch/i386/i386/bios32.c:1.22.14.1 Wed May 13 17:17:49 2009 +++ src/sys/arch/i386/i386/bios32.c Sun May 31 14:32:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: bios32.c,v 1.22.14.1 2009/05/13 17:17:49 jym Exp $ */ +/* $NetBSD: bios32.c,v 1.22.14.2 2009/05/31 14:32:33 jym Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -86,7 +86,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.22.14.1 2009/05/13 17:17:49 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.22.14.2 2009/05/31 14:32:33 jym Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -327,7 +327,7 @@ if (i == indx) { if (va + len < end) { ret = dest; - memcpy( ret, va, len); + memcpy(ret, va, len); ret[len - 1] = '\0'; } } Index: src/sys/arch/i386/i386/gdt.c diff -u src/sys/arch/i386/i386/gdt.c:1.45.14.1 src/sys/arch/i386/i386/gdt.c:1.45.14.2 --- src/sys/arch/i386/i386/gdt.c:1.45.14.1 Wed May 13 17:17:49 2009 +++ src/sys/arch/i386/i386/gdt.c Sun May 31 14:32:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: gdt.c,v 1.45.14.1 2009/05/13 17:17:49 jym Exp $ */ +/* $NetBSD: gdt.c,v 1.45.14.2 2009/05/31 14:32:33 jym Exp $ */ /*- * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.45.14.1 2009/05/13 17:17:49 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.45.14.2 2009/05/31 14:32:33 jym Exp $"); #include "opt_multiprocessor.h" #include "opt_xen.h" @@ -66,7 +66,7 @@ int gdt_get_slot1(int); void gdt_put_slot1(int, int); -static void +void update_descriptor(union descriptor *table, union descriptor *entry) { #ifndef XEN Index: src/sys/arch/i386/include/elf_machdep.h diff -u src/sys/arch/i386/include/elf_machdep.h:1.9 src/sys/arch/i386/include/elf_machdep.h:1.9.138.1 --- src/sys/arch/i386/include/elf_machdep.h:1.9 Sun Dec 9 23:05:57 2001 +++ src/sys/arch/i386/include/elf_machdep.h Sun May 31 14:32:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_machdep.h,v 1.9 2001/12/09 23:05:57 thorpej Exp $ */ +/* $NetBSD: elf_machdep.h,v 1.9.138.1 2009/05/31 14:32:33 jym Exp $ */ #define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB #define ELF32_MACHDEP_ID_CASES \ @@ -26,10 +26,38 @@ #define R_386_RELATIVE 8 #define R_386_GOTOFF 9 #define R_386_GOTPC 10 + +/* TLS relocations */ +#define R_386_TLS_TPOFF 14 +#define R_386_TLS_IE 15 +#define R_386_TLS_GOTIE 16 +#define R_386_TLS_LE 17 +#define R_386_TLS_GD 18 +#define R_386_TLS_LDM 19 + /* The following relocations are GNU extensions. */ #define R_386_16 20 #define R_386_PC16 21 #define R_386_8 22 #define R_386_PC8 23 +/* More TLS relocations */ +#define R_386_TLS_GD_32 24 +#define R_386_TLS_GD_PUSH 25 +#define R_386_TLS_GD_CALL 26 +#define R_386_TLS_GD_POP 27 +#define R_386_TLS_LDM_32 28 +#define R_386_TLS_LDM_PUSH 29 +#define R_386_TLS_LDM_CALL 30 +#define R_386_TLS_LDM_POP 31 +#define R_386_TLS_LDO_32 32 +#define R_386_TLS_IE_32 33 +#define R_386_TLS_LE_32 34 +#define R_386_TLS_DTPMOD32 35 +#define R_386_TLS_DTPOFF32 36 +#define R_386_TLS_TPOFF32 37 +#define R_386_TLS_GOTDESC 39 +#define R_386_TLS_DESC_CALL 40 +#define R_386_TLS_DESC 41 + #define R_TYPE(name) __CONCAT(R_386_,name) Index: src/sys/arch/i386/include/segments.h diff -u src/sys/arch/i386/include/segments.h:1.50.8.1 src/sys/arch/i386/include/segments.h:1.50.8.2 --- src/sys/arch/i386/include/segments.h:1.50.8.1 Wed May 13 17:17:50 2009 +++ src/sys/arch/i386/include/segments.h Sun May 31 14:32:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: segments.h,v 1.50.8.1 2009/05/13 17:17:50 jym Exp $ */ +/* $NetBSD: segments.h,v 1.50.8.2 2009/05/31 14:32:33 jym Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -197,6 +197,7 @@ void setgdt(int, const void *, size_t, int, int, int, int); void unsetgate(struct gate_descriptor *); void cpu_init_idt(void); +void update_descriptor(union descriptor *, union descriptor *); #if !defined(XEN) void idt_init(void); Index: src/sys/arch/i386/pci/glxsb.c diff -u src/sys/arch/i386/pci/glxsb.c:1.6.14.1 src/sys/arch/i386/pci/glxsb.c:1.6.14.2 --- src/sys/arch/i386/pci/glxsb.c:1.6.14.1 Wed May 13 17:17:50 2009 +++ src/sys/arch/i386/pci/glxsb.c Sun May 31 14:32:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: glxsb.c,v 1.6.14.1 2009/05/13 17:17:50 jym Exp $ */ +/* $NetBSD: glxsb.c,v 1.6.14.2 2009/05/31 14:32:34 jym Exp $ */ /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */ /* @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.6.14.1 2009/05/13 17:17:50 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.6.14.2 2009/05/31 14:32:34 jym Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -331,7 +331,7 @@ if (ses == NULL) return (ENOMEM); if (sesn != 0) { - memcpy( ses, sc->sc_sessions, sesn * sizeof(*ses)); + memcpy(ses, sc->sc_sessions, sesn * sizeof(*ses)); memset(sc->sc_sessions, 0, sesn * sizeof(*ses)); free(sc->sc_sessions, M_DEVBUF); } @@ -347,7 +347,7 @@ ses->ses_klen = cri->cri_klen; /* Copy the key (Geode LX wants the primary key only) */ - memcpy( ses->ses_key, cri->cri_key, sizeof(ses->ses_key)); + memcpy(ses->ses_key, cri->cri_key, sizeof(ses->ses_key)); *sidp = GLXSB_SID(0, sesn); return (0); @@ -492,9 +492,9 @@ if (crd->crd_flags & CRD_F_ENCRYPT) { control = SB_CTL_ENC; if (crd->crd_flags & CRD_F_IV_EXPLICIT) - memcpy( op_iv, crd->crd_iv, sizeof(op_iv)); + memcpy(op_iv, crd->crd_iv, sizeof(op_iv)); else - memcpy( op_iv, ses->ses_iv, sizeof(op_iv)); + memcpy(op_iv, ses->ses_iv, sizeof(op_iv)); if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) { if (crp->crp_flags & CRYPTO_F_IMBUF) @@ -511,7 +511,7 @@ } else { control = SB_CTL_DEC; if (crd->crd_flags & CRD_F_IV_EXPLICIT) - memcpy( op_iv, crd->crd_iv, sizeof(op_iv)); + memcpy(op_iv, crd->crd_iv, sizeof(op_iv)); else { if (crp->crp_flags & CRYPTO_F_IMBUF) m_copydata((struct mbuf *)crp->crp_buf, @@ -557,7 +557,7 @@ cuio_copyback((struct uio *)crp->crp_buf, crd->crd_skip + offset, len, op_dst); else - memcpy( (char *)crp->crp_buf + crd->crd_skip + offset, op_dst, + memcpy((char *)crp->crp_buf + crd->crd_skip + offset, op_dst, len); offset += len; @@ -576,11 +576,11 @@ * time. */ if (crd->crd_flags & CRD_F_ENCRYPT) { - memcpy( piv, op_dst + len - sizeof(op_iv), sizeof(op_iv)); + memcpy(piv, op_dst + len - sizeof(op_iv), sizeof(op_iv)); } else { /* Decryption, only need this if another iteration */ if (tlen > 0) { - memcpy( piv, op_src + len - sizeof(op_iv), + memcpy(piv, op_src + len - sizeof(op_iv), sizeof(op_iv)); } } Index: src/sys/arch/x86/include/cacheinfo.h diff -u src/sys/arch/x86/include/cacheinfo.h:1.9.12.1 src/sys/arch/x86/include/cacheinfo.h:1.9.12.2 --- src/sys/arch/x86/include/cacheinfo.h:1.9.12.1 Wed May 13 17:18:44 2009 +++ src/sys/arch/x86/include/cacheinfo.h Sun May 31 14:32:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cacheinfo.h,v 1.9.12.1 2009/05/13 17:18:44 jym Exp $ */ +/* $NetBSD: cacheinfo.h,v 1.9.12.2 2009/05/31 14:32:34 jym Exp $ */ #ifndef _X86_CACHEINFO_H_ #define _X86_CACHEINFO_H_ @@ -199,6 +199,10 @@ #define __CI_TBL(a,b,c,d,e,f) { a, b, c, d, e, f } #endif +/* + * XXX Currently organized mostly by cache type, but would be + * XXX easier to maintain if it were in descriptor type order. + */ #define INTEL_CACHE_INFO { \ __CI_TBL(CAI_ITLB, 0x01, 4, 32, 4 * 1024, NULL), \ __CI_TBL(CAI_ITLB, 0xb0, 4,128, 4 * 1024, NULL), \ @@ -211,14 +215,23 @@ __CI_TBL(CAI_ITLB, 0x50, 0xff, 64, 4 * 1024, "4K/4M: 64 entries"), \ __CI_TBL(CAI_ITLB, 0x51, 0xff, 64, 4 * 1024, "4K/4M: 128 entries"),\ __CI_TBL(CAI_ITLB, 0x52, 0xff, 64, 4 * 1024, "4K/4M: 256 entries"),\ +__CI_TBL(CAI_ITLB, 0x55, 0xff, 64, 4 * 1024, "2M/4M: 7 entries"), \ +__CI_TBL(CAI_DTLB2, 0x56, 4, 16, 4 * 1024 * 1024, NULL), \ +__CI_TBL(CAI_DTLB2, 0x57, 4, 16, 4 * 1024, NULL), \ +__CI_TBL(CAI_DTLB, 0x5a, 0xff, 64, 4 * 1024, "2M/4M: 32 entries (L0)"), \ __CI_TBL(CAI_DTLB, 0x5b, 0xff, 64, 4 * 1024, "4K/4M: 64 entries"), \ __CI_TBL(CAI_DTLB, 0x5c, 0xff, 64, 4 * 1024, "4K/4M: 128 entries"),\ __CI_TBL(CAI_DTLB, 0x5d, 0xff, 64, 4 * 1024, "4K/4M: 256 entries"),\ +__CI_TBL(CAI_ITLB, 0xb1, 4, 64, 0, "8 2M/4 4M entries"), \ +__CI_TBL(CAI_ITLB, 0xb2, 4, 64, 4 * 1024, NULL), \ __CI_TBL(CAI_ICACHE, 0x06, 4, 8 * 1024, 32, NULL), \ __CI_TBL(CAI_ICACHE, 0x08, 4, 16 * 1024, 32, NULL), \ +__CI_TBL(CAI_ICACHE, 0x09, 4, 32 * 1024, 64, NULL), \ __CI_TBL(CAI_ICACHE, 0x30, 8, 32 * 1024, 64, NULL), \ __CI_TBL(CAI_DCACHE, 0x0a, 2, 8 * 1024, 32, NULL), \ __CI_TBL(CAI_DCACHE, 0x0c, 4, 16 * 1024, 32, NULL), \ +__CI_TBL(CAI_DCACHE, 0x0d, 4, 16 * 1024, 32, NULL), \ +__CI_TBL(CAI_L2CACHE, 0x21, 8, 256 * 1024, 64, NULL), /* L2 (MLC) */ \ __CI_TBL(CAI_L2CACHE, 0x39, 4, 128 * 1024, 64, NULL), \ __CI_TBL(CAI_L2CACHE, 0x3a, 6, 192 * 1024, 64, NULL), \ __CI_TBL(CAI_L2CACHE, 0x3b, 2, 128 * 1024, 64, NULL), \ @@ -231,6 +244,9 @@ __CI_TBL(CAI_L2CACHE, 0x43, 4, 512 * 1024, 32, NULL), \ __CI_TBL(CAI_L2CACHE, 0x44, 4, 1 * 1024 * 1024, 32, NULL), \ __CI_TBL(CAI_L2CACHE, 0x45, 4, 2 * 1024 * 1024, 32, NULL), \ +__CI_TBL(CAI_L2CACHE, 0x48, 12, 3 * 1024 * 1024, 64, NULL), \ + \ +/* 0x49 Is L2 on Xeon MP (Family 0f, Model 06), L3 otherwise */ \ __CI_TBL(CAI_L2CACHE, 0x49, 16, 4 * 1024 * 1024, 64, NULL), \ __CI_TBL(CAI_L2CACHE, 0x4e, 24, 6 * 1024 * 1024, 64, NULL), \ __CI_TBL(CAI_DCACHE, 0x60, 8, 16 * 1024, 64, NULL), \ @@ -255,6 +271,32 @@ __CI_TBL(CAI_L2CACHE, 0x85, 8, 2 * 1024 * 1024, 32, NULL), \ __CI_TBL(CAI_L2CACHE, 0x86, 4, 512 * 1024, 64, NULL), \ __CI_TBL(CAI_L2CACHE, 0x87, 8, 1 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0x22, 0xff, 512 * 1024, 64, "sectored, 4-way "), \ +__CI_TBL(CAI_L3CACHE, 0x23, 0xff, 1 * 1024 * 1024, 64, "sectored, 8-way "), \ +__CI_TBL(CAI_L3CACHE, 0x25, 0xff, 2 * 1024 * 1024, 64, "sectored, 8-way "), \ +__CI_TBL(CAI_L3CACHE, 0x29, 0xff, 4 * 1024 * 1024, 64, "sectored, 8-way "), \ +__CI_TBL(CAI_L3CACHE, 0x46, 4, 4 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0x47, 8, 8 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0x49, 16, 4 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0x4a, 12, 6 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0x4b, 16, 8 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0x4c, 12,12 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0x4d, 16,16 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xd0, 4, 512 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xd1, 4, 1 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xd2, 4, 2 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xd6, 8, 1 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xd7, 8, 2 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xd8, 8, 4 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xdc, 12, 3 * 512 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xdd, 12, 3 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xde, 12, 6 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xe2, 16, 2 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xe3, 16, 4 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xe4, 16, 8 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xea, 24,12 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xeb, 24,24 * 1024 * 1024, 64, NULL), \ +__CI_TBL(CAI_L3CACHE, 0xec, 24,24 * 1024 * 1024, 64, NULL), \ __CI_TBL(0, 0, 0, 0, 0, NULL) \ } Index: src/sys/arch/x86/include/specialreg.h diff -u src/sys/arch/x86/include/specialreg.h:1.31.8.1 src/sys/arch/x86/include/specialreg.h:1.31.8.2 --- src/sys/arch/x86/include/specialreg.h:1.31.8.1 Wed May 13 17:18:44 2009 +++ src/sys/arch/x86/include/specialreg.h Sun May 31 14:32:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: specialreg.h,v 1.31.8.1 2009/05/13 17:18:44 jym Exp $ */ +/* $NetBSD: specialreg.h,v 1.31.8.2 2009/05/31 14:32:34 jym Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -121,24 +121,27 @@ #define CPUID_IA64 0x40000000 /* IA-64 architecture */ #define CPUID_SBF 0x80000000 /* signal break on FERR */ -#define CPUID_FLAGS1 "\20\1FPU\2VME\3DE\4PSE\5TSC\6MSR\7PAE" \ - "\10MCE\11CX8\12APIC\13B10\14SEP\15MTRR" -#define CPUID_MASK1 0x00001fff -#define CPUID_FLAGS2 "\20\16PGE\17MCA\20CMOV\21PAT\22PSE36\23PN\24CFLUSH" \ - "\25B20\26DS\27ACPI\30MMX" -#define CPUID_MASK2 0x00ffe000 -#define CPUID_FLAGS3 "\20\31FXSR\32SSE\33SSE2\34SS\35HTT\36TM\37IA64\40SBF" -#define CPUID_MASK3 0xff000000 +#define CPUID_FLAGS1 "\20\1FPU\2VME\3DE\4PSE\5TSC\6MSR\7PAE\10MCE\11CX8" \ + "\12APIC\13B10\14SEP\15MTRR\16PGE\17MCA\20CMOV" \ + "\21PAT\22PSE36\23PN\24CFLUSH\25B20\26DS\27ACPI" \ + "\30MMX\31FXSR\32SSE\33SSE2\34SS\35HTT\36TM" \ + "\37IA64\40SBF" /* - * CPUID Intel extended features + * CPUID Intel extended features - %EDX */ #define CPUID_SYSCALL 0x00000800 /* SYSCALL/SYSRET */ #define CPUID_XD 0x00100000 /* Execute Disable */ #define CPUID_EM64T 0x20000000 /* Intel EM64T */ -#define CPUID_INTEL_MASK4 0x20100800 -#define CPUID_INTEL_FLAGS4 "\20\14SYSCALL/SYSRET\25XD\36EM64T" +#define CPUID_INTEL_EXT_FLAGS "\20\14SYSCALL/SYSRET\25XD\36EM64T" + +/* + * CPUID Intel extended features - %ECX + */ +#define CPUID_LAHF 0x00000001 /* LAHF/SAHF in IA-32e mode, 64bit sub*/ + +#define CPUID_INTEL_FLAGS4 "\20\1LAHF" /* * AMD/VIA processor specific flags. @@ -155,8 +158,8 @@ #define CPUID_3DNOW2 0x40000000 /* 3DNow! Instruction Extension */ #define CPUID_3DNOW 0x80000000 /* 3DNow! Instructions */ -#define CPUID_EXT_FLAGS "\20\14SCALL/RET\24MPC\25NOX\27MXX\32FFXSR\33P1GB" \ - "\34RDTSCP\36LONG\0373DNOW2\0403DNOW" +#define CPUID_EXT_FLAGS "\20\14SYSCALL/SYSRET\24MPC\25NOX\27MXX\32FFXSR" \ + "\33P1GB\34RDTSCP\36LONG\0373DNOW2\0403DNOW" /* AMD Fn80000001 %ecx features */ @@ -175,7 +178,6 @@ #define CPUID_SKINIT 0x00001000 /* SKINIT */ #define CPUID_WDT 0x00002000 /* watchdog timer support */ -#define CPUID_AMD_MASK4 0x00003fff #define CPUID_AMD_FLAGS4 "\20\1LAHF\2CMPLEGACY\3SVM\4EAPIC\5ALTMOVCR0" \ "\6LZCNT\7SSE4A\10MISALIGNSSE" \ "\0113DNOWPREFETCH\12OSVW\13IBS" \ @@ -204,8 +206,8 @@ #define CPUID_APM_HWP 0x00000080 /* HW P-State control */ #define CPUID_APM_TSC 0x00000100 /* TSC invariant */ -#define CPUID_APM_FLAGS "\20\1TS\2FID\3VID\4TTP\5HTC\6STC\007100\10HWP\11TSC" - +#define CPUID_APM_FLAGS "\20\1TS\2FID\3VID\4TTP\5HTC\6STC\007100" \ + "\10HWP\11TSC" /* * Centaur Extended Feature flags @@ -246,9 +248,11 @@ #define CPUID2_X2APIC 0x00200000 /* xAPIC Extensions */ #define CPUID2_POPCNT 0x00800000 -#define CPUID2_FLAGS "\20\1SSE3\3DTES64\4MONITOR\5DS-CPL\6VMX\7SMX\10EST" \ - "\11TM2\12SSSE3\13CID\16CX16\17xTPR\20PDCM\23DCA" \ - "\24SSE41\25SSE42\26X2APIC\30POPCNT" +#define CPUID2_FLAGS1 "\20\1SSE3\2B01\3DTES64\4MONITOR\5DS-CPL\6VMX\7SMX" \ + "\10EST\11TM2\12SSSE3\13CID\14B11\15B12\16CX16" \ + "\17xTPR\20PDCM\21B16\22B17\23DCA\24SSE41\25SSE42" \ + "\26X2APIC\27MOVBE\30POPCNT\31B24\32B25\33XSAVE" \ + "\34OSXSAVE\35B28\36B29\37B30\40B31" #define CPUID2FAMILY(cpuid) (((cpuid) >> 8) & 0xf) #define CPUID2MODEL(cpuid) (((cpuid) >> 4) & 0xf) @@ -420,6 +424,7 @@ #define MSR_NB_CFG 0xc001001f #define NB_CFG_DISIOREQLOCK 0x0000000000000004ULL #define NB_CFG_DISDATMSK 0x0000001000000000ULL +#define NB_CFG_INITAPICCPUIDLO (1ULL << 54) #define MSR_LS_CFG 0xc0011020 #define LS_CFG_DIS_LS2_SQUISH 0x02000000 Index: src/sys/arch/x86/x86/cpu_topology.c diff -u src/sys/arch/x86/x86/cpu_topology.c:1.1.4.2 src/sys/arch/x86/x86/cpu_topology.c:1.1.4.3 --- src/sys/arch/x86/x86/cpu_topology.c:1.1.4.2 Wed May 13 17:18:45 2009 +++ src/sys/arch/x86/x86/cpu_topology.c Sun May 31 14:32:34 2009 @@ -1,7 +1,8 @@ -/* $NetBSD: cpu_topology.c,v 1.1.4.2 2009/05/13 17:18:45 jym Exp $ */ +/* $NetBSD: cpu_topology.c,v 1.1.4.3 2009/05/31 14:32:34 jym Exp $ */ /*- - * Copyright (c)2008 YAMAMOTO Takashi, + * Copyright (c) 2009 Mindaugas Rasiukevicius <rmind at NetBSD org>, + * Copyright (c) 2008 YAMAMOTO Takashi, * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,8 +27,16 @@ * SUCH DAMAGE. */ +/* + * x86 CPU topology detection. + * + * References: + * - 53668.pdf (7.10.2), 276613.pdf + * - 31116.pdf, 41256.pdf, 25481.pdf + */ + #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.1.4.2 2009/05/13 17:18:45 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.1.4.3 2009/05/31 14:32:34 jym Exp $"); #include <sys/param.h> #include <sys/bitops.h> @@ -42,49 +51,123 @@ void x86_cpu_toplogy(struct cpu_info *ci) { - u_int lp_max = 1; /* logical processors per package */ - u_int smt_max; /* smt per core */ - u_int core_max = 1; /* core per package */ - int smt_bits, core_bits; - uint32_t descs[4]; + u_int lp_max; /* Logical processors per package */ + u_int core_max; /* Core per package */ + int n, cpu_family, apic_id, smt_bits, core_bits = 0; + uint32_t descs[4], lextmode; + + apic_id = ci->ci_initapicid; + cpu_family = CPUID2FAMILY(ci->ci_signature); + + /* Initial values. */ + ci->ci_packageid = apic_id; + ci->ci_coreid = 0; + ci->ci_smtid = 0; - if (cpu_vendor != CPUVENDOR_INTEL || - CPUID2FAMILY(ci->ci_signature) < 6) + switch (cpu_vendor) { + case CPUVENDOR_INTEL: + if (cpu_family < 6) + return; + break; + case CPUVENDOR_AMD: + if (cpu_family < 0xf) + return; + break; + default: return; + } /* Determine the extended feature flags. */ x86_cpuid(0x80000000, descs); - if (descs[0] >= 0x80000001) { + lextmode = descs[0]; + if (lextmode >= 0x80000001) { x86_cpuid(0x80000001, descs); - ci->ci_feature3_flags |= descs[3]; /* %edx */ + ci->ci_feature3_flags |= descs[3]; /* edx */ } - /* Determine topology. 253668.pdf 7.10.2. */ - ci->ci_packageid = ci->ci_initapicid; - ci->ci_coreid = 0; - ci->ci_smtid = 0; + /* Check for HTT support. See notes below regarding AMD. */ if ((ci->ci_feature_flags & CPUID_HTT) != 0) { + /* Maximum number of LPs sharing a cache (ebx[23:16]). */ x86_cpuid(1, descs); lp_max = (descs[1] >> 16) & 0xff; + } else { + lp_max = 1; } - x86_cpuid(0, descs); - if (descs[0] >= 4) { - x86_cpuid2(4, 0, descs); - core_max = (descs[0] >> 26) + 1; + + switch (cpu_vendor) { + case CPUVENDOR_INTEL: + /* Check for leaf 4 support. */ + x86_cpuid(0, descs); + if (descs[0] >= 4) { + /* Maximum number of Cores per package (eax[31:26]). */ + x86_cpuid2(4, 0, descs); + core_max = (descs[0] >> 26) + 1; + } else { + core_max = 1; + } + break; + case CPUVENDOR_AMD: + /* In a case of AMD, HTT flag means CMP support. */ + if ((ci->ci_feature_flags & CPUID_HTT) == 0) { + core_max = 1; + break; + } + /* Legacy Method, LPs represent Cores. */ + if (cpu_family < 0x10 || lextmode < 0x80000008) { + core_max = lp_max; + break; + } + /* Number of Cores (NC) per package (ecx[7:0]). */ + x86_cpuid(0x80000008, descs); + core_max = (descs[2] & 0xff) + 1; + /* Amount of bits representing Core ID (ecx[15:12]). */ + n = (descs[2] >> 12) & 0x0f; + if (n != 0) { + /* + * Extended Method. + * core_bits = 2 ^ n (power of two) + */ + core_bits = 1 << n; + } + break; + default: + core_max = 1; } + KASSERT(lp_max >= core_max); - smt_max = lp_max / core_max; - smt_bits = ilog2(smt_max - 1) + 1; - core_bits = ilog2(core_max - 1) + 1; + smt_bits = ilog2((lp_max / core_max) - 1) + 1; + if (core_bits == 0) { + core_bits = ilog2(core_max - 1) + 1; + } + + /* + * Family 0xf and 0x10 processors may have different structure of + * APIC ID. Detect that via special MSR register and move the bits, + * if necessary (ref: InitApicIdCpuIdLo). + */ + if (cpu_vendor == CPUVENDOR_AMD && cpu_family < 0x11) { /* XXX */ + const uint64_t reg = rdmsr(MSR_NB_CFG); + if ((reg & NB_CFG_INITAPICCPUIDLO) == 0) { + /* + * 0xf: { CoreId, NodeId[2:0] } + * 0x10: { CoreId[1:0], 000b, NodeId[2:0] } + */ + const u_int node_id = apic_id & __BITS(0, 2); + apic_id = (cpu_family == 0xf) ? + (apic_id >> core_bits) | (node_id << core_bits) : + (apic_id >> 5) | (node_id << 2); + } + } + if (smt_bits + core_bits) { - ci->ci_packageid = ci->ci_initapicid >> (smt_bits + core_bits); + ci->ci_packageid = apic_id >> (smt_bits + core_bits); } if (core_bits) { u_int core_mask = __BITS(smt_bits, smt_bits + core_bits - 1); - ci->ci_coreid = __SHIFTOUT(ci->ci_initapicid, core_mask); + ci->ci_coreid = __SHIFTOUT(apic_id, core_mask); } if (smt_bits) { u_int smt_mask = __BITS(0, smt_bits - 1); - ci->ci_smtid = __SHIFTOUT(ci->ci_initapicid, smt_mask); + ci->ci_smtid = __SHIFTOUT(apic_id, smt_mask); } } Index: src/sys/arch/x86/x86/ioapic.c diff -u src/sys/arch/x86/x86/ioapic.c:1.38.10.1 src/sys/arch/x86/x86/ioapic.c:1.38.10.2 --- src/sys/arch/x86/x86/ioapic.c:1.38.10.1 Wed May 13 17:18:45 2009 +++ src/sys/arch/x86/x86/ioapic.c Sun May 31 14:32:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ioapic.c,v 1.38.10.1 2009/05/13 17:18:45 jym Exp $ */ +/* $NetBSD: ioapic.c,v 1.38.10.2 2009/05/31 14:32:34 jym Exp $ */ /*- * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.38.10.1 2009/05/13 17:18:45 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.38.10.2 2009/05/31 14:32:34 jym Exp $"); #include "opt_ddb.h" @@ -409,14 +409,15 @@ pp = &sc->sc_pins[pin]; map = pp->ip_map; redlo = map == NULL ? IOAPIC_REDLO_MASK : map->redir; + redhi = 0; delmode = (redlo & IOAPIC_REDLO_DEL_MASK) >> IOAPIC_REDLO_DEL_SHIFT; - redhi = (ci->ci_cpuid << IOAPIC_REDHI_DEST_SHIFT); if (delmode == IOAPIC_REDLO_DEL_FIXED || delmode == IOAPIC_REDLO_DEL_LOPRI) { if (pp->ip_type == IST_NONE) { redlo |= IOAPIC_REDLO_MASK; } else { + redhi = (ci->ci_cpuid << IOAPIC_REDHI_DEST_SHIFT); redlo |= (idt_vec & 0xff); redlo |= (IOAPIC_REDLO_DEL_FIXED<<IOAPIC_REDLO_DEL_SHIFT); redlo &= ~IOAPIC_REDLO_DSTMOD; Index: src/sys/arch/x86/x86/sys_machdep.c diff -u src/sys/arch/x86/x86/sys_machdep.c:1.16.4.1 src/sys/arch/x86/x86/sys_machdep.c:1.16.4.2 --- src/sys/arch/x86/x86/sys_machdep.c:1.16.4.1 Wed May 13 17:18:45 2009 +++ src/sys/arch/x86/x86/sys_machdep.c Sun May 31 14:32:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.16.4.1 2009/05/13 17:18:45 jym Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.16.4.2 2009/05/31 14:32:34 jym Exp $ */ /*- * Copyright (c) 1998, 2007, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.16.4.1 2009/05/13 17:18:45 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.16.4.2 2009/05/31 14:32:34 jym Exp $"); #include "opt_mtrr.h" #include "opt_perfctrs.h" @@ -591,7 +591,7 @@ x86_set_sdbase(void *arg, char which, lwp_t *l, bool direct) { #ifdef i386 - struct segment_descriptor sd; + union descriptor usd; struct pcb *pcb; vaddr_t base; int error; @@ -604,28 +604,30 @@ return error; } - sd.sd_lobase = base & 0xffffff; - sd.sd_hibase = (base >> 24) & 0xff; - sd.sd_lolimit = 0xffff; - sd.sd_hilimit = 0xf; - sd.sd_type = SDT_MEMRWA; - sd.sd_dpl = SEL_UPL; - sd.sd_p = 1; - sd.sd_xx = 0; - sd.sd_def32 = 1; - sd.sd_gran = 1; + usd.sd.sd_lobase = base & 0xffffff; + usd.sd.sd_hibase = (base >> 24) & 0xff; + usd.sd.sd_lolimit = 0xffff; + usd.sd.sd_hilimit = 0xf; + usd.sd.sd_type = SDT_MEMRWA; + usd.sd.sd_dpl = SEL_UPL; + usd.sd.sd_p = 1; + usd.sd.sd_xx = 0; + usd.sd.sd_def32 = 1; + usd.sd.sd_gran = 1; kpreempt_disable(); pcb = &l->l_addr->u_pcb; if (which == 'f') { - memcpy(&pcb->pcb_fsd, &sd, sizeof(sd)); + memcpy(&pcb->pcb_fsd, &usd.sd, + sizeof(struct segment_descriptor)); if (l == curlwp) { - memcpy(&curcpu()->ci_gdt[GUFS_SEL], &sd, sizeof(sd)); + update_descriptor(&curcpu()->ci_gdt[GUFS_SEL], &usd); } } else /* which == 'g' */ { - memcpy(&pcb->pcb_gsd, &sd, sizeof(sd)); + memcpy(&pcb->pcb_gsd, &usd.sd, + sizeof(struct segment_descriptor)); if (l == curlwp) { - memcpy(&curcpu()->ci_gdt[GUGS_SEL], &sd, sizeof(sd)); + update_descriptor(&curcpu()->ci_gdt[GUGS_SEL], &usd); } } kpreempt_enable(); Index: src/sys/arch/xen/Makefile diff -u src/sys/arch/xen/Makefile:1.5 src/sys/arch/xen/Makefile:1.5.8.1 --- src/sys/arch/xen/Makefile:1.5 Sat Oct 25 22:27:38 2008 +++ src/sys/arch/xen/Makefile Sun May 31 14:32:34 2009 @@ -1,4 +1,6 @@ -# $NetBSD: Makefile,v 1.5 2008/10/25 22:27:38 apb Exp $ +# $NetBSD: Makefile,v 1.5.8.1 2009/05/31 14:32:34 jym Exp $ + +.include <bsd.own.mk> # Makefile for xen tags file @@ -20,8 +22,9 @@ DXEN= xen ${XEN_MACHINE_ARCHS} include tags: - rm -f ${TXEN} - -echo ${SXEN} ${COMM} | xargs ctags -wadtf ${TXEN} + -rm -f ${TXEN} + -echo ${SXEN} | xargs ctags -wadtf ${TXEN} + ${FINDCOMM} | xargs ctags -wadtf ${TXEN} egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AXEN} | \ ${TOOL_SED} -e \ "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \