--- lib/libpmc/libpmc.c (revision 215501) +++ lib/libpmc/libpmc.c (local) @@ -81,6 +81,8 @@ #if defined(__mips__) static int mips24k_allocate_pmc(enum pmc_event _pe, char* ctrspec, struct pmc_op_pmcallocate *_pmc_config); +static int octeon_allocate_pmc(enum pmc_event _pe, char* ctrspec, + struct pmc_op_pmcallocate *_pmc_config); #endif /* __mips__ */ @@ -148,6 +150,7 @@ PMC_CLASSDEP_TABLE(p6, P6); PMC_CLASSDEP_TABLE(xscale, XSCALE); PMC_CLASSDEP_TABLE(mips24k, MIPS24K); +PMC_CLASSDEP_TABLE(octeon, OCTEON); PMC_CLASSDEP_TABLE(ucf, UCF); #undef __PMC_EV_ALIAS @@ -211,6 +214,7 @@ PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); +PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_OCTEON); static const struct pmc_event_descr tsc_event_table[] = { @@ -261,6 +265,7 @@ #if defined(__mips__) PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips24k); +PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, octeon); #endif /* __mips__ */ #undef PMC_CLASS_TABLE_DESC @@ -2183,6 +2188,13 @@ EV_ALIAS(NULL, NULL) }; +static struct pmc_event_alias octeon_aliases[] = { + EV_ALIAS("clock", "CLK"), + EV_ALIAS(NULL, NULL) +}; + + + #define MIPS24K_KW_OS "os" #define MIPS24K_KW_USR "usr" #define MIPS24K_KW_ANYTHREAD "anythread" @@ -2210,6 +2222,31 @@ return (0); } + +static int +octeon_allocate_pmc(enum pmc_event pe, char *ctrspec __unused, + struct pmc_op_pmcallocate *pmc_config __unused) +{ + char *p; + + (void) pe; + + pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); + + while ((p = strsep(&ctrspec, ",")) != NULL) { + if (KWMATCH(p, MIPS24K_KW_OS)) + pmc_config->pm_caps |= PMC_CAP_SYSTEM; + else if (KWMATCH(p, MIPS24K_KW_USR)) + pmc_config->pm_caps |= PMC_CAP_USER; + else if (KWMATCH(p, MIPS24K_KW_ANYTHREAD)) + pmc_config->pm_caps |= (PMC_CAP_USER | PMC_CAP_SYSTEM); + else + return (-1); + } + + return (0); +} + #endif /* __mips__ */ @@ -2310,11 +2347,13 @@ /* replace an event alias with the canonical event specifier */ if (pmc_mdep_event_aliases) - for (alias = pmc_mdep_event_aliases; alias->pm_alias; alias++) + for (alias = pmc_mdep_event_aliases; alias->pm_alias; alias++) { + printf(">>>> %s %s\n", ctrspec, alias->pm_alias); if (!strcasecmp(ctrspec, alias->pm_alias)) { spec_copy = strdup(alias->pm_spec); break; } + } if (spec_copy == NULL) spec_copy = strdup(ctrspec); @@ -2573,6 +2612,10 @@ ev = mips24k_event_table; count = PMC_EVENT_TABLE_SIZE(mips24k); break; + case PMC_CLASS_OCTEON: + ev = octeon_event_table; + count = PMC_EVENT_TABLE_SIZE(octeon); + break; default: errno = EINVAL; return (-1); @@ -2774,9 +2817,15 @@ #endif #if defined(__mips__) case PMC_CPU_MIPS_24K: + printf("mips24k\n"); PMC_MDEP_INIT(mips24k); pmc_class_table[n] = &mips24k_class_table_descr; break; + case PMC_CPU_MIPS_OCTEON: + printf("octeon\n"); + PMC_MDEP_INIT(octeon); + pmc_class_table[n] = &octeon_class_table_descr; + break; #endif /* __mips__ */ default: /* @@ -2918,6 +2967,9 @@ ev = mips24k_event_table; evfence = mips24k_event_table + PMC_EVENT_TABLE_SIZE(mips24k ); + } else if (pe >= PMC_EV_OCTEON_FIRST && pe <= PMC_EV_OCTEON_LAST) { + ev = octeon_event_table; + evfence = octeon_event_table + PMC_EVENT_TABLE_SIZE(octeon); } else if (pe == PMC_EV_TSC_TSC) { ev = tsc_event_table; evfence = tsc_event_table + PMC_EVENT_TABLE_SIZE(tsc); --- share/man/man5/src.conf.5 (revision 215501) +++ share/man/man5/src.conf.5 (local) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. -.\" from FreeBSD: head/tools/build/options/makeman 188848 2009-02-20 11:09:55Z mtm +.\" from FreeBSD$ .\" $FreeBSD$ -.Dd August 25, 2010 +.Dd October 18, 2010 .Dt SRC.CONF 5 .Os .Sh NAME @@ -78,51 +78,51 @@ that can be used for source builds. .Bl -tag -width indent .It Va WITHOUT_ACCT -.\" from FreeBSD: head/tools/build/options/WITHOUT_ACCT 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build process accounting tools such as .Xr ac 8 and .Xr accton 8 . .It Va WITHOUT_ACPI -.\" from FreeBSD: head/tools/build/options/WITHOUT_ACPI 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr acpiconf 8 , .Xr acpidump 8 and related programs. .It Va WITHOUT_AMD -.\" from FreeBSD: head/tools/build/options/WITHOUT_AMD 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr amd 8 , and related programs. .It Va WITHOUT_APM -.\" from FreeBSD: head/tools/build/options/WITHOUT_APM 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr apm 8 , .Xr apmd 8 and related programs. .It Va WITHOUT_ASSERT_DEBUG -.\" from FreeBSD: head/tools/build/options/WITHOUT_ASSERT_DEBUG 162215 2006-09-11 13:55:27Z ru +.\" $FreeBSD$ Set to compile programs and libraries without the .Xr assert 3 checks. .It Va WITHOUT_AT -.\" from FreeBSD: head/tools/build/options/WITHOUT_AT 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr at 1 and related utilities. .It Va WITHOUT_ATM -.\" from FreeBSD: head/tools/build/options/WITHOUT_ATM 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build programs and libraries related to ATM networking. .It Va WITHOUT_AUDIT -.\" from FreeBSD: head/tools/build/options/WITHOUT_AUDIT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build audit support into system programs. .It Va WITHOUT_AUTHPF -.\" from FreeBSD: head/tools/build/options/WITHOUT_AUTHPF 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr authpf 8 . .It Va WITHOUT_BIND -.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Setting this variable will prevent any part of BIND from being built. When set, it also enforces the following options: .Pp @@ -141,31 +141,31 @@ .Va WITHOUT_BIND_UTILS .El .It Va WITHOUT_BIND_DNSSEC -.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_DNSSEC 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to avoid building or installing the DNSSEC related binaries, .Xr dnssec-keygen 8 and .Xr dnssec-signzone 8 . .It Va WITHOUT_BIND_ETC -.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_ETC 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to avoid installing the default files to .Pa /var/named/etc/namedb . .It Va WITH_BIND_IDN -.\" from FreeBSD: head/tools/build/options/WITH_BIND_IDN 193280 2009-06-01 21:58:59Z dougb +.\" $FreeBSD$ Set to enable IDN support for dig, host, and nslookup. This requires ports/dns/idnkit to be installed in /usr/local. .It Va WITH_BIND_LARGE_FILE -.\" from FreeBSD: head/tools/build/options/WITH_BIND_LARGE_FILE 193280 2009-06-01 21:58:59Z dougb +.\" $FreeBSD$ Set to enable 64-bit file support. .It Va WITH_BIND_LIBS -.\" from FreeBSD: head/tools/build/options/WITH_BIND_LIBS 193280 2009-06-01 21:58:59Z dougb +.\" $FreeBSD$ Set to install BIND libraries and include files. .It Va WITHOUT_BIND_LIBS_LWRES -.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_LIBS_LWRES 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to avoid installing the lightweight resolver library in .Pa /usr/lib . .It Va WITHOUT_BIND_MTREE -.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_MTREE 157717 2006-04-13 10:37:29Z ru +.\" $FreeBSD$ Set to avoid running .Xr mtree 8 to create the chroot directory structure under @@ -180,7 +180,7 @@ .Va WITHOUT_BIND_ETC .El .It Va WITHOUT_BIND_NAMED -.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_NAMED 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to avoid building or installing .Xr named 8 , .Xr named.reload 8 , @@ -190,10 +190,10 @@ and .Xr rndc-confgen 8 . .It Va WITH_BIND_SIGCHASE -.\" from FreeBSD: head/tools/build/options/WITH_BIND_SIGCHASE 193280 2009-06-01 21:58:59Z dougb +.\" $FreeBSD$ Set to enable DNSSEC validation support for dig, host, and nslookup. .It Va WITHOUT_BIND_UTILS -.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_UTILS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to avoid building or installing the BIND userland utilities, .Xr dig 1 , .Xr host 1 , @@ -201,29 +201,29 @@ and .Xr nsupdate 8 . .It Va WITH_BIND_XML -.\" from FreeBSD: head/tools/build/options/WITH_BIND_XML 193280 2009-06-01 21:58:59Z dougb +.\" $FreeBSD$ Set to enable the http statistics interface for named. This requires ports/textproc/libxml2 to be installed in /usr/local. .It Va WITHOUT_BLUETOOTH -.\" from FreeBSD: head/tools/build/options/WITHOUT_BLUETOOTH 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build Bluetooth related kernel modules, programs and libraries. .It Va WITHOUT_BOOT -.\" from FreeBSD: head/tools/build/options/WITHOUT_BOOT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build the boot blocks and loader. .It Va WITHOUT_BSD_CPIO -.\" from FreeBSD: head/tools/build/options/WITHOUT_BSD_CPIO 179813 2008-06-16 05:48:15Z dougb +.\" $FreeBSD$ Set to not build the BSD licensed version of cpio based on .Xr libarchive 3 . .It Va WITH_BSD_GREP -.\" from FreeBSD: head/tools/build/options/WITH_BSD_GREP 211701 2010-08-23 10:04:26Z gabor +.\" $FreeBSD$ Build BSD-licensed grep instead of GNU grep. .It Va WITHOUT_BSNMP -.\" from FreeBSD: head/tools/build/options/WITHOUT_BSNMP 183306 2008-09-23 16:15:42Z sam +.\" $FreeBSD$ Set to not build or install .Xr bsnmpd 1 and related libraries and data files. .It Va WITHOUT_BZIP2 -.\" from FreeBSD: head/tools/build/options/WITHOUT_BZIP2 174550 2007-12-12 16:43:17Z ru +.\" $FreeBSD$ Set to not build contributed bzip2 software as a part of the base system. .Bf -symbolic The option has no effect yet. @@ -235,14 +235,14 @@ .Va WITHOUT_BZIP2_SUPPORT .El .It Va WITHOUT_BZIP2_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_BZIP2_SUPPORT 166255 2007-01-26 10:19:08Z delphij +.\" $FreeBSD$ Set to build some programs without optional bzip2 support. .It Va WITHOUT_CALENDAR -.\" from FreeBSD: head/tools/build/options/WITHOUT_CALENDAR 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr calendar 1 . .It Va WITHOUT_CDDL -.\" from FreeBSD: head/tools/build/options/WITHOUT_CDDL 163861 2006-11-01 09:02:11Z jb +.\" $FreeBSD$ Set to not build code licensed under Sun's CDDL. When set, it also enforces the following options: .Pp @@ -251,14 +251,14 @@ .Va WITHOUT_ZFS .El .It Va WITHOUT_CLANG -.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG 208971 2010-06-10 06:20:26Z ed +.\" $FreeBSD$ Set to not build the Clang C/C++ compiler. .It Va WITHOUT_CPP -.\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr cpp 1 . .It Va WITHOUT_CRYPT -.\" from FreeBSD: head/tools/build/options/WITHOUT_CRYPT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build any crypto code. When set, it also enforces the following options: .Pp @@ -277,66 +277,66 @@ .Va WITHOUT_OPENSSL .El .It Va WITHOUT_CTM -.\" from FreeBSD: head/tools/build/options/WITHOUT_CTM 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr ctm 1 and related utilities. .It Va WITHOUT_CVS -.\" from FreeBSD: head/tools/build/options/WITHOUT_CVS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build CVS. .It Va WITHOUT_CXX -.\" from FreeBSD: head/tools/build/options/WITHOUT_CXX 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr g++ 1 and related libraries. .It Va WITHOUT_DICT -.\" from FreeBSD: head/tools/build/options/WITHOUT_DICT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build the Webster dictionary files. .It Va WITHOUT_DYNAMICROOT -.\" from FreeBSD: head/tools/build/options/WITHOUT_DYNAMICROOT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set this if you do not want to link .Pa /bin and .Pa /sbin dynamically. .It Va WITHOUT_EXAMPLES -.\" from FreeBSD: head/tools/build/options/WITHOUT_EXAMPLES 156938 2006-03-21 09:06:24Z ru +.\" $FreeBSD$ Set to avoid installing examples to .Pa /usr/share/examples/ . .It Va WITH_FDT -.\" from FreeBSD: head/tools/build/options/WITH_FDT 208537 2010-05-25 15:12:21Z raj +.\" $FreeBSD$ Set to build Flattened Device Tree support as part of the base system. This includes the device tree compiler (dtc) and libfdt support library. .It Va WITHOUT_FLOPPY -.\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 183306 2008-09-23 16:15:42Z sam +.\" $FreeBSD$ Set to not build or install programs for operating floppy disk driver. .It Va WITHOUT_FORTH -.\" from FreeBSD: head/tools/build/options/WITHOUT_FORTH 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build bootloaders without Forth support. .It Va WITHOUT_FP_LIBC -.\" from FreeBSD: head/tools/build/options/WITHOUT_FP_LIBC 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build .Nm libc without floating-point support. .It Va WITHOUT_FREEBSD_UPDATE -.\" from FreeBSD: head/tools/build/options/WITHOUT_FREEBSD_UPDATE 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr freebsd-update 8 . .It Va WITHOUT_GAMES -.\" from FreeBSD: head/tools/build/options/WITHOUT_GAMES 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build games. .It Va WITHOUT_GCOV -.\" from FreeBSD: head/tools/build/options/WITHOUT_GCOV 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build the .Xr gcov 1 tool. .It Va WITHOUT_GDB -.\" from FreeBSD: head/tools/build/options/WITHOUT_GDB 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr gdb 1 . .It Va WITHOUT_GNU -.\" from FreeBSD: head/tools/build/options/WITHOUT_GNU 174550 2007-12-12 16:43:17Z ru +.\" $FreeBSD$ Set to not build contributed GNU software as a part of the base system. This option can be useful if the system built must not contain any code covered by the GNU Public License due to legal reasons. @@ -350,33 +350,36 @@ .Va WITHOUT_GNU_SUPPORT .El .It Va WITHOUT_GNU_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_GNU_SUPPORT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build some programs without optional GNU support. .It Va WITHOUT_GPIB -.\" from FreeBSD: head/tools/build/options/WITHOUT_GPIB 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build GPIB bus support. +.It Va WITH_GPIO +.\" $FreeBSD$ +Set to build gpioctl(8) as part of the base system. .It Va WITHOUT_GROFF -.\" from FreeBSD: head/tools/build/options/WITHOUT_GROFF 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr groff 1 . .It Va WITHOUT_GSSAPI -.\" from FreeBSD: head/tools/build/options/WITHOUT_GSSAPI 174548 2007-12-12 16:39:32Z ru +.\" $FreeBSD$ Set to not build libgssapi. .It Va WITH_HESIOD -.\" from FreeBSD: head/tools/build/options/WITH_HESIOD 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build Hesiod support. .It Va WITHOUT_HTML -.\" from FreeBSD: head/tools/build/options/WITHOUT_HTML 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build HTML docs. .It Va WITH_IDEA -.\" from FreeBSD: head/tools/build/options/WITH_IDEA 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build the IDEA encryption code. This code is patented in the USA and many European countries. It is .Em "YOUR RESPONSIBILITY" to determine if you can legally use IDEA. .It Va WITHOUT_INET6 -.\" from FreeBSD: head/tools/build/options/WITHOUT_INET6 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build programs and libraries related to IPv6 networking. When set, it also enforces the following options: @@ -386,27 +389,27 @@ .Va WITHOUT_INET6_SUPPORT .El .It Va WITHOUT_INET6_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_INET6_SUPPORT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build libraries, programs, and kernel modules without IPv6 support. .It Va WITHOUT_INFO -.\" from FreeBSD: head/tools/build/options/WITHOUT_INFO 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not make or install .Xr info 5 files. .It Va WITHOUT_INSTALLLIB -.\" from FreeBSD: head/tools/build/options/WITHOUT_INSTALLLIB 174497 2007-12-09 21:56:21Z dougb +.\" $FreeBSD$ Set this if you do not want to install optional libraries. For example when creating a .Xr nanobsd 8 image. .It Va WITHOUT_IPFILTER -.\" from FreeBSD: head/tools/build/options/WITHOUT_IPFILTER 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build IP Filter package. .It Va WITHOUT_IPFW -.\" from FreeBSD: head/tools/build/options/WITHOUT_IPFW 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build IPFW tools. .It Va WITHOUT_IPX -.\" from FreeBSD: head/tools/build/options/WITHOUT_IPX 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build programs and libraries related to IPX networking. When set, it also enforces the following options: .Pp @@ -417,14 +420,14 @@ .Va WITHOUT_NCP .El .It Va WITHOUT_IPX_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_IPX_SUPPORT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build some programs without IPX support. .It Va WITHOUT_JAIL -.\" from FreeBSD: head/tools/build/options/WITHOUT_JAIL 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build tools for the support of jails; e.g. .Xr jail 8 . .It Va WITHOUT_KERBEROS -.\" from FreeBSD: head/tools/build/options/WITHOUT_KERBEROS 174549 2007-12-12 16:42:03Z ru +.\" $FreeBSD$ Set this if you do not want to build Kerberos 5 (KTH Heimdal). When set, it also enforces the following options: .Pp @@ -437,7 +440,7 @@ .Va WITHOUT_KERBEROS_SUPPORT .El .It Va WITHOUT_KERBEROS_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_KERBEROS_SUPPORT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build some programs without Kerberos support, like .Xr cvs 1 , .Xr ssh 1 , @@ -446,7 +449,7 @@ and .Xr telnetd 8 . .It Va WITHOUT_KVM -.\" from FreeBSD: head/tools/build/options/WITHOUT_KVM 174550 2007-12-12 16:43:17Z ru +.\" $FreeBSD$ Set to not build the .Nm libkvm library as a part of the base system. @@ -460,23 +463,23 @@ .Va WITHOUT_KVM_SUPPORT .El .It Va WITHOUT_KVM_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_KVM_SUPPORT 170644 2007-06-13 02:08:04Z sepotvin +.\" $FreeBSD$ Set to build some programs without optional .Nm libkvm support. .It Va WITHOUT_LEGACY_CONSOLE -.\" from FreeBSD: head/tools/build/options/WITHOUT_LEGACY_CONSOLE 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build programs that support a legacy PC console; e.g. .Xr kbdcontrol 8 and .Xr vidcontrol 8 . .It Va WITHOUT_LIB32 -.\" from FreeBSD: head/tools/build/options/WITHOUT_LIB32 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ On amd64, set to not build 32-bit library set and a .Nm ld-elf32.so.1 runtime linker. .It Va WITHOUT_LIBPTHREAD -.\" from FreeBSD: head/tools/build/options/WITHOUT_LIBPTHREAD 188848 2009-02-20 11:09:55Z mtm +.\" $FreeBSD$ Set to not build the .Nm libpthread providing library, @@ -502,7 +505,7 @@ .Va WITHOUT_LIBTHR .El .It Va WITHOUT_LIBTHR -.\" from FreeBSD: head/tools/build/options/WITHOUT_LIBTHR 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build the .Nm libthr (1:1 threading) @@ -526,21 +529,21 @@ .Va WITHOUT_BIND_UTILS .El .It Va WITHOUT_LOCALES -.\" from FreeBSD: head/tools/build/options/WITHOUT_LOCALES 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build localization files; see .Xr locale 1 . .It Va WITHOUT_LOCATE -.\" from FreeBSD: head/tools/build/options/WITHOUT_LOCATE 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr locate 1 and related programs. .It Va WITHOUT_LPR -.\" from FreeBSD: head/tools/build/options/WITHOUT_LPR 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr lpr 1 and related programs. .It Va WITHOUT_MAIL -.\" from FreeBSD: head/tools/build/options/WITHOUT_MAIL 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build any mail support (MUA or MTA). When set, it also enforces the following options: .Pp @@ -551,17 +554,17 @@ .Va WITHOUT_SENDMAIL .El .It Va WITHOUT_MAILWRAPPER -.\" from FreeBSD: head/tools/build/options/WITHOUT_MAILWRAPPER 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build the .Xr mailwrapper 8 MTA selector. .It Va WITHOUT_MAKE -.\" from FreeBSD: head/tools/build/options/WITHOUT_MAKE 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not install .Xr make 1 and related support files. .It Va WITHOUT_MAN -.\" from FreeBSD: head/tools/build/options/WITHOUT_MAN 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build manual pages. When set, it also enforces the following options: .Pp @@ -572,7 +575,7 @@ .Va WITH_MAN_UTILS ) .El .It Va WITHOUT_MAN_UTILS -.\" from FreeBSD: head/tools/build/options/WITHOUT_MAN_UTILS 208322 2010-05-20 00:07:21Z jkim +.\" $FreeBSD$ Set to not build utilities for manual pages, .Xr apropos 1 , .Xr catman 1 , @@ -582,20 +585,20 @@ .Xr manctl 8 , and related support files. .It Va WITHOUT_NCP -.\" from FreeBSD: head/tools/build/options/WITHOUT_NCP 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build programs, libraries, and kernel modules related to NetWare Core protocol. .It Va WITHOUT_NDIS -.\" from FreeBSD: head/tools/build/options/WITHOUT_NDIS 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build programs and libraries related to NDIS emulation support. .It Va WITHOUT_NETCAT -.\" from FreeBSD: head/tools/build/options/WITHOUT_NETCAT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr nc 1 utility. .It Va WITHOUT_NETGRAPH -.\" from FreeBSD: head/tools/build/options/WITHOUT_NETGRAPH 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build applications to support .Xr netgraph 4 . When set, it also enforces the following options: @@ -609,10 +612,10 @@ .Va WITHOUT_NETGRAPH_SUPPORT .El .It Va WITHOUT_NETGRAPH_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_NETGRAPH_SUPPORT 183305 2008-09-23 16:11:15Z sam +.\" $FreeBSD$ Set to build libraries, programs, and kernel modules without netgraph support. .It Va WITHOUT_NIS -.\" from FreeBSD: head/tools/build/options/WITHOUT_NIS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr NIS 8 support and related programs. @@ -622,14 +625,14 @@ .Sq nis entries. .It Va WITHOUT_NLS -.\" from FreeBSD: head/tools/build/options/WITHOUT_NLS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build NLS catalogs. .It Va WITHOUT_NLS_CATALOGS -.\" from FreeBSD: head/tools/build/options/WITHOUT_NLS_CATALOGS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build NLS catalog support for .Xr csh 1 . .It Va WITHOUT_NS_CACHING -.\" from FreeBSD: head/tools/build/options/WITHOUT_NS_CACHING 172803 2007-10-19 14:01:25Z ru +.\" $FreeBSD$ Set to disable name caching in the .Pa nsswitch subsystem. @@ -637,18 +640,18 @@ .Xr nscd 8 , will not be built either if this option is set. .It Va WITHOUT_NTP -.\" from FreeBSD: head/tools/build/options/WITHOUT_NTP 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr ntpd 8 and related programs. .It Va WITHOUT_OBJC -.\" from FreeBSD: head/tools/build/options/WITHOUT_OBJC 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build Objective C support. .It Va WITHOUT_OPENSSH -.\" from FreeBSD: head/tools/build/options/WITHOUT_OPENSSH 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build OpenSSH. .It Va WITHOUT_OPENSSL -.\" from FreeBSD: head/tools/build/options/WITHOUT_OPENSSL 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build OpenSSL. When set, it also enforces the following options: .Pp @@ -665,7 +668,7 @@ .Va WITHOUT_OPENSSH .El .It Va WITHOUT_PAM -.\" from FreeBSD: head/tools/build/options/WITHOUT_PAM 174550 2007-12-12 16:43:17Z ru +.\" $FreeBSD$ Set to not build PAM library and modules. .Bf -symbolic This option is deprecated and does nothing. @@ -677,13 +680,13 @@ .Va WITHOUT_PAM_SUPPORT .El .It Va WITHOUT_PAM_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_PAM_SUPPORT 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to build some programs without PAM support, particularly .Xr ftpd 8 and .Xr ppp 8 . .It Va WITHOUT_PF -.\" from FreeBSD: head/tools/build/options/WITHOUT_PF 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build PF firewall package. When set, it also enforces the following options: .Pp @@ -692,35 +695,35 @@ .Va WITHOUT_AUTHPF .El .It Va WITHOUT_PKGTOOLS -.\" from FreeBSD: head/tools/build/options/WITHOUT_PKGTOOLS 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr pkg_add 8 and related programs. .It Va WITHOUT_PMC -.\" from FreeBSD: head/tools/build/options/WITHOUT_PMC 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr pmccontrol 8 and related programs. .It Va WITHOUT_PORTSNAP -.\" from FreeBSD: head/tools/build/options/WITHOUT_PORTSNAP 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build or install .Xr portsnap 8 and related files. .It Va WITHOUT_PPP -.\" from FreeBSD: head/tools/build/options/WITHOUT_PPP 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr ppp 8 and related programs. .It Va WITHOUT_PROFILE -.\" from FreeBSD: head/tools/build/options/WITHOUT_PROFILE 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to avoid compiling profiled libraries. .It Va WITHOUT_QUOTAS -.\" from FreeBSD: head/tools/build/options/WITHOUT_QUOTAS 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr quota 8 and related programs. .It Va WITHOUT_RCMDS -.\" from FreeBSD: head/tools/build/options/WITHOUT_RCMDS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Disable building of the .Bx r-commands. @@ -729,63 +732,63 @@ .Xr rsh 1 , etc. .It Va WITHOUT_RCS -.\" from FreeBSD: head/tools/build/options/WITHOUT_RCS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr rcs 1 and related utilities. .It Va WITHOUT_RESCUE -.\" from FreeBSD: head/tools/build/options/WITHOUT_RESCUE 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr rescue 8 . .It Va WITHOUT_ROUTED -.\" from FreeBSD: head/tools/build/options/WITHOUT_ROUTED 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr routed 8 utility. .It Va WITHOUT_SENDMAIL -.\" from FreeBSD: head/tools/build/options/WITHOUT_SENDMAIL 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr sendmail 8 and related programs. .It Va WITHOUT_SETUID_LOGIN -.\" from FreeBSD: head/tools/build/options/WITHOUT_SETUID_LOGIN 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set this to disable the installation of .Xr login 1 as a set-user-ID root program. .It Va WITHOUT_SHAREDOCS -.\" from FreeBSD: head/tools/build/options/WITHOUT_SHAREDOCS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build the .Bx 4.4 legacy docs. .It Va WITHOUT_SSP -.\" from FreeBSD: head/tools/build/options/WITHOUT_SSP 180012 2008-06-25 21:33:28Z ru +.\" $FreeBSD$ Set to not build world with propolice stack smashing protection. .It Va WITHOUT_SYMVER -.\" from FreeBSD: head/tools/build/options/WITHOUT_SYMVER 169649 2007-05-17 05:03:24Z deischen +.\" $FreeBSD$ Set to disable symbol versioning when building shared libraries. .It Va WITHOUT_SYSCONS -.\" from FreeBSD: head/tools/build/options/WITHOUT_SYSCONS 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build .Xr syscons 4 support files such as keyboard maps, fonts, and screen output maps. .It Va WITHOUT_SYSINSTALL -.\" from FreeBSD: head/tools/build/options/WITHOUT_SYSINSTALL 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr sysinstall 8 and related programs. .It Va WITHOUT_TCSH -.\" from FreeBSD: head/tools/build/options/WITHOUT_TCSH 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build and install .Pa /bin/csh (which is .Xr tcsh 1 ) . .It Va WITHOUT_TELNET -.\" from FreeBSD: head/tools/build/options/WITHOUT_TELNET 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build .Xr telnet 8 and related programs. .It Va WITHOUT_TEXTPROC -.\" from FreeBSD: head/tools/build/options/WITHOUT_TEXTPROC 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build programs used for text processing. When set, it also enforces the following options: @@ -795,7 +798,7 @@ .Va WITHOUT_GROFF .El .It Va WITHOUT_TOOLCHAIN -.\" from FreeBSD: head/tools/build/options/WITHOUT_TOOLCHAIN 174550 2007-12-12 16:43:17Z ru +.\" $FreeBSD$ Set to not install programs used for program development, compilers, debuggers etc. @@ -811,10 +814,10 @@ .Va WITHOUT_GDB .El .It Va WITHOUT_USB -.\" from FreeBSD: head/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Set to not build USB-related programs and libraries. .It Va WITHOUT_WIRELESS -.\" from FreeBSD: head/tools/build/options/WITHOUT_WIRELESS 183242 2008-09-21 22:02:26Z sam +.\" $FreeBSD$ Set to not build programs used for 802.11 wireless networks; especially .Xr wpa_supplicant 8 and @@ -826,21 +829,21 @@ .Va WITHOUT_WIRELESS_SUPPORT .El .It Va WITHOUT_WIRELESS_SUPPORT -.\" from FreeBSD: head/tools/build/options/WITHOUT_WIRELESS_SUPPORT 183305 2008-09-23 16:11:15Z sam +.\" $FreeBSD$ Set to build libraries, programs, and kernel modules without 802.11 wireless support. .It Va WITHOUT_WPA_SUPPLICANT_EAPOL -.\" from FreeBSD: head/tools/build/options/WITHOUT_WPA_SUPPLICANT_EAPOL 156932 2006-03-21 07:50:50Z ru +.\" $FreeBSD$ Build .Xr wpa_supplicant 8 without support for the IEEE 802.1X protocol and without support for EAP-PEAP, EAP-TLS, EAP-LEAP, and EAP-TTLS protocols (usable only via 802.1X). .It Va WITHOUT_ZFS -.\" from FreeBSD: head/tools/build/options/WITHOUT_ZFS 168409 2007-04-06 02:13:30Z pjd +.\" $FreeBSD$ Set to not build ZFS file system. .It Va WITHOUT_ZONEINFO -.\" from FreeBSD: head/tools/build/options/WITHOUT_ZONEINFO 171994 2007-08-27 20:01:08Z remko +.\" $FreeBSD$ Set to not build the timezone database .El .Sh FILES --- sys/conf/files.mips (revision 215501) +++ sys/conf/files.mips (local) @@ -102,4 +102,4 @@ #mips/sentry5/siba_mips.c optional siba # not yet dev/hwpmc/hwpmc_mips.c optional hwpmc -dev/hwpmc/hwpmc_mips24k.c optional hwpmc +dev/hwpmc/hwpmc_octeon.c optional hwpmc --- sys/conf/kern.post.mk (revision 215501) +++ sys/conf/kern.post.mk (local) @@ -133,10 +133,10 @@ # This is a hack. BFD "optimizes" away dynamic mode if there are no # dynamic references. We could probably do a '-Bforcedynamic' mode like # in the a.out ld. For now, this works. -HACK_EXTRA_FLAGS?= -shared +HACK_EXTRA_FLAGS?= -shared -msoft-float hack.So: Makefile :> hack.c - ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.So + ${CC} ${HACK_EXTRA_FLAGS} -nostdlib -msoft-float hack.c -o hack.So rm -f hack.c # This rule stops ./assym.s in .depend from causing problems. --- sys/dev/hwpmc/hwpmc_mips.c (revision 215501) +++ sys/dev/hwpmc/hwpmc_mips.c (local) @@ -39,7 +39,7 @@ pmc_md_initialize() { /* if (cpu_class == CPU_CLASS_MIPS24K)*/ - return pmc_mips24k_initialize(); + return pmc_octeon_initialize(); /* else return NULL;*/ } @@ -48,7 +48,7 @@ pmc_md_finalize(struct pmc_mdep *md) { /* if (cpu_class == CPU_CLASS_MIPS24K) */ - pmc_mips24k_finalize(md); + pmc_octeon_finalize(md); /* else KASSERT(0, ("[mips,%d] Unknown CPU Class 0x%x", __LINE__, cpu_class));*/ --- sys/dev/hwpmc/pmc_events.h (revision 215501) +++ sys/dev/hwpmc/pmc_events.h (local) @@ -3093,6 +3093,24 @@ #define PMC_EV_MIPS24K_FIRST PMC_EV_MIPS24K_CYCLE #define PMC_EV_MIPS24K_LAST PMC_EV_MIPS24K_WBB_FULL_PIPELINE_STALLS +#define __PMC_EV_OCTEON() \ + __PMC_EV(OCTEON, NONE) \ + __PMC_EV(OCTEON, CLK) \ + __PMC_EV(OCTEON, ISSUE) \ + __PMC_EV(OCTEON, RET) \ + __PMC_EV(OCTEON, NISSUE) \ + __PMC_EV(OCTEON, SISSUE) \ + __PMC_EV(OCTEON, DISSUE) \ + __PMC_EV(OCTEON, IFI) \ + __PMC_EV(OCTEON, BR) \ + __PMC_EV(OCTEON, BRMIS) \ + __PMC_EV(OCTEON, J) \ + __PMC_EV(OCTEON, JMIS) + +#define PMC_EV_OCTEON_FIRST PMC_EV_OCTEON_CLK +#define PMC_EV_OCTEON_LAST PMC_EV_OCTEON_JMIS + + /* * All known PMC events. * @@ -3112,6 +3130,7 @@ * 0x11100 0x0100 INTEL Pentium Pro/P-II/P-III/Pentium-M events * 0x11200 0x00FF INTEL XScale events * 0x11300 0x00FF MIPS 24K events + * 0x11400 0x0080 Cavium Octeon events */ #define __PMC_EVENTS() \ __PMC_EV_BLOCK(TSC, 0x01000) \ @@ -3134,6 +3153,8 @@ __PMC_EV_XSCALE() \ __PMC_EV_BLOCK(MIPS24K, 0x11300) \ __PMC_EV_MIPS24K() \ + __PMC_EV_BLOCK(OCTEON, 0x11400) \ + __PMC_EV_OCTEON() \ __PMC_EV_BLOCK(UCF, 0x12000) \ __PMC_EV_UCF() \ __PMC_EV_BLOCK(UCP, 0x12080) \ --- sys/dev/hwpmc/hwpmc_octeon.c (revision 215501) +++ sys/dev/hwpmc/hwpmc_octeon.c (local) @@ -0,0 +1,480 @@ +/*- + * Copyright (c) 2010 George V. Neville-Neil + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * Support for MIPS CPUs + * + */ +static int octeon_npmcs; + +struct octeon_event_code_map { + enum pmc_event pe_ev; /* enum value */ + uint8_t pe_code; /* numeric code */ +}; + +/* + * MIPS event codes are encoded with a select bit. The + * select bit is used when writing to CP0 so that we + * can select either counter 0/2 or 1/3. The cycle + * and instruction counters are special in that they + * can be counted on either 0/2 or 1/3. + */ + +const struct octeon_event_code_map octeon_event_codes[] = { + { PMC_EV_OCTEON_NONE, 0 }, + { PMC_EV_OCTEON_CLK, 1 }, + { PMC_EV_OCTEON_ISSUE, 2 }, + { PMC_EV_OCTEON_RET, 3 }, + { PMC_EV_OCTEON_NISSUE, 4 }, + { PMC_EV_OCTEON_SISSUE, 5 }, + { PMC_EV_OCTEON_DISSUE, 6 }, + { PMC_EV_OCTEON_IFI, 7 }, + { PMC_EV_OCTEON_BR, 8 }, + { PMC_EV_OCTEON_BRMIS, 9 }, + { PMC_EV_OCTEON_J, 10 }, + { PMC_EV_OCTEON_JMIS, 11 } +}; + +const int octeon_event_codes_size = + sizeof(octeon_event_codes) / sizeof(octeon_event_codes[0]); + +/* + * Per-processor information. + */ +struct octeon_cpu { + struct pmc_hw *pc_mipspmcs; +}; + +static struct octeon_cpu **octeon_pcpu; + +/* + * Performance Count Register N + */ +static uint64_t +octeon_pmcn_read(unsigned int pmc) +{ + uint64_t reg = 0; + + KASSERT(pmc < octeon_npmcs, ("[mips,%d] illegal PMC number %d", + __LINE__, pmc)); + + /* The counter value is the next value after the control register. */ + switch (pmc) { + case 0: + reg = mips_rd_perfcnt1(); + break; + case 1: + reg = mips_rd_perfcnt3(); + break; + default: + return 0; + } + return (reg); +} + +static uint64_t +octeon_pmcn_write(unsigned int pmc, uint64_t reg) +{ + + KASSERT(pmc < octeon_npmcs, ("[mips,%d] illegal PMC number %d", + __LINE__, pmc)); + + switch (pmc) { + case 0: + mips_wr_perfcnt1(reg); + break; + case 1: + mips_wr_perfcnt3(reg); + break; + default: + return 0; + } + return (reg); +} + +static int +octeon_allocate_pmc(int cpu, int ri, struct pmc *pm, + const struct pmc_op_pmcallocate *a) +{ + enum pmc_event pe; + uint32_t caps, config; + int i; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[mips,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < octeon_npmcs, + ("[mips,%d] illegal row index %d", __LINE__, ri)); + + caps = a->pm_caps; + if (a->pm_class != PMC_CLASS_OCTEON) + return (EINVAL); + pe = a->pm_ev; + for (i = 0; i < octeon_event_codes_size; i++) { + if (octeon_event_codes[i].pe_ev == pe) { + config = octeon_event_codes[i].pe_code; + break; + } + } + if (i == octeon_event_codes_size) + return (EINVAL); + + config <<= OCTEON_PMC_SELECT; + + if (caps & PMC_CAP_SYSTEM) + config |= (OCTEON_PMC_SUPER_ENABLE | + OCTEON_PMC_KERNEL_ENABLE); + if (caps & PMC_CAP_USER) + config |= OCTEON_PMC_USER_ENABLE; + if ((caps & (PMC_CAP_USER | PMC_CAP_SYSTEM)) == 0) + config |= OCTEON_PMC_ENABLE; + + pm->pm_md.pm_octeon.pm_octeon_evsel = config; + + PMCDBG(MDP,ALL,2,"mips-allocate ri=%d -> config=0x%x", ri, config); + + return 0; +} + + +static int +octeon_read_pmc(int cpu, int ri, pmc_value_t *v) +{ + struct pmc *pm; + pmc_value_t tmp; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[mips,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < octeon_npmcs, + ("[mips,%d] illegal row index %d", __LINE__, ri)); + + pm = octeon_pcpu[cpu]->pc_mipspmcs[ri].phw_pmc; + tmp = octeon_pmcn_read(ri); + PMCDBG(MDP,REA,2,"mips-read id=%d -> %jd", ri, tmp); + if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) + *v = OCTEON_PERFCTR_VALUE_TO_RELOAD_COUNT(tmp); + else + *v = tmp; + + return 0; +} + +static int +octeon_write_pmc(int cpu, int ri, pmc_value_t v) +{ + struct pmc *pm; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[mips,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < octeon_npmcs, + ("[mips,%d] illegal row-index %d", __LINE__, ri)); + + pm = octeon_pcpu[cpu]->pc_mipspmcs[ri].phw_pmc; + + if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) + v = OCTEON_RELOAD_COUNT_TO_PERFCTR_VALUE(v); + + PMCDBG(MDP,WRI,1,"mips-write cpu=%d ri=%d v=%jx", cpu, ri, v); + + octeon_pmcn_write(ri, v); + + return 0; +} + +static int +octeon_config_pmc(int cpu, int ri, struct pmc *pm) +{ + struct pmc_hw *phw; + + PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[mips,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < octeon_npmcs, + ("[mips,%d] illegal row-index %d", __LINE__, ri)); + + phw = &octeon_pcpu[cpu]->pc_mipspmcs[ri]; + + KASSERT(pm == NULL || phw->phw_pmc == NULL, + ("[mips,%d] pm=%p phw->pm=%p hwpmc not unconfigured", + __LINE__, pm, phw->phw_pmc)); + + phw->phw_pmc = pm; + + return 0; +} + +static int +octeon_start_pmc(int cpu, int ri) +{ + uint32_t config; + struct pmc *pm; + struct pmc_hw *phw; + + phw = &octeon_pcpu[cpu]->pc_mipspmcs[ri]; + pm = phw->phw_pmc; + config = pm->pm_md.pm_octeon.pm_octeon_evsel; + + /* Enable the PMC. */ + switch (ri) { + case 0: + mips_wr_perfcnt0(config); + break; + case 1: + mips_wr_perfcnt2(config); + break; + default: + break; + } + + return 0; +} + +static int +octeon_stop_pmc(int cpu, int ri) +{ + struct pmc *pm; + struct pmc_hw *phw; + + phw = &octeon_pcpu[cpu]->pc_mipspmcs[ri]; + pm = phw->phw_pmc; + + /* + * Disable the PMCs. + * + * Clearing the entire register turns the counter off as well + * as removes the previously sampled event. + */ + switch (ri) { + case 0: + mips_wr_perfcnt0(0); + break; + case 1: + mips_wr_perfcnt2(0); + break; + default: + break; + } + return 0; +} + +static int +octeon_release_pmc(int cpu, int ri, struct pmc *pmc) +{ + struct pmc_hw *phw; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[mips,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < octeon_npmcs, + ("[mips,%d] illegal row-index %d", __LINE__, ri)); + + phw = &octeon_pcpu[cpu]->pc_mipspmcs[ri]; + KASSERT(phw->phw_pmc == NULL, + ("[mips,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); + + return 0; +} + +static int +octeon_intr(int cpu, struct trapframe *tf) +{ + return 0; +} + +static int +octeon_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) +{ + int error; + struct pmc_hw *phw; + char octeon_name[PMC_NAME_MAX]; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[mips,%d], illegal CPU %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < octeon_npmcs, + ("[mips,%d] row-index %d out of range", __LINE__, ri)); + + phw = &octeon_pcpu[cpu]->pc_mipspmcs[ri]; + snprintf(octeon_name, sizeof(octeon_name), "MIPS-%d", ri); + if ((error = copystr(octeon_name, pi->pm_name, PMC_NAME_MAX, + NULL)) != 0) + return error; + pi->pm_class = PMC_CLASS_OCTEON; + if (phw->phw_state & PMC_PHW_FLAG_IS_ENABLED) { + pi->pm_enabled = TRUE; + *ppmc = phw->phw_pmc; + } else { + pi->pm_enabled = FALSE; + *ppmc = NULL; + } + + return (0); +} + +static int +octeon_get_config(int cpu, int ri, struct pmc **ppm) +{ + *ppm = octeon_pcpu[cpu]->pc_mipspmcs[ri].phw_pmc; + + return 0; +} + +/* + * XXX don't know what we should do here. + */ +static int +octeon_switch_in(struct pmc_cpu *pc, struct pmc_process *pp) +{ + return 0; +} + +static int +octeon_switch_out(struct pmc_cpu *pc, struct pmc_process *pp) +{ + return 0; +} + +static int +octeon_pcpu_init(struct pmc_mdep *md, int cpu) +{ + int first_ri, i; + struct pmc_cpu *pc; + struct octeon_cpu *pac; + struct pmc_hw *phw; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[mips,%d] wrong cpu number %d", __LINE__, cpu)); + PMCDBG(MDP,INI,1,"mips-init cpu=%d", cpu); + + octeon_pcpu[cpu] = pac = malloc(sizeof(struct octeon_cpu), M_PMC, + M_WAITOK|M_ZERO); + pac->pc_mipspmcs = malloc(sizeof(struct pmc_hw) * octeon_npmcs, + M_PMC, M_WAITOK|M_ZERO); + pc = pmc_pcpu[cpu]; + first_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_OCTEON].pcd_ri; + KASSERT(pc != NULL, ("[mips,%d] NULL per-cpu pointer", __LINE__)); + + for (i = 0, phw = pac->pc_mipspmcs; i < octeon_npmcs; i++, phw++) { + phw->phw_state = PMC_PHW_FLAG_IS_ENABLED | + PMC_PHW_CPU_TO_STATE(cpu) | PMC_PHW_INDEX_TO_STATE(i); + phw->phw_pmc = NULL; + pc->pc_hwpmcs[i + first_ri] = phw; + } + + /* + * Clear the counter control register which has the effect + * of disabling counting. + */ + for (i = 0; i < octeon_npmcs; i++) + octeon_pmcn_write(i, 0); + + return 0; +} + +static int +octeon_pcpu_fini(struct pmc_mdep *md, int cpu) +{ + return 0; +} + +struct pmc_mdep * +pmc_octeon_initialize() +{ + struct pmc_mdep *pmc_mdep; + struct pmc_classdep *pcd; + + /* + * Read the counter control registers from CP0 + * to determine the number of available PMCs. + * The control registers use bit 31 as a "more" bit. + * + * XXX: With the current macros it is hard to read the + * CP0 registers in any varied way. + */ + octeon_npmcs = 2; + + PMCDBG(MDP,INI,1,"mips-init npmcs=%d", octeon_npmcs); + + /* + * Allocate space for pointers to PMC HW descriptors and for + * the MDEP structure used by MI code. + */ + octeon_pcpu = malloc(sizeof(struct octeon_cpu *) * pmc_cpu_max(), M_PMC, + M_WAITOK|M_ZERO); + + /* Just one class */ + pmc_mdep = malloc(sizeof(struct pmc_mdep) + sizeof(struct pmc_classdep), + M_PMC, M_WAITOK|M_ZERO); + + pmc_mdep->pmd_cputype = PMC_CPU_MIPS_OCTEON; + pmc_mdep->pmd_nclass = 1; + + pcd = &pmc_mdep->pmd_classdep[PMC_MDEP_CLASS_INDEX_OCTEON]; + pcd->pcd_caps = OCTEON_PMC_CAPS; + pcd->pcd_class = PMC_CLASS_OCTEON; + pcd->pcd_num = octeon_npmcs; + pcd->pcd_ri = pmc_mdep->pmd_npmc; + pcd->pcd_width = 64; + + pcd->pcd_allocate_pmc = octeon_allocate_pmc; + pcd->pcd_config_pmc = octeon_config_pmc; + pcd->pcd_pcpu_fini = octeon_pcpu_fini; + pcd->pcd_pcpu_init = octeon_pcpu_init; + pcd->pcd_describe = octeon_describe; + pcd->pcd_get_config = octeon_get_config; + pcd->pcd_read_pmc = octeon_read_pmc; + pcd->pcd_release_pmc = octeon_release_pmc; + pcd->pcd_start_pmc = octeon_start_pmc; + pcd->pcd_stop_pmc = octeon_stop_pmc; + pcd->pcd_write_pmc = octeon_write_pmc; + + pmc_mdep->pmd_intr = octeon_intr; + pmc_mdep->pmd_switch_in = octeon_switch_in; + pmc_mdep->pmd_switch_out = octeon_switch_out; + + pmc_mdep->pmd_npmc += octeon_npmcs; + + return (pmc_mdep); +} + +void +pmc_octeon_finalize(struct pmc_mdep *md) +{ + (void) md; +} + Property changes on: sys/dev/hwpmc/hwpmc_octeon.c ___________________________________________________________________ Name: svn:keywords +FreeBSD=%H --- sys/dev/hwpmc/hwpmc_octeon.h (revision 215501) +++ sys/dev/hwpmc/hwpmc_octeon.h (local) @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2010 George V. Neville-Neil + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (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$ + */ + +#ifndef _DEV_HWPMC_OCTEON_H_ +#define _DEV_HWPMC_OCTEON_H_ + +#define OCTEON_PMC_CAPS (PMC_CAP_INTERRUPT | PMC_CAP_USER | \ + PMC_CAP_SYSTEM | PMC_CAP_EDGE | \ + PMC_CAP_THRESHOLD | PMC_CAP_READ | \ + PMC_CAP_WRITE | PMC_CAP_INVERT | \ + PMC_CAP_QUALIFIER) + + +#define OCTEON_PMC_64BITS_ENBALE (1<<30) /* 64-bit counters */ +#define OCTEON_PMC_INTERRUPT_ENBALE 0x10 /* Interrupt when counter + overflows */ +#define OCTEON_PMC_USER_ENABLE 0x08 /* Count in USER mode */ +#define OCTEON_PMC_SUPER_ENABLE 0x04 /* Count in SUPERVISOR mode */ +#define OCTEON_PMC_KERNEL_ENABLE 0x02 /* Count in KERNEL mode */ +#define OCTEON_PMC_EXL_ENABLE 0x01 /* Count when EXL = 1, ERL = 0 */ +#define OCTEON_PMC_ENABLE (OCTEON_PMC_USER_ENABLE | \ + OCTEON_PMC_SUPER_ENABLE | \ + OCTEON_PMC_KERNEL_ENABLE) + + +#define OCTEON_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (-(R)) +#define OCTEON_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P)) + +#define OCTEON_PMC_SELECT 0x5 /* Which bit position the event starts at. */ +#define OCTEON_PMC_OFFSET 2 /* Control registers are 0, 2, 4, etc. */ +#define OCTEON_PMC_MORE 0x800000 /* Test for more PMCs (bit 31) */ + +#ifdef _KERNEL +/* MD extension for 'struct pmc' */ +struct pmc_md_octeon_pmc { + uint32_t pm_octeon_evsel; +}; +#endif /* _KERNEL */ + +#endif /* _DEV_HWPMC_MIPS_H_ */ Property changes on: sys/dev/hwpmc/hwpmc_octeon.h ___________________________________________________________________ Name: svn:keywords +FreeBSD=%H --- sys/dev/usb/usb_transfer.c (revision 215501) +++ sys/dev/usb/usb_transfer.c (local) @@ -676,12 +676,14 @@ /* * check if we need to setup * a local buffer: + * XXXKAN aieeeee: CACHE LINE? MIPS weeps boody tears here. */ if (!xfer->flags.ext_buffer) { + uint32_t data_align = MAX(USB_HOST_ALIGN, 32) - 1; /* align data */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->size[0] += ((-parm->size[0]) & data_align); if (parm->buf) { @@ -697,7 +699,7 @@ parm->size[0] += parm->bufsize; /* align data again */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->size[0] += ((-parm->size[0]) & data_align); } /* * Compute maximum buffer size --- sys/kern/init_main.c (revision 215501) +++ sys/kern/init_main.c (local) @@ -99,7 +99,7 @@ struct vmspace vmspace0; struct proc *initproc; -int boothowto = 0; /* initialized so that it can be patched */ +int boothowto = RB_SINGLE; /* initialized so that it can be patched */ SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, "Boot control flags, passed from loader"); int bootverbose; --- sys/mips/conf/OCTEON1 (revision 215501) +++ sys/mips/conf/OCTEON1 (local) @@ -110,7 +110,6 @@ # On-board Compact Flash driver. device cf -options ROOTDEVNAME=\"ufs:cf0s2a\" # Default root filesystem. # SCSI Controllers device ahc # AHA2940 and onboard AIC7xxx devices --- sys/mips/include/cpufunc.h (revision 215501) +++ sys/mips/include/cpufunc.h (local) @@ -131,12 +131,38 @@ mips_barrier(); \ } struct __hack +#define MIPS_RDRW64_COP0_SEL(n,r,s) \ +static __inline uint64_t \ +mips_rd_ ## n(void) \ +{ \ + int v0; \ + __asm __volatile ("dmfc0 %[v0], $"__XSTRING(r)", "__XSTRING(s)";" \ + : [v0] "=&r"(v0)); \ + mips_barrier(); \ + return (v0); \ +} \ +static __inline void \ +mips_wr_ ## n(uint64_t a0) \ +{ \ + __asm __volatile ("dmtc0 %[a0], $"__XSTRING(r)", "__XSTRING(s)";" \ + __XSTRING(COP0_SYNC)";" \ + "nop;" \ + "nop;" \ + : \ + : [a0] "r"(a0)); \ + mips_barrier(); \ +} struct __hack + + + #if defined(__mips_n64) MIPS_RDRW64_COP0(entrylo0, MIPS_COP_0_TLB_LO0); MIPS_RDRW64_COP0(entrylo1, MIPS_COP_0_TLB_LO1); MIPS_RDRW64_COP0(entryhi, MIPS_COP_0_TLB_HI); MIPS_RDRW64_COP0(pagemask, MIPS_COP_0_TLB_PG_MASK); #endif +MIPS_RDRW64_COP0_SEL(perfcnt1, MIPS_COP_0_PERFCNT, 1); +MIPS_RDRW64_COP0_SEL(perfcnt3, MIPS_COP_0_PERFCNT, 3); MIPS_RDRW64_COP0(xcontext, MIPS_COP_0_TLB_XCONTEXT); #undef MIPS_RDRW64_COP0 @@ -230,10 +256,7 @@ MIPS_RDRW32_COP0_SEL(watchhi3, MIPS_COP_0_WATCH_HI, 3); MIPS_RDRW32_COP0_SEL(perfcnt0, MIPS_COP_0_PERFCNT, 0); -MIPS_RDRW32_COP0_SEL(perfcnt1, MIPS_COP_0_PERFCNT, 1); MIPS_RDRW32_COP0_SEL(perfcnt2, MIPS_COP_0_PERFCNT, 2); -MIPS_RDRW32_COP0_SEL(perfcnt3, MIPS_COP_0_PERFCNT, 3); - #undef MIPS_RDRW32_COP0 static __inline register_t --- sys/mips/include/pmc_mdep.h (revision 215501) +++ sys/mips/include/pmc_mdep.h (local) @@ -8,8 +8,8 @@ #ifndef _MACHINE_PMC_MDEP_H_ #define _MACHINE_PMC_MDEP_H_ -#define PMC_MDEP_CLASS_INDEX_MIPS24K 0 -#include +#define PMC_MDEP_CLASS_INDEX_OCTEON 0 +#include union pmc_md_op_pmcallocate { uint64_t __pad[4]; @@ -21,7 +21,7 @@ #if _KERNEL union pmc_md_pmc { - struct pmc_md_mips24k_pmc pm_mips24k; + struct pmc_md_octeon_pmc pm_octeon; }; #define PMC_TRAPFRAME_TO_PC(TF) ((TF)->pc) @@ -31,8 +31,8 @@ /* * Prototypes */ -struct pmc_mdep *pmc_mips24k_initialize(void); -void pmc_mips24k_finalize(struct pmc_mdep *_md); +struct pmc_mdep *pmc_octeon_initialize(void); +void pmc_octeon_finalize(struct pmc_mdep *_md); #endif /* _KERNEL */ #endif /* !_MACHINE_PMC_MDEP_H_ */ --- sys/sys/pmc.h (revision 215501) +++ sys/sys/pmc.h (local) @@ -87,7 +87,8 @@ __PMC_CPU(INTEL_COREI7, 0x8B, "Intel Core i7") \ __PMC_CPU(INTEL_WESTMERE, 0x8C, "Intel Westmere") \ __PMC_CPU(INTEL_XSCALE, 0x100, "Intel XScale") \ - __PMC_CPU(MIPS_24K, 0x200, "MIPS 24K") + __PMC_CPU(MIPS_24K, 0x200, "MIPS 24K") \ + __PMC_CPU(MIPS_OCTEON, 0x300, "Cavium Octeon") enum pmc_cputype { #undef __PMC_CPU @@ -96,7 +97,7 @@ }; #define PMC_CPU_FIRST PMC_CPU_AMD_K7 -#define PMC_CPU_LAST PMC_CPU_MIPS_24K +#define PMC_CPU_LAST PMC_CPU_MIPS_OCTEON /* * Classes of PMCs @@ -114,7 +115,8 @@ __PMC_CLASS(UCF) /* Intel Uncore fixed function */ \ __PMC_CLASS(UCP) /* Intel Uncore programmable */ \ __PMC_CLASS(XSCALE) /* Intel XScale counters */ \ - __PMC_CLASS(MIPS24K) /* MIPS 24K */ + __PMC_CLASS(MIPS24K) /* MIPS 24K */ \ + __PMC_CLASS(OCTEON) /* Cavium Octeon*/ enum pmc_class { #undef __PMC_CLASS @@ -123,7 +125,7 @@ }; #define PMC_CLASS_FIRST PMC_CLASS_TSC -#define PMC_CLASS_LAST PMC_CLASS_MIPS24K +#define PMC_CLASS_LAST PMC_CLASS_OCTEON /* * A PMC can be in the following states: @@ -584,11 +586,30 @@ * PMC commands */ +#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ + 0 : sizeof(register_t) - sizeof(t)) + +#if BYTE_ORDER == LITTLE_ENDIAN +#define PADL_(t) 0 +#define PADR_(t) PAD_(t) +#else +#define PADL_(t) PAD_(t) +#define PADR_(t) 0 +#endif + struct pmc_syscall_args { + char code_l_[PADL_(uint32_t)]; uint32_t pmop_code; /* one of PMC_OP_* */ + char code_r_[PADR_(uint32_t)]; + char data_l_[PADL_(void*)]; void *pmop_data; /* syscall parameter */ + char data_r_[PADR_(void*)]; }; +#undef PAD_ +#undef PADL_ +#undef PADR_ + /* * Interface to processor specific s1tuff */