Date: Thu, 19 Aug 2010 17:43:31 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 182625 for review Message-ID: <201008191743.o7JHhVXI057416@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@182625?ac=10 Change 182625 by jhb@jhb_jhbbsd on 2010/08/19 17:43:24 IFC @182624 Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/trap.c#77 integrate .. //depot/projects/smpng/sys/amd64/ia32/ia32_syscall.c#29 integrate .. //depot/projects/smpng/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h#6 integrate .. //depot/projects/smpng/sys/conf/makeLINT.mk#3 integrate .. //depot/projects/smpng/sys/dev/e1000/if_igb.c#25 integrate .. //depot/projects/smpng/sys/fs/devfs/devfs_vnops.c#89 integrate .. //depot/projects/smpng/sys/geom/mirror/g_mirror.c#42 integrate .. //depot/projects/smpng/sys/i386/i386/trap.c#126 integrate .. //depot/projects/smpng/sys/ia64/ia64/trap.c#100 integrate .. //depot/projects/smpng/sys/kern/kern_ktrace.c#76 integrate .. //depot/projects/smpng/sys/kern/kern_proc.c#115 integrate .. //depot/projects/smpng/sys/kern/sched_ule.c#107 integrate .. //depot/projects/smpng/sys/mips/atheros/ar71xx_chip.c#1 branch .. //depot/projects/smpng/sys/mips/atheros/ar71xx_chip.h#1 branch .. //depot/projects/smpng/sys/mips/atheros/ar71xx_cpudef.h#2 integrate .. //depot/projects/smpng/sys/mips/atheros/ar71xx_machdep.c#2 integrate .. //depot/projects/smpng/sys/mips/atheros/ar71xx_pci.c#3 integrate .. //depot/projects/smpng/sys/mips/atheros/ar71xx_setup.c#1 branch .. //depot/projects/smpng/sys/mips/atheros/ar71xx_setup.h#1 branch .. //depot/projects/smpng/sys/mips/atheros/ar71xx_wdog.c#3 integrate .. //depot/projects/smpng/sys/mips/atheros/ar71xxreg.h#5 integrate .. //depot/projects/smpng/sys/mips/atheros/ar724x_chip.c#1 branch .. //depot/projects/smpng/sys/mips/atheros/ar724x_chip.h#1 branch .. //depot/projects/smpng/sys/mips/atheros/ar724xreg.h#2 integrate .. //depot/projects/smpng/sys/mips/atheros/ar91xx_chip.c#1 branch .. //depot/projects/smpng/sys/mips/atheros/ar91xx_chip.h#1 branch .. //depot/projects/smpng/sys/mips/atheros/files.ar71xx#2 integrate .. //depot/projects/smpng/sys/mips/atheros/if_arge.c#5 integrate .. //depot/projects/smpng/sys/mips/atheros/if_argevar.h#3 integrate .. //depot/projects/smpng/sys/mips/atheros/uart_bus_ar71xx.c#2 integrate .. //depot/projects/smpng/sys/mips/atheros/uart_cpu_ar71xx.c#2 integrate .. //depot/projects/smpng/sys/modules/Makefile#177 integrate .. //depot/projects/smpng/sys/modules/send/Makefile#1 branch .. //depot/projects/smpng/sys/netinet/in.h#52 integrate .. //depot/projects/smpng/sys/netinet/tcp_input.c#136 integrate .. //depot/projects/smpng/sys/netinet/tcp_output.c#68 integrate .. //depot/projects/smpng/sys/netinet/tcp_subr.c#124 integrate .. //depot/projects/smpng/sys/netinet/tcp_var.h#77 integrate .. //depot/projects/smpng/sys/netinet6/icmp6.c#65 integrate .. //depot/projects/smpng/sys/netinet6/nd6.c#68 integrate .. //depot/projects/smpng/sys/netinet6/nd6_nbr.c#42 integrate .. //depot/projects/smpng/sys/netinet6/raw_ip6.c#68 integrate .. //depot/projects/smpng/sys/netinet6/send.c#1 branch .. //depot/projects/smpng/sys/netinet6/send.h#1 branch .. //depot/projects/smpng/sys/powerpc/aim/trap.c#11 integrate .. //depot/projects/smpng/sys/powerpc/booke/trap.c#7 integrate .. //depot/projects/smpng/sys/powerpc/conf/Makefile#3 integrate .. //depot/projects/smpng/sys/powerpc/conf/NOTES#19 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/trap.c#89 integrate .. //depot/projects/smpng/sys/sun4v/sun4v/trap.c#15 integrate .. //depot/projects/smpng/sys/sys/ktrace.h#19 integrate .. //depot/projects/smpng/sys/sys/mbuf.h#87 integrate Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/trap.c#77 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.346 2010/07/12 20:45:37 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.347 2010/08/19 16:41:27 jhb Exp $"); /* * AMD64 Trap and System call handling ==== //depot/projects/smpng/sys/amd64/ia32/ia32_syscall.c#29 (text+ko) ==== @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_syscall.c,v 1.22 2010/05/23 18:32:02 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_syscall.c,v 1.23 2010/08/19 16:41:27 jhb Exp $"); /* * 386 Trap and System call handling ==== //depot/projects/smpng/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h#6 (text+ko) ==== @@ -403,6 +403,25 @@ #define _INT_ALIGNMENT 4 #define _FLOAT_ALIGNMENT 4 #define _FLOAT_COMPLEX_ALIGNMENT 4 +#if defined(__mips_n64) +#define _LONG_ALIGNMENT 8 +#define _LONG_LONG_ALIGNMENT 8 +#define _DOUBLE_ALIGNMENT 8 +#define _DOUBLE_COMPLEX_ALIGNMENT 8 +#define _LONG_DOUBLE_ALIGNMENT 8 +#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 8 +#define _POINTER_ALIGNMENT 8 +#define _MAX_ALIGNMENT 8 +#define _ALIGNMENT_REQUIRED 0 + +#define _LONG_LONG_ALIGNMENT_32 _INT_ALIGNMENT +/* + * Define the appropriate "implementation choices". + */ +#if !defined(_LP64) +#define _LP64 +#endif +#else #define _LONG_ALIGNMENT 4 #define _LONG_LONG_ALIGNMENT 4 #define _DOUBLE_ALIGNMENT 4 @@ -422,6 +441,7 @@ #if !defined(_I32LPx) && defined(_KERNEL) #define _I32LPx #endif +#endif #define _SUNOS_VTOC_16 #define _DMA_USES_PHYSADDR #define _FIRMWARE_NEEDS_FDISK ==== //depot/projects/smpng/sys/conf/makeLINT.mk#3 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/makeLINT.mk,v 1.2 2010/01/08 19:00:20 bz Exp $ +# $FreeBSD: src/sys/conf/makeLINT.mk,v 1.3 2010/08/19 03:19:26 nwhitehorn Exp $ all: @echo "make LINT only" @@ -17,3 +17,6 @@ echo "ident ${.TARGET}-VIMAGE" >> ${.TARGET}-VIMAGE echo "options VIMAGE" >> ${.TARGET}-VIMAGE .endif +.if ${TARGET} == "powerpc" + echo "machine ${TARGET} ${TARGET_ARCH}" >> ${.TARGET} +.endif ==== //depot/projects/smpng/sys/dev/e1000/if_igb.c#25 (text+ko) ==== @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_igb.c,v 1.54 2010/08/06 20:55:49 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/if_igb.c,v 1.55 2010/08/19 17:00:33 jfv Exp $*/ #ifdef HAVE_KERNEL_OPTION_HEADERS @@ -2473,8 +2473,8 @@ if ((adapter->hw.mac.type == e1000_82575) && (queues > 4)) queues = 4; - /* Limit the VF adapter to one queues */ - if ((adapter->hw.mac.type == e1000_vfadapt) && (queues > 2)) + /* Limit the VF adapter to one queue */ + if (adapter->hw.mac.type == e1000_vfadapt) queues = 1; /* ==== //depot/projects/smpng/sys/fs/devfs/devfs_vnops.c#89 (text+ko) ==== @@ -31,7 +31,7 @@ * @(#)kernfs_vnops.c 8.15 (Berkeley) 5/21/95 * From: FreeBSD: src/sys/miscfs/kernfs/kernfs_vnops.c 1.43 * - * $FreeBSD: src/sys/fs/devfs/devfs_vnops.c,v 1.188 2010/08/12 15:29:07 jh Exp $ + * $FreeBSD: src/sys/fs/devfs/devfs_vnops.c,v 1.189 2010/08/19 16:39:00 jh Exp $ */ /* @@ -848,6 +848,8 @@ *dm_unlock = 0; sx_xunlock(&dmp->dm_lock); devfs_unmount_final(dmp); + if (cdev != NULL) + dev_rel(cdev); return (ENOENT); } if (cdev == NULL) @@ -859,6 +861,7 @@ *dm_unlock = 0; sx_xunlock(&dmp->dm_lock); devfs_unmount_final(dmp); + dev_rel(cdev); return (ENOENT); } ==== //depot/projects/smpng/sys/geom/mirror/g_mirror.c#42 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/mirror/g_mirror.c,v 1.99 2010/01/05 10:30:56 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/mirror/g_mirror.c,v 1.100 2010/08/18 15:38:10 mav Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -844,21 +844,6 @@ } } -static __inline int -bintime_cmp(struct bintime *bt1, struct bintime *bt2) -{ - - if (bt1->sec < bt2->sec) - return (-1); - else if (bt1->sec > bt2->sec) - return (1); - if (bt1->frac < bt2->frac) - return (-1); - else if (bt1->frac > bt2->frac) - return (1); - return (0); -} - static void g_mirror_done(struct bio *bp) { ==== //depot/projects/smpng/sys/i386/i386/trap.c#126 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/trap.c,v 1.330 2010/06/05 15:59:59 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/trap.c,v 1.331 2010/08/19 16:41:27 jhb Exp $"); /* * 386 Trap and System call handling ==== //depot/projects/smpng/sys/ia64/ia64/trap.c#100 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ia64/ia64/trap.c,v 1.138 2010/05/24 17:24:14 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/trap.c,v 1.139 2010/08/19 16:41:27 jhb Exp $"); #include "opt_ddb.h" ==== //depot/projects/smpng/sys/kern/kern_ktrace.c#76 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_ktrace.c,v 1.134 2010/08/17 21:34:19 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_ktrace.c,v 1.135 2010/08/19 16:38:58 jhb Exp $"); #include "opt_ktrace.h" ==== //depot/projects/smpng/sys/kern/kern_proc.c#115 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.300 2010/05/27 08:10:12 attilio Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.301 2010/08/19 16:40:30 jhb Exp $"); #include "opt_compat.h" #include "opt_ddb.h" ==== //depot/projects/smpng/sys/kern/sched_ule.c#107 (text+ko) ==== @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.272 2010/08/06 15:36:59 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.273 2010/08/19 16:41:27 jhb Exp $"); #include "opt_hwpmc_hooks.h" #include "opt_kdtrace.h" ==== //depot/projects/smpng/sys/mips/atheros/ar71xx_cpudef.h#2 (text+ko) ==== @@ -24,7 +24,7 @@ * SUCH DAMAGE. */ -/* $FreeBSD: src/sys/mips/atheros/ar71xx_cpudef.h,v 1.1 2010/08/18 08:22:09 adrian Exp $ */ +/* $FreeBSD: src/sys/mips/atheros/ar71xx_cpudef.h,v 1.2 2010/08/19 16:15:30 adrian Exp $ */ #ifndef __AR71XX_CPUDEF_H__ #define __AR71XX_CPUDEF_H__ @@ -81,6 +81,16 @@ return ar71xx_cpu_ops->ar71xx_chip_device_stopped(mask); } +static inline void ar71xx_device_set_pll_ge0(int speed) +{ + ar71xx_cpu_ops->ar71xx_chip_set_pll_ge0(speed); +} + +static inline void ar71xx_device_set_pll_ge1(int speed) +{ + ar71xx_cpu_ops->ar71xx_chip_set_pll_ge1(speed); +} + static inline void ar71xx_device_flush_ddr_ge0(void) { ar71xx_cpu_ops->ar71xx_chip_ddr_flush_ge0(); ==== //depot/projects/smpng/sys/mips/atheros/ar71xx_machdep.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/mips/atheros/ar71xx_machdep.c,v 1.3 2010/01/25 00:44:05 gonzo Exp $"); +__FBSDID("$FreeBSD: src/sys/mips/atheros/ar71xx_machdep.c,v 1.7 2010/08/19 02:15:39 adrian Exp $"); #include <sys/param.h> #include <machine/cpuregs.h> @@ -57,6 +57,9 @@ #include <mips/atheros/ar71xxreg.h> +#include <mips/atheros/ar71xx_setup.h> +#include <mips/atheros/ar71xx_cpudef.h> + extern char edata[], end[]; uint32_t ar711_base_mac[ETHER_ADDR_LEN]; @@ -118,9 +121,7 @@ void platform_reset(void) { - uint32_t reg = ATH_READ_REG(AR71XX_RST_RESET); - - ATH_WRITE_REG(AR71XX_RST_RESET, reg | RST_RESET_FULL_CHIP); + ar71xx_device_stop(RST_RESET_FULL_CHIP); /* Wait for reset */ while(1) ; @@ -143,7 +144,6 @@ __register_t a2 __unused, __register_t a3 __unused) { uint64_t platform_counter_freq; - uint32_t reg; int argc, i, count = 0; char **argv, **envp; vm_offset_t kernend; @@ -202,11 +202,21 @@ * should be called first. */ init_param1(); + + /* Detect the system type - this is needed for subsequent chipset-specific calls */ + ar71xx_detect_sys_type(); + ar71xx_detect_sys_frequency(); + platform_counter_freq = ar71xx_cpu_freq(); mips_timer_init_params(platform_counter_freq, 1); cninit(); init_static_kenv(boot1_env, sizeof(boot1_env)); + printf("CPU platform: %s\n", ar71xx_get_system_type()); + printf("CPU Frequency=%d MHz\n", u_ar71xx_cpu_freq / 1000000); + printf("CPU DDR Frequency=%d MHz\n", u_ar71xx_ddr_freq / 1000000); + printf("CPU AHB Frequency=%d MHz\n", u_ar71xx_ahb_freq / 1000000); + printf("platform frequency: %lld\n", platform_counter_freq); printf("arguments: \n"); printf(" a0 = %08x\n", a0); @@ -244,22 +254,7 @@ /* * Reset USB devices */ - reg = ATH_READ_REG(AR71XX_RST_RESET); - reg |= - RST_RESET_USB_OHCI_DLL | RST_RESET_USB_HOST | RST_RESET_USB_PHY; - ATH_WRITE_REG(AR71XX_RST_RESET, reg); - DELAY(1000); - reg &= - ~(RST_RESET_USB_OHCI_DLL | RST_RESET_USB_HOST | RST_RESET_USB_PHY); - ATH_WRITE_REG(AR71XX_RST_RESET, reg); - - ATH_WRITE_REG(AR71XX_USB_CTRL_CONFIG, - USB_CTRL_CONFIG_OHCI_DES_SWAP | USB_CTRL_CONFIG_OHCI_BUF_SWAP | - USB_CTRL_CONFIG_EHCI_DES_SWAP | USB_CTRL_CONFIG_EHCI_BUF_SWAP); - - ATH_WRITE_REG(AR71XX_USB_CTRL_FLADJ, - (32 << USB_CTRL_FLADJ_HOST_SHIFT) | (3 << USB_CTRL_FLADJ_A5_SHIFT)); - DELAY(1000); + ar71xx_init_usb_peripheral(); kdb_init(); #ifdef KDB ==== //depot/projects/smpng/sys/mips/atheros/ar71xx_pci.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/mips/atheros/ar71xx_pci.c,v 1.3 2010/08/05 21:31:29 gonzo Exp $"); +__FBSDID("$FreeBSD: src/sys/mips/atheros/ar71xx_pci.c,v 1.4 2010/08/19 02:05:16 adrian Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -56,6 +56,8 @@ #include <mips/atheros/ar71xxreg.h> #include <mips/atheros/ar71xx_pci_bus_space.h> +#include <mips/atheros/ar71xx_cpudef.h> + #undef AR71XX_PCI_DEBUG #ifdef AR71XX_PCI_DEBUG #define dprintf printf @@ -258,7 +260,6 @@ { int busno = 0; int rid = 0; - uint32_t reset; struct ar71xx_pci_softc *sc = device_get_softc(dev); sc->sc_mem_rman.rm_type = RMAN_ARRAY; @@ -295,15 +296,10 @@ } /* reset PCI core and PCI bus */ - reset = ATH_READ_REG(AR71XX_RST_RESET); - reset |= (RST_RESET_PCI_CORE | RST_RESET_PCI_BUS); - ATH_WRITE_REG(AR71XX_RST_RESET, reset); - ATH_READ_REG(AR71XX_RST_RESET); + ar71xx_device_stop(RST_RESET_PCI_CORE | RST_RESET_PCI_BUS); DELAY(100000); - reset &= ~(RST_RESET_PCI_CORE | RST_RESET_PCI_BUS); - ATH_WRITE_REG(AR71XX_RST_RESET, reset); - ATH_READ_REG(AR71XX_RST_RESET); + ar71xx_device_start(RST_RESET_PCI_CORE | RST_RESET_PCI_BUS); DELAY(100000); /* Init PCI windows */ ==== //depot/projects/smpng/sys/mips/atheros/ar71xx_wdog.c#3 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/mips/atheros/ar71xx_wdog.c,v 1.2 2010/06/19 12:12:39 adrian Exp $"); +__FBSDID("$FreeBSD: src/sys/mips/atheros/ar71xx_wdog.c,v 1.3 2010/08/19 02:03:12 adrian Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -41,6 +41,7 @@ #include <sys/sysctl.h> #include <mips/atheros/ar71xxreg.h> +#include <mips/atheros/ar71xx_cpudef.h> struct ar71xx_wdog_softc { device_t dev; ==== //depot/projects/smpng/sys/mips/atheros/ar71xxreg.h#5 (text+ko) ==== @@ -24,7 +24,7 @@ * SUCH DAMAGE. */ -/* $FreeBSD: src/sys/mips/atheros/ar71xxreg.h,v 1.7 2010/08/18 09:11:45 adrian Exp $ */ +/* $FreeBSD: src/sys/mips/atheros/ar71xxreg.h,v 1.11 2010/08/19 16:25:15 adrian Exp $ */ #ifndef _AR71XX_REG_H_ #define _AR71XX_REG_H_ @@ -161,6 +161,7 @@ #define GPIO_FUNC_USB_CLK_EN (0) #define AR71XX_BASE_FREQ 40000000 +#define AR71XX_PLL_CPU_BASE 0x18050000 #define AR71XX_PLL_CPU_CONFIG 0x18050000 #define PLL_SW_UPDATE (1 << 31) #define PLL_LOCKED (1 << 30) @@ -181,6 +182,8 @@ #define PLL_BYPASS (1 << 1) #define PLL_POWER_DOWN (1 << 0) #define AR71XX_PLL_SEC_CONFIG 0x18050004 +#define AR71XX_PLL_ETH0_SHIFT 17 +#define AR71XX_PLL_ETH1_SHIFT 19 #define AR71XX_PLL_CPU_CLK_CTRL 0x18050008 #define AR71XX_PLL_ETH_INT0_CLK 0x18050010 #define AR71XX_PLL_ETH_INT1_CLK 0x18050014 @@ -194,6 +197,9 @@ #define AR71XX_PLL_ETH_EXT_CLK 0x18050018 #define AR71XX_PLL_PCI_CLK 0x1805001C +/* Reset block */ +#define AR71XX_RST_BLOCK_BASE 0x18060000 + #define AR71XX_RST_WDOG_CONTROL 0x18060008 #define RST_WDOG_LAST (1 << 31) #define RST_WDOG_ACTION_MASK 3 @@ -235,6 +241,33 @@ #define RST_RESET_PCI_BUS (1 << 1) #define RST_RESET_PCI_CORE (1 << 0) +/* Chipset revision details */ +#define AR71XX_RST_RESET_REG_REV_ID 0x18060090 +#define REV_ID_MAJOR_MASK 0xfff0 +#define REV_ID_MAJOR_AR71XX 0x00a0 +#define REV_ID_MAJOR_AR913X 0x00b0 +#define REV_ID_MAJOR_AR7240 0x00c0 +#define REV_ID_MAJOR_AR7241 0x0100 +#define REV_ID_MAJOR_AR7242 0x1100 + +/* AR71XX chipset revision details */ +#define AR71XX_REV_ID_MINOR_MASK 0x3 +#define AR71XX_REV_ID_MINOR_AR7130 0x0 +#define AR71XX_REV_ID_MINOR_AR7141 0x1 +#define AR71XX_REV_ID_MINOR_AR7161 0x2 +#define AR71XX_REV_ID_REVISION_MASK 0x3 +#define AR71XX_REV_ID_REVISION_SHIFT 2 + +/* AR724X chipset revision details */ +#define AR724X_REV_ID_REVISION_MASK 0x3 + +/* AR91XX chipset revision details */ +#define AR91XX_REV_ID_MINOR_MASK 0x3 +#define AR91XX_REV_ID_MINOR_AR9130 0x0 +#define AR91XX_REV_ID_MINOR_AR9132 0x1 +#define AR91XX_REV_ID_REVISION_MASK 0x3 +#define AR91XX_REV_ID_REVISION_SHIFT 2 + /* * GigE adapters region */ @@ -459,38 +492,6 @@ #define ATH_WRITE_REG(reg, val) \ *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1((reg))) = (val) -static inline uint64_t -ar71xx_cpu_freq(void) -{ - uint32_t pll_config, div; - uint64_t freq; - - /* PLL freq */ - pll_config = ATH_READ_REG(AR71XX_PLL_CPU_CONFIG); - div = ((pll_config >> PLL_FB_SHIFT) & PLL_FB_MASK) + 1; - freq = div * AR71XX_BASE_FREQ; - /* CPU freq */ - div = ((pll_config >> PLL_CPU_DIV_SEL_SHIFT) & PLL_CPU_DIV_SEL_MASK) - + 1; - freq = freq / div; - - return (freq); -} - -static inline uint64_t -ar71xx_ahb_freq(void) -{ - uint32_t pll_config, div; - uint64_t freq; - - /* PLL freq */ - pll_config = ATH_READ_REG(AR71XX_PLL_CPU_CONFIG); - /* AHB freq */ - div = (((pll_config >> PLL_AHB_DIV_SHIFT) & PLL_AHB_DIV_MASK) + 1) * 2; - freq = ar71xx_cpu_freq() / div; - return (freq); -} - static inline void ar71xx_ddr_flush(uint32_t reg) { @@ -502,4 +503,27 @@ ; } +static inline void +ar71xx_write_pll(uint32_t cfg_reg, uint32_t pll_reg, uint32_t pll, uint32_t pll_reg_shift) +{ + uint32_t sec_cfg; + + /* set PLL registers */ + sec_cfg = ATH_READ_REG(cfg_reg); + sec_cfg &= ~(3 << pll_reg_shift); + sec_cfg |= (2 << pll_reg_shift); + + ATH_WRITE_REG(cfg_reg, sec_cfg); + DELAY(100); + + ATH_WRITE_REG(pll_reg, pll); + sec_cfg |= (3 << pll_reg_shift); + ATH_WRITE_REG(cfg_reg, sec_cfg); + DELAY(100); + + sec_cfg &= ~(3 << pll_reg_shift); + ATH_WRITE_REG(cfg_reg, sec_cfg); + DELAY(100); +} + #endif /* _AR71XX_REG_H_ */ ==== //depot/projects/smpng/sys/mips/atheros/ar724xreg.h#2 (text+ko) ==== @@ -24,7 +24,7 @@ * SUCH DAMAGE. */ -/* $FreeBSD: src/sys/mips/atheros/ar724xreg.h,v 1.1 2010/08/18 00:26:14 adrian Exp $ */ +/* $FreeBSD: src/sys/mips/atheros/ar724xreg.h,v 1.2 2010/08/19 11:53:55 adrian Exp $ */ #ifndef __AR72XX_REG_H__ #define __AR72XX_REG_H__ @@ -47,6 +47,9 @@ #define AR724X_BASE_FREQ 5000000 +#define AR724X_RESET_REG_RESET_MODULE AR71XX_RST_BLOCK_BASE + 0x1c +#define AR724X_RESET_MODULE_USB_OHCI_DLL (1 << 3) + /* XXX so USB requires different init code? -adrian */ #define AR7240_OHCI_BASE 0x1b000000 #define AR7240_OHCI_SIZE 0x01000000 ==== //depot/projects/smpng/sys/mips/atheros/files.ar71xx#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/mips/atheros/files.ar71xx,v 1.2 2010/01/22 22:14:12 gonzo Exp $ +# $FreeBSD: src/sys/mips/atheros/files.ar71xx,v 1.5 2010/08/19 11:53:55 adrian Exp $ mips/atheros/apb.c standard mips/atheros/ar71xx_machdep.c standard @@ -15,3 +15,7 @@ mips/atheros/ar71xx_bus_space_reversed.c standard mips/mips/intr_machdep.c standard mips/mips/tick.c standard +mips/atheros/ar71xx_setup.c standard +mips/atheros/ar71xx_chip.c standard +mips/atheros/ar724x_chip.c standard +mips/atheros/ar91xx_chip.c standard ==== //depot/projects/smpng/sys/mips/atheros/if_arge.c#5 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/mips/atheros/if_arge.c,v 1.6 2010/07/08 15:20:57 adrian Exp $"); +__FBSDID("$FreeBSD: src/sys/mips/atheros/if_arge.c,v 1.9 2010/08/19 16:29:08 adrian Exp $"); /* * AR71XX gigabit ethernet driver @@ -79,6 +79,7 @@ #include <mips/atheros/ar71xxreg.h> #include <mips/atheros/if_argevar.h> +#include <mips/atheros/ar71xx_cpudef.h> #undef ARGE_DEBUG #ifdef ARGE_DEBUG @@ -181,14 +182,10 @@ static void arge_flush_ddr(struct arge_softc *sc) { - - ATH_WRITE_REG(sc->arge_ddr_flush_reg, 1); - while (ATH_READ_REG(sc->arge_ddr_flush_reg) & 1) - ; - - ATH_WRITE_REG(sc->arge_ddr_flush_reg, 1); - while (ATH_READ_REG(sc->arge_ddr_flush_reg) & 1) - ; + if (sc->arge_mac_unit == 0) + ar71xx_device_flush_ddr_ge0(); + else + ar71xx_device_flush_ddr_ge1(); } static int @@ -236,15 +233,6 @@ KASSERT(((sc->arge_mac_unit == 0) || (sc->arge_mac_unit == 1)), ("if_arge: Only MAC0 and MAC1 supported")); - if (sc->arge_mac_unit == 0) { - sc->arge_ddr_flush_reg = AR71XX_WB_FLUSH_GE0; - sc->arge_pll_reg = AR71XX_PLL_ETH_INT0_CLK; - sc->arge_pll_reg_shift = 17; - } else { - sc->arge_ddr_flush_reg = AR71XX_WB_FLUSH_GE1; - sc->arge_pll_reg = AR71XX_PLL_ETH_INT1_CLK; - sc->arge_pll_reg_shift = 19; - } /* * Get which PHY of 5 available we should use for this unit @@ -381,19 +369,9 @@ DELAY(20); /* Step 2. Punt the MAC core from the central reset register */ - reg = ATH_READ_REG(AR71XX_RST_RESET); - if (sc->arge_mac_unit == 0) - reg |= RST_RESET_GE0_MAC; - else if (sc->arge_mac_unit == 1) - reg |= RST_RESET_GE1_MAC; - ATH_WRITE_REG(AR71XX_RST_RESET, reg); + ar71xx_device_stop(sc->arge_mac_unit == 0 ? RST_RESET_GE0_MAC : RST_RESET_GE1_MAC); DELAY(100); - reg = ATH_READ_REG(AR71XX_RST_RESET); - if (sc->arge_mac_unit == 0) - reg &= ~RST_RESET_GE0_MAC; - else if (sc->arge_mac_unit == 1) - reg &= ~RST_RESET_GE1_MAC; - ATH_WRITE_REG(AR71XX_RST_RESET, reg); + ar71xx_device_start(sc->arge_mac_unit == 0 ? RST_RESET_GE0_MAC : RST_RESET_GE1_MAC); /* Step 3. Reconfigure MAC block */ ARGE_WRITE(sc, AR71XX_MAC_CFG1, @@ -683,7 +661,8 @@ static void arge_set_pll(struct arge_softc *sc, int media, int duplex) { - uint32_t cfg, ifcontrol, rx_filtmask, pll, sec_cfg; + uint32_t cfg, ifcontrol, rx_filtmask; + int if_speed; cfg = ARGE_READ(sc, AR71XX_MAC_CFG2); cfg &= ~(MAC_CFG2_IFACE_MODE_1000 @@ -702,21 +681,21 @@ switch(media) { case IFM_10_T: cfg |= MAC_CFG2_IFACE_MODE_10_100; - pll = PLL_ETH_INT_CLK_10; + if_speed = 10; break; case IFM_100_TX: cfg |= MAC_CFG2_IFACE_MODE_10_100; ifcontrol |= MAC_IFCONTROL_SPEED; - pll = PLL_ETH_INT_CLK_100; + if_speed = 100; break; case IFM_1000_T: case IFM_1000_SX: cfg |= MAC_CFG2_IFACE_MODE_1000; rx_filtmask |= FIFO_RX_MASK_BYTE_MODE; - pll = PLL_ETH_INT_CLK_1000; + if_speed = 1000; break; default: - pll = PLL_ETH_INT_CLK_100; + if_speed = 100; device_printf(sc->arge_dev, "Unknown media %d\n", media); } @@ -730,22 +709,10 @@ rx_filtmask); /* set PLL registers */ - sec_cfg = ATH_READ_REG(AR71XX_PLL_SEC_CONFIG); - sec_cfg &= ~(3 << sc->arge_pll_reg_shift); - sec_cfg |= (2 << sc->arge_pll_reg_shift); - - ATH_WRITE_REG(AR71XX_PLL_SEC_CONFIG, sec_cfg); - DELAY(100); - - ATH_WRITE_REG(sc->arge_pll_reg, pll); - - sec_cfg |= (3 << sc->arge_pll_reg_shift); - ATH_WRITE_REG(AR71XX_PLL_SEC_CONFIG, sec_cfg); - DELAY(100); - - sec_cfg &= ~(3 << sc->arge_pll_reg_shift); - ATH_WRITE_REG(AR71XX_PLL_SEC_CONFIG, sec_cfg); - DELAY(100); + if (sc->arge_mac_unit == 0) + ar71xx_device_set_pll_ge0(if_speed); + else + ar71xx_device_set_pll_ge1(if_speed); } ==== //depot/projects/smpng/sys/mips/atheros/if_argevar.h#3 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/mips/atheros/if_argevar.h,v 1.3 2010/07/08 15:20:57 adrian Exp $ + * $FreeBSD: src/sys/mips/atheros/if_argevar.h,v 1.5 2010/08/19 16:29:08 adrian Exp $ */ #ifndef __IF_ARGEVAR_H__ @@ -150,9 +150,6 @@ uint32_t arge_intr_status; int arge_mac_unit; int arge_phymask; - uint32_t arge_ddr_flush_reg; - uint32_t arge_pll_reg; - uint32_t arge_pll_reg_shift; int arge_if_flags; uint32_t arge_debug; struct { ==== //depot/projects/smpng/sys/mips/atheros/uart_bus_ar71xx.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ #include "opt_uart.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/mips/atheros/uart_bus_ar71xx.c,v 1.1 2010/01/09 18:02:31 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/mips/atheros/uart_bus_ar71xx.c,v 1.2 2010/08/19 02:03:12 adrian Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -41,6 +41,7 @@ #include <dev/uart/uart_bus.h> #include <mips/atheros/ar71xxreg.h> +#include <mips/atheros/ar71xx_cpudef.h> #include "uart_if.h" ==== //depot/projects/smpng/sys/mips/atheros/uart_cpu_ar71xx.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ #include "opt_uart.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/mips/atheros/uart_cpu_ar71xx.c,v 1.1 2010/01/09 18:02:31 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/mips/atheros/uart_cpu_ar71xx.c,v 1.2 2010/08/19 02:03:12 adrian Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -39,6 +39,7 @@ #include <dev/uart/uart_cpu.h> #include <mips/atheros/ar71xxreg.h> +#include <mips/atheros/ar71xx_cpudef.h> #include <mips/atheros/ar71xx_bus_space_reversed.h> bus_space_tag_t uart_bus_space_io; ==== //depot/projects/smpng/sys/modules/Makefile#177 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/modules/Makefile,v 1.661 2010/08/12 22:46:31 imp Exp $ +# $FreeBSD: src/sys/modules/Makefile,v 1.662 2010/08/19 11:31:03 anchie Exp $ .include <bsd.own.mk> @@ -257,6 +257,7 @@ ${_scsi_low} \ sdhci \ sem \ + send \ sf \ sge \ siba_bwn \ ==== //depot/projects/smpng/sys/netinet/in.h#52 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)in.h 8.3 (Berkeley) 1/3/94 - * $FreeBSD: src/sys/netinet/in.h,v 1.115 2010/03/31 23:02:25 delphij Exp $ + * $FreeBSD: src/sys/netinet/in.h,v 1.116 2010/08/19 11:31:03 anchie Exp $ */ #ifndef _NETINET_IN_H_ @@ -252,6 +252,7 @@ /* Only used internally, so can be outside the range of valid IP protocols. */ #define IPPROTO_DIVERT 258 /* divert pseudo-protocol */ +#define IPPROTO_SEND 259 /* SeND pseudo-protocol */ /* * Defined to avoid confusion. The master value is defined by ==== //depot/projects/smpng/sys/netinet/tcp_input.c#136 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/netinet/tcp_input.c,v 1.416 2010/04/29 11:52:42 bz Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/tcp_input.c,v 1.417 2010/08/18 17:39:47 andre Exp $"); #include "opt_ipfw.h" /* for ipfw_fwd */ #include "opt_inet.h" @@ -571,7 +571,7 @@ */ if ((tcp_log_in_vain == 1 && (thflags & TH_SYN)) || tcp_log_in_vain == 2) { - if ((s = tcp_log_addrs(NULL, th, (void *)ip, ip6))) + if ((s = tcp_log_vain(NULL, th, (void *)ip, ip6))) log(LOG_INFO, "%s; %s: Connection attempt " "to closed port\n", s, __func__); } ==== //depot/projects/smpng/sys/netinet/tcp_output.c#68 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/netinet/tcp_output.c,v 1.169 2010/08/15 13:25:18 andre Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/tcp_output.c,v 1.170 2010/08/18 18:05:54 andre Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -140,7 +140,7 @@ { struct socket *so = tp->t_inpcb->inp_socket; long len, recwin, sendwin; - int off, flags, error; + int off, flags, error, rw; struct mbuf *m; struct ip *ip = NULL; struct ipovly *ipov = NULL; @@ -176,23 +176,34 @@ idle = (tp->t_flags & TF_LASTIDLE) || (tp->snd_max == tp->snd_una); if (idle && ticks - tp->t_rcvtime >= tp->t_rxtcur) { /* - * We have been idle for "a while" and no acks are - * expected to clock out any data we send -- - * slow start to get ack "clock" running again. + * If we've been idle for more than one retransmit + * timeout the old congestion window is no longer + * current and we have to reduce it to the restart + * window before we can transmit again. + * + * The restart window is the initial window or the last + * CWND, whichever is smaller. + * + * This is done to prevent us from flooding the path with + * a full CWND at wirespeed, overloading router and switch + * buffers along the way. * - * Set the slow-start flight size depending on whether - * this is a local network or not. + * See RFC5681 Section 4.1. "Restarting Idle Connections". */ - int ss = V_ss_fltsz; + if (V_tcp_do_rfc3390) + rw = min(4 * tp->t_maxseg, + max(2 * tp->t_maxseg, 4380)); #ifdef INET6 - if (isipv6) { - if (in6_localaddr(&tp->t_inpcb->in6p_faddr)) - ss = V_ss_fltsz_local; - } else -#endif /* INET6 */ - if (in_localaddr(tp->t_inpcb->inp_faddr)) - ss = V_ss_fltsz_local; - tp->snd_cwnd = tp->t_maxseg * ss; + else if ((isipv6 ? in6_localaddr(&tp->t_inpcb->in6p_faddr) : + in_localaddr(tp->t_inpcb->inp_faddr))) +#else + else if (in_localaddr(tp->t_inpcb->inp_faddr)) +#endif + rw = V_ss_fltsz_local * tp->t_maxseg; + else + rw = V_ss_fltsz * tp->t_maxseg; + + tp->snd_cwnd = min(rw, tp->snd_cwnd); } tp->t_flags &= ~TF_LASTIDLE; if (idle) { ==== //depot/projects/smpng/sys/netinet/tcp_subr.c#124 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/netinet/tcp_subr.c,v 1.361 2010/08/18 09:28:12 bz Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/tcp_subr.c,v 1.362 2010/08/18 17:39:47 andre Exp $"); #include "opt_compat.h" #include "opt_inet.h" @@ -268,6 +268,8 @@ static struct inpcb *tcp_notify(struct inpcb *, int); static void tcp_isn_tick(void *); +static char * tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th, + void *ip4hdr, const void *ip6hdr); /* * Target size of TCP PCB hash tables. Must be a power of two. @@ -2234,9 +2236,33 @@ * and ip6_hdr pointers have to be passed as void pointers. */ char * >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008191743.o7JHhVXI057416>