From owner-svn-src-stable@FreeBSD.ORG Wed Sep 16 12:07:58 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E4F31065694; Wed, 16 Sep 2009 12:07:58 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68D208FC16; Wed, 16 Sep 2009 12:07:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8GC7wIi023640; Wed, 16 Sep 2009 12:07:58 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8GC7wpR023623; Wed, 16 Sep 2009 12:07:58 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200909161207.n8GC7wpR023623@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 16 Sep 2009 12:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197251 - in stable/8/sys: . amd64/include/xen arm/conf arm/mv arm/mv/discovery arm/mv/kirkwood arm/mv/orion cddl/contrib/opensolaris conf contrib/dev/acpica contrib/pf dev/mge dev/xen/... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2009 12:07:58 -0000 Author: raj Date: Wed Sep 16 12:07:58 2009 New Revision: 197251 URL: http://svn.freebsd.org/changeset/base/197251 Log: MFC r196531-196534,196536 Clean up Marvell platform code. Introduce SheevaPlug support. - The device is based on Marvell 88F6281 system on chip. - More info about the platform at http://www.plugcomputer.org - To build the FreeBSD kernel: make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG - Installation notes at: http://wiki.freebsd.org/FreeBSDMarvell Submitted by: Michal Hajduk Approved by: re (kib) Obtained from: Semihalf Added: stable/8/sys/arm/conf/SHEEVAPLUG - copied unchanged from r196536, head/sys/arm/conf/SHEEVAPLUG stable/8/sys/arm/mv/kirkwood/files.kirkwood - copied unchanged from r196533, head/sys/arm/mv/kirkwood/files.kirkwood stable/8/sys/arm/mv/kirkwood/files.sheevaplug - copied unchanged from r196536, head/sys/arm/mv/kirkwood/files.sheevaplug stable/8/sys/arm/mv/kirkwood/sheevaplug.c - copied unchanged from r196536, head/sys/arm/mv/kirkwood/sheevaplug.c stable/8/sys/arm/mv/kirkwood/std.kirkwood - copied unchanged from r196533, head/sys/arm/mv/kirkwood/std.kirkwood stable/8/sys/arm/mv/kirkwood/std.sheevaplug - copied unchanged from r196536, head/sys/arm/mv/kirkwood/std.sheevaplug Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/arm/mv/common.c stable/8/sys/arm/mv/discovery/db78xxx.c stable/8/sys/arm/mv/kirkwood/db88f6xxx.c stable/8/sys/arm/mv/kirkwood/files.db88f6xxx stable/8/sys/arm/mv/kirkwood/std.db88f6xxx stable/8/sys/arm/mv/mv_machdep.c stable/8/sys/arm/mv/mvreg.h stable/8/sys/arm/mv/mvvar.h stable/8/sys/arm/mv/orion/db88f5xxx.c stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/options.arm stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/mge/if_mge.c stable/8/sys/dev/xen/xenpci/ (props changed) Copied: stable/8/sys/arm/conf/SHEEVAPLUG (from r196536, head/sys/arm/conf/SHEEVAPLUG) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/conf/SHEEVAPLUG Wed Sep 16 12:07:58 2009 (r197251, copy of r196536, head/sys/arm/conf/SHEEVAPLUG) @@ -0,0 +1,70 @@ +# +# Custom kernel for Marvell SheevaPlug devices. +# +# $FreeBSD$ +# + +ident SHEEVAPLUG +include "../mv/kirkwood/std.sheevaplug" + +options SOC_MV_KIRKWOOD +makeoptions MODULES_OVERRIDE="" + +#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options NFSCLIENT #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=mge0 + +# Root fs on USB device +#options ROOTDEVNAME=\"ufs:/dev/da0a\" + +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options MUTEX_NOINLINE +options RWLOCK_NOINLINE +options NO_FFS_SNAPSHOT +options NO_SWAPPING + +# Debugging +options ALT_BREAK_TO_DEBUGGER +options DDB +options KDB + +# Pseudo devices +device random +device pty +device loop + +# Serial ports +device uart + +# Networking +device ether +device mge # Marvell Gigabit Ethernet controller +device mii +device e1000phy +device bpf +options HZ=1000 +options DEVICE_POLLING +device vlan + +# USB +device usb +device ehci +device umass +device scbus +device pass +device da + Modified: stable/8/sys/arm/mv/common.c ============================================================================== --- stable/8/sys/arm/mv/common.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/common.c Wed Sep 16 12:07:58 2009 (r197251) @@ -32,8 +32,10 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include +#include #include @@ -62,6 +64,76 @@ static void decode_win_usb_dump(void); static uint32_t used_cpu_wins; +static __inline int +pm_is_disabled(uint32_t mask) +{ + + return (soc_power_ctrl_get(mask) == mask ? 0 : 1); +} + +static __inline uint32_t +obio_get_pm_mask(uint32_t base) +{ + struct obio_device *od; + + for (od = obio_devices; od->od_name != NULL; od++) + if (od->od_base == base) + return (od->od_pwr_mask); + + return (CPU_PM_CTRL_NONE); +} + +/* + * Disable device using power management register. + * 1 - Device Power On + * 0 - Device Power Off + * Mask can be set in loader. + * EXAMPLE: + * loader> set hw.pm-disable-mask=0x2 + * + * Common mask: + * |-------------------------------| + * | Device | Kirkwood | Discovery | + * |-------------------------------| + * | USB0 | 0x00008 | 0x020000 | + * |-------------------------------| + * | USB1 | - | 0x040000 | + * |-------------------------------| + * | USB2 | - | 0x080000 | + * |-------------------------------| + * | GE0 | 0x00001 | 0x000002 | + * |-------------------------------| + * | GE1 | - | 0x000004 | + * |-------------------------------| + * | IDMA | - | 0x100000 | + * |-------------------------------| + * | XOR | 0x10000 | 0x200000 | + * |-------------------------------| + * | CESA | 0x20000 | 0x400000 | + * |-------------------------------| + * | SATA | 0x04000 | 0x004000 | + * --------------------------------| + * This feature can be used only on Kirkwood and Discovery + * machines. + */ +static __inline void +pm_disable_device(int mask) +{ +#ifdef DIAGNOSTIC + uint32_t reg; + + reg = soc_power_ctrl_get(CPU_PM_CTRL_ALL); + printf("Power Management Register: 0%x\n", reg); + + reg &= ~mask; + soc_power_ctrl_set(reg); + printf("Device %x is disabled\n", mask); + + reg = soc_power_ctrl_get(CPU_PM_CTRL_ALL); + printf("Power Management Register: 0%x\n", reg); +#endif +} + uint32_t read_cpu_ctrl(uint32_t reg) { @@ -103,14 +175,36 @@ cpu_extra_feat(void) return (ef); } +/* + * Get the power status of device. This feature is only supported on + * Kirkwood and Discovery SoCs. + */ uint32_t soc_power_ctrl_get(uint32_t mask) { +#ifndef SOC_MV_ORION if (mask != CPU_PM_CTRL_NONE) mask &= read_cpu_ctrl(CPU_PM_CTRL); return (mask); +#else + return (mask); +#endif +} + +/* + * Set the power status of device. This feature is only supported on + * Kirkwood and Discovery SoCs. + */ +void +soc_power_ctrl_set(uint32_t mask) +{ + +#ifndef SOC_MV_ORION + if (mask != CPU_PM_CTRL_NONE) + write_cpu_ctrl(CPU_PM_CTRL, mask); +#endif } void @@ -191,6 +285,13 @@ int soc_decode_win(void) { uint32_t dev, rev; + int mask; + + mask = 0; + TUNABLE_INT_FETCH("hw.pm-disable-mask", &mask); + + if (mask != 0) + pm_disable_device(mask); /* Retrieve our ID: some windows facilities vary between SoC models */ soc_id(&dev, &rev); @@ -623,8 +724,12 @@ decode_win_usb_setup(void) /* Disable and clear all USB windows for all ports */ m = usb_max_ports(); + for (p = 0; p < m; p++) { + if (pm_is_disabled(CPU_PM_CTRL_USB(p))) + continue; + for (i = 0; i < MV_WIN_USB_MAX; i++) { win_usb_cr_write(i, p, 0); win_usb_br_write(i, p, 0); @@ -710,6 +815,9 @@ decode_win_eth_setup(uint32_t base) uint32_t br, sz; int i, j; + if (pm_is_disabled(obio_get_pm_mask(base))) + return; + /* Disable, clear and revoke protection for all ETH windows */ for (i = 0; i < MV_WIN_ETH_MAX; i++) { @@ -880,6 +988,8 @@ decode_win_idma_setup(void) uint32_t br, sz; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_IDMA)) + return; /* * Disable and clear all IDMA windows, revoke protection for all channels */ @@ -1172,6 +1282,9 @@ decode_win_xor_setup(void) uint32_t br, sz; int i, j, z, e = 1, m, window; + if (pm_is_disabled(CPU_PM_CTRL_XOR)) + return; + /* * Disable and clear all XOR windows, revoke protection for all * channels @@ -1364,6 +1477,9 @@ decode_win_cesa_setup(void) uint32_t br, cr; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_CRYPTO)) + return; + /* Disable and clear all CESA windows */ for (i = 0; i < MV_WIN_CESA_MAX; i++) { win_cesa_cr_write(i, 0); @@ -1432,6 +1548,9 @@ decode_win_sata_setup(void) uint32_t cr, br; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_SATA)) + return; + for (i = 0; i < MV_WIN_SATA_MAX; i++) { win_sata_cr_write(i, 0); win_sata_br_write(i, 0); Modified: stable/8/sys/arm/mv/discovery/db78xxx.c ============================================================================== --- stable/8/sys/arm/mv/discovery/db78xxx.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/discovery/db78xxx.c Wed Sep 16 12:07:58 2009 (r197251) @@ -68,11 +68,8 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; - /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -105,16 +102,6 @@ const struct gpio_config mv_gpio_config[ { -1, -1, -1 } }; -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { Modified: stable/8/sys/arm/mv/kirkwood/db88f6xxx.c ============================================================================== --- stable/8/sys/arm/mv/kirkwood/db88f6xxx.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/kirkwood/db88f6xxx.c Wed Sep 16 12:07:58 2009 (r197251) @@ -68,11 +68,8 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; - /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -105,16 +102,6 @@ const struct gpio_config mv_gpio_config[ { -1, -1, -1 } }; -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { Modified: stable/8/sys/arm/mv/kirkwood/files.db88f6xxx ============================================================================== --- stable/8/sys/arm/mv/kirkwood/files.db88f6xxx Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/kirkwood/files.db88f6xxx Wed Sep 16 12:07:58 2009 (r197251) @@ -1,5 +1,4 @@ # $FreeBSD$ -arm/mv/rtc.c standard -arm/mv/kirkwood/kirkwood.c standard +include "arm/mv/kirkwood/files.kirkwood" arm/mv/kirkwood/db88f6xxx.c standard Copied: stable/8/sys/arm/mv/kirkwood/files.kirkwood (from r196533, head/sys/arm/mv/kirkwood/files.kirkwood) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/files.kirkwood Wed Sep 16 12:07:58 2009 (r197251, copy of r196533, head/sys/arm/mv/kirkwood/files.kirkwood) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +arm/mv/rtc.c standard +arm/mv/kirkwood/kirkwood.c standard Copied: stable/8/sys/arm/mv/kirkwood/files.sheevaplug (from r196536, head/sys/arm/mv/kirkwood/files.sheevaplug) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/files.sheevaplug Wed Sep 16 12:07:58 2009 (r197251, copy of r196536, head/sys/arm/mv/kirkwood/files.sheevaplug) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +include "arm/mv/kirkwood/files.kirkwood" +arm/mv/kirkwood/sheevaplug.c standard Copied: stable/8/sys/arm/mv/kirkwood/sheevaplug.c (from r196536, head/sys/arm/mv/kirkwood/sheevaplug.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/sheevaplug.c Wed Sep 16 12:07:58 2009 (r197251, copy of r196536, head/sys/arm/mv/kirkwood/sheevaplug.c) @@ -0,0 +1,152 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * Copyright (C) 2009 Semihalf + * 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. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY 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 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 +#include +#include + +#include +#include +#include + +/* + * Virtual address space layout: + * ----------------------------- + * 0x0000_0000 - 0x7FFF_FFFF : User Process (2 GB) + * 0x8000_0000 - 0xBBFF_FFFF : Unused (960 MB) + * 0xBC00_0000 - 0xBDFF_FFFF : Device Bus: CS1 (32 MB) + * 0xBE00_0000 - 0xBECF_FFFF : Unused (13 MB) + * 0xBED0_0000 - 0xBEDF_FFFF : Device Bus: CS2 (1 MB) + * 0xBEE0_0000 - 0xBEEF_FFFF : Device Bus: CS0 (1 MB) + * 0xBEF0_0000 - 0xBEFF_FFFF : Device Bus: BOOT (1 MB) + * 0xBF00_0000 - 0xBFFF_FFFF : Unused (16 MB) + * 0xC000_0000 - virtual_avail : Kernel Reserved (text, data, page tables, + * : stack etc.) + * virtual-avail - 0xEFFF_FFFF : KVA (virtual_avail is typically < 0xc0a0_0000) + * 0xF000_0000 - 0xF0FF_FFFF : No-Cache allocation area (16 MB) + * 0xF100_0000 - 0xF10F_FFFF : SoC Integrated devices registers range (1 MB) + * 0xF110_0000 - 0xF11F_FFFF : CESA SRAM (1 MB) + * 0xF120_0000 - 0xFFFE_FFFF : Unused (237 MB + 960 kB) + * 0xFFFF_0000 - 0xFFFF_0FFF : 'High' vectors page (4 kB) + * 0xFFFF_1000 - 0xFFFF_1FFF : ARM_TP_ADDRESS/RAS page (4 kB) + * 0xFFFF_2000 - 0xFFFF_FFFF : Unused (56 kB) + */ + +/* Static device mappings. */ +const struct pmap_devmap pmap_devmap[] = { + /* + * Map the on-board devices VA == PA so that we can access them + * with the MMU on or off. + */ + { /* SoC integrated peripherals registers range */ + MV_BASE, + MV_PHYS_BASE, + MV_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, + { /* CESA SRAM */ + MV_CESA_SRAM_BASE, + MV_CESA_SRAM_PHYS_BASE, + MV_CESA_SRAM_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, + { 0, 0, 0, 0, 0, } +}; + +const struct gpio_config mv_gpio_config[] = { + { -1, -1, -1 } +}; + +void +platform_mpp_init(void) +{ + + /* + * MPP configuration for Sheeva Plug + * + * MPP[0]: NF_IO[2] + * MPP[1]: NF_IO[3] + * MPP[2]: NF_IO[4] + * MPP[3]: NF_IO[5] + * MPP[4]: NF_IO[6] + * MPP[5]: NF_IO[7] + * MPP[6]: SYSRST_OUTn + * MPP[8]: UA0_RTS + * MPP[9]: UA0_CTS + * MPP[10]: UA0_TXD + * MPP[11]: UA0_RXD + * MPP[12]: SD_CLK + * MPP[13]: SD_CMD + * MPP[14]: SD_D[0] + * MPP[15]: SD_D[1] + * MPP[16]: SD_D[2] + * MPP[17]: SD_D[3] + * MPP[18]: NF_IO[0] + * MPP[19]: NF_IO[1] + * MPP[29]: TSMP[9] + * + * Others: GPIO + */ + + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL0, 0x01111111); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL1, 0x11113322); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL2, 0x00001111); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL3, 0x00100000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL4, 0x00000000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL5, 0x00000000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL6, 0x00000000); +} + +static void +platform_identify(void *dummy) +{ + + soc_identify(); + + /* + * XXX Board identification e.g. read out from FPGA or similar should + * go here + */ +} +SYSINIT(platform_identify, SI_SUB_CPU, SI_ORDER_SECOND, platform_identify, NULL); Modified: stable/8/sys/arm/mv/kirkwood/std.db88f6xxx ============================================================================== --- stable/8/sys/arm/mv/kirkwood/std.db88f6xxx Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/kirkwood/std.db88f6xxx Wed Sep 16 12:07:58 2009 (r197251) @@ -1,13 +1,8 @@ # $FreeBSD$ include "../mv/std.mv" +include "../mv/kirkwood/std.kirkwood" files "../mv/kirkwood/files.db88f6xxx" -makeoptions KERNPHYSADDR=0x00900000 -makeoptions KERNVIRTADDR=0xc0900000 -options KERNPHYSADDR=0x00900000 -options KERNVIRTADDR=0xc0900000 -options PHYSADDR=0x00000000 options PHYSMEM_SIZE=0x20000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 Copied: stable/8/sys/arm/mv/kirkwood/std.kirkwood (from r196533, head/sys/arm/mv/kirkwood/std.kirkwood) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/std.kirkwood Wed Sep 16 12:07:58 2009 (r197251, copy of r196533, head/sys/arm/mv/kirkwood/std.kirkwood) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +# kernel gets loaded at 0x00900000 by the loader, but runs at virtual address +# 0xc0900000. RAM starts at 0. We put the pagetable at a reasonable place +# in memory, but may need to bounce it higher if there's a problem with this. +# We could paper over this by loading the kernel at 0xc0000000 virtual, but +# that leads to other complications, so we'll just reclaim the lower region of +# ram after we're loaded. Put the page tables for startup at 1MB. +makeoptions KERNPHYSADDR=0x00900000 +makeoptions KERNVIRTADDR=0xc0900000 + +options KERNPHYSADDR=0x00900000 +options KERNVIRTADDR=0xc0900000 +options PHYSADDR=0x00000000 +options STARTUP_PAGETABLE_ADDR=0x00100000 Copied: stable/8/sys/arm/mv/kirkwood/std.sheevaplug (from r196536, head/sys/arm/mv/kirkwood/std.sheevaplug) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/std.sheevaplug Wed Sep 16 12:07:58 2009 (r197251, copy of r196536, head/sys/arm/mv/kirkwood/std.sheevaplug) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +include "../mv/std.mv" +include "../mv/kirkwood/std.kirkwood" +files "../mv/kirkwood/files.sheevaplug" + +options PHYSMEM_SIZE=0x20000000 +options MII_ADDR_BASE=0 Modified: stable/8/sys/arm/mv/mv_machdep.c ============================================================================== --- stable/8/sys/arm/mv/mv_machdep.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/mv_machdep.c Wed Sep 16 12:07:58 2009 (r197251) @@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include /* XXX eventually this should be eliminated */ +#include #ifdef DEBUG #define debugf(fmt, args...) printf(fmt, ##args) @@ -133,7 +134,9 @@ struct pcpu *pcpup = &__pcpu; vm_paddr_t phys_avail[10]; vm_paddr_t dump_avail[4]; vm_offset_t physical_pages; +vm_offset_t pmap_bootstrap_lastaddr; +const struct pmap_devmap *pmap_devmap_bootstrap_table; struct pv_addr systempage; struct pv_addr msgbufpv; struct pv_addr irqstack; @@ -423,8 +426,8 @@ initarm(void *mdp, void *unused __unused while (1); /* Platform-specific initialisation */ - if (platform_pmap_init() != 0) - return (NULL); + pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; + pmap_devmap_bootstrap_table = &pmap_devmap[0]; pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: stable/8/sys/arm/mv/mvreg.h ============================================================================== --- stable/8/sys/arm/mv/mvreg.h Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/mvreg.h Wed Sep 16 12:07:58 2009 (r197251) @@ -218,6 +218,7 @@ */ #define CPU_PM_CTRL 0x1C #define CPU_PM_CTRL_NONE 0 +#define CPU_PM_CTRL_ALL ~0x0 #if defined(SOC_MV_KIRKWOOD) #define CPU_PM_CTRL_GE0 (1 << 0) @@ -234,8 +235,11 @@ #define CPU_PM_CTRL_SATA1 (1 << 15) #define CPU_PM_CTRL_XOR1 (1 << 16) #define CPU_PM_CTRL_CRYPTO (1 << 17) -#define CPU_PM_CTRL_GE1 (1 << 18) -#define CPU_PM_CTRL_TDM (1 << 19) +#define CPU_PM_CTRL_GE1 (1 << 19) +#define CPU_PM_CTRL_TDM (1 << 20) +#define CPU_PM_CTRL_XOR (CPU_PM_CTRL_XOR0 | CPU_PM_CTRL_XOR1) +#define CPU_PM_CTRL_USB(u) (CPU_PM_CTRL_USB0) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_SATA0 | CPU_PM_CTRL_SATA1) #elif defined(SOC_MV_DISCOVERY) #define CPU_PM_CTRL_GE0 (1 << 1) #define CPU_PM_CTRL_GE1 (1 << 2) @@ -258,6 +262,14 @@ #define CPU_PM_CTRL_XOR (1 << 21) #define CPU_PM_CTRL_CRYPTO (1 << 22) #define CPU_PM_CTRL_DEVICE (1 << 23) +#define CPU_PM_CTRL_USB(u) (1 << (17 + (u))) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_SATA0 | CPU_PM_CTRL_SATA1) +#else +#define CPU_PM_CTRL_CRYPTO (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_IDMA (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_XOR (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_USB(u) (CPU_PM_CTRL_NONE) #endif /* Modified: stable/8/sys/arm/mv/mvvar.h ============================================================================== --- stable/8/sys/arm/mv/mvvar.h Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/mvvar.h Wed Sep 16 12:07:58 2009 (r197251) @@ -41,6 +41,10 @@ #define _MVVAR_H_ #include +#include +#include +#include +#include #define MV_TYPE_PCI 0 #define MV_TYPE_PCIE 1 @@ -104,6 +108,7 @@ struct decode_win { int remap; }; +extern const struct pmap_devmap pmap_devmap[]; extern const struct obio_pci mv_pci_info[]; extern const struct gpio_config mv_gpio_config[]; extern bus_space_tag_t obio_tag; @@ -124,13 +129,13 @@ int mv_gpio_configure(uint32_t pin, uint void mv_gpio_out(uint32_t pin, uint8_t val, uint8_t enable); uint8_t mv_gpio_in(uint32_t pin); -int platform_pmap_init(void); void platform_mpp_init(void); int soc_decode_win(void); void soc_id(uint32_t *dev, uint32_t *rev); void soc_identify(void); void soc_dump_decode_win(void); uint32_t soc_power_ctrl_get(uint32_t mask); +void soc_power_ctrl_set(uint32_t mask); int decode_win_cpu_set(int target, int attr, vm_paddr_t base, uint32_t size, int remap); Modified: stable/8/sys/arm/mv/orion/db88f5xxx.c ============================================================================== --- stable/8/sys/arm/mv/orion/db88f5xxx.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/orion/db88f5xxx.c Wed Sep 16 12:07:58 2009 (r197251) @@ -70,12 +70,10 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; int platform_pci_get_irq(u_int bus, u_int slot, u_int func, u_int pin); /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -184,16 +182,6 @@ const struct gpio_config mv_gpio_config[ }; #endif -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { Modified: stable/8/sys/conf/options.arm ============================================================================== --- stable/8/sys/conf/options.arm Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/conf/options.arm Wed Sep 16 12:07:58 2009 (r197251) @@ -24,6 +24,7 @@ KERNVIRTADDR opt_global.h LOADERRAMADDR opt_global.h PHYSADDR opt_global.h PHYSMEM_SIZE opt_global.h +MII_ADDR_BASE opt_global.h SKYEYE_WORKAROUNDS opt_global.h SOC_MV_DISCOVERY opt_global.h SOC_MV_KIRKWOOD opt_global.h Modified: stable/8/sys/dev/mge/if_mge.c ============================================================================== --- stable/8/sys/dev/mge/if_mge.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/dev/mge/if_mge.c Wed Sep 16 12:07:58 2009 (r197251) @@ -69,7 +69,9 @@ __FBSDID("$FreeBSD$"); #include #include -#define MV_PHY_ADDR_BASE 8 +#ifndef MII_ADDR_BASE +#define MII_ADDR_BASE 8 +#endif #include #include @@ -1264,14 +1266,15 @@ mge_miibus_readreg(device_t dev, int phy /* * We assume static PHY address <=> device unit mapping: - * PHY Address = MV_PHY_ADDR_BASE + devce unit. + * PHY Address = MII_ADDR_BASE + devce unit. * This is true for most Marvell boards. * * Code below grants proper PHY detection on each device * unit. */ - if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy) + + if ((MII_ADDR_BASE + device_get_unit(dev)) != phy) return (0); MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff & @@ -1292,7 +1295,7 @@ mge_miibus_writereg(device_t dev, int ph { uint32_t retries; - if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy) + if ((MII_ADDR_BASE + device_get_unit(dev)) != phy) return (0); MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff &