From owner-svn-src-head@freebsd.org Tue Mar 1 02:59:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3602AAB8E9A; Tue, 1 Mar 2016 02:59:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC3651065; Tue, 1 Mar 2016 02:59:07 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u212x70W097140; Tue, 1 Mar 2016 02:59:07 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u212x6fZ097134; Tue, 1 Mar 2016 02:59:06 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201603010259.u212x6fZ097134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 1 Mar 2016 02:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296250 - in head/sys: arm/arm arm64/arm64 mips/mips riscv/riscv sparc64/sparc64 x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2016 02:59:08 -0000 Author: jhibbits Date: Tue Mar 1 02:59:06 2016 New Revision: 296250 URL: https://svnweb.freebsd.org/changeset/base/296250 Log: Correct the memory rman ranges to be to BUS_SPACE_MAXADDR Summary: As part of the migration of rman_res_t to be typed to uintmax_t, memory ranges must be clamped appropriately for the bus, to prevent completely bogus addresses from being used. This is extracted from D4544. Reviewed By: cem Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5134 Modified: head/sys/arm/arm/nexus.c head/sys/arm64/arm64/nexus.c head/sys/mips/mips/nexus.c head/sys/riscv/riscv/nexus.c head/sys/sparc64/sparc64/nexus.c head/sys/x86/x86/nexus.c Modified: head/sys/arm/arm/nexus.c ============================================================================== --- head/sys/arm/arm/nexus.c Tue Mar 1 02:36:50 2016 (r296249) +++ head/sys/arm/arm/nexus.c Tue Mar 1 02:59:06 2016 (r296250) @@ -161,10 +161,11 @@ nexus_attach(device_t dev) { mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = BUS_SPACE_MAXADDR; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; - if (rman_init(&mem_rman) || rman_manage_region(&mem_rman, 0, ~0)) + if (rman_init(&mem_rman) || + rman_manage_region(&mem_rman, 0, BUS_SPACE_MAXADDR)) panic("nexus_probe mem_rman"); /* Modified: head/sys/arm64/arm64/nexus.c ============================================================================== --- head/sys/arm64/arm64/nexus.c Tue Mar 1 02:36:50 2016 (r296249) +++ head/sys/arm64/arm64/nexus.c Tue Mar 1 02:59:06 2016 (r296250) @@ -153,13 +153,14 @@ nexus_attach(device_t dev) { mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = BUS_SPACE_MAXADDR; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; - if (rman_init(&mem_rman) || rman_manage_region(&mem_rman, 0, ~0)) + if (rman_init(&mem_rman) || + rman_manage_region(&mem_rman, 0, BUS_SPACE_MAXADDR)) panic("nexus_attach mem_rman"); irq_rman.rm_start = 0; - irq_rman.rm_end = ~0ul; + irq_rman.rm_end = ~0; irq_rman.rm_type = RMAN_ARRAY; irq_rman.rm_descr = "Interrupts"; if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, ~0)) Modified: head/sys/mips/mips/nexus.c ============================================================================== --- head/sys/mips/mips/nexus.c Tue Mar 1 02:36:50 2016 (r296249) +++ head/sys/mips/mips/nexus.c Tue Mar 1 02:59:06 2016 (r296250) @@ -185,11 +185,11 @@ nexus_probe(device_t dev) } mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = BUS_SPACE_MAXADDR; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "Memory addresses"; if (rman_init(&mem_rman) != 0 || - rman_manage_region(&mem_rman, 0, ~0) != 0) { + rman_manage_region(&mem_rman, 0, BUS_SPACE_MAXADDR) != 0) { panic("%s: mem_rman", __func__); } Modified: head/sys/riscv/riscv/nexus.c ============================================================================== --- head/sys/riscv/riscv/nexus.c Tue Mar 1 02:36:50 2016 (r296249) +++ head/sys/riscv/riscv/nexus.c Tue Mar 1 02:59:06 2016 (r296250) @@ -143,13 +143,14 @@ nexus_attach(device_t dev) { mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = BUS_SPACE_MAXADDR; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; - if (rman_init(&mem_rman) || rman_manage_region(&mem_rman, 0, ~0)) + if (rman_init(&mem_rman) || + rman_manage_region(&mem_rman, 0, BUS_SPACE_MAXADDR)) panic("nexus_attach mem_rman"); irq_rman.rm_start = 0; - irq_rman.rm_end = ~0ul; + irq_rman.rm_end = ~0; irq_rman.rm_type = RMAN_ARRAY; irq_rman.rm_descr = "Interrupts"; if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, ~0)) Modified: head/sys/sparc64/sparc64/nexus.c ============================================================================== --- head/sys/sparc64/sparc64/nexus.c Tue Mar 1 02:36:50 2016 (r296249) +++ head/sys/sparc64/sparc64/nexus.c Tue Mar 1 02:59:06 2016 (r296250) @@ -233,7 +233,7 @@ nexus_attach(device_t dev) rman_init(&sc->sc_mem_rman) != 0 || rman_manage_region(&sc->sc_intr_rman, 0, IV_MAX - 1) != 0 || - rman_manage_region(&sc->sc_mem_rman, 0ULL, ~0ULL) != 0) + rman_manage_region(&sc->sc_mem_rman, 0, BUS_SPACE_MAXADDR) != 0) panic("%s: failed to set up rmans.", __func__); } else node = ofw_bus_get_node(dev); Modified: head/sys/x86/x86/nexus.c ============================================================================== --- head/sys/x86/x86/nexus.c Tue Mar 1 02:36:50 2016 (r296249) +++ head/sys/x86/x86/nexus.c Tue Mar 1 02:59:06 2016 (r296250) @@ -261,11 +261,15 @@ nexus_init_resources(void) panic("nexus_init_resources port_rman"); mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; +#ifndef PAE + mem_rman.rm_end = BUS_SPACE_MAXADDR; +#else + mem_rman.rm_end = ((1ULL << cpu_maxphyaddr) - 1); +#endif mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; if (rman_init(&mem_rman) - || rman_manage_region(&mem_rman, 0, ~0)) + || rman_manage_region(&mem_rman, 0, mem_rman.rm_end)) panic("nexus_init_resources mem_rman"); }