From owner-svn-src-all@FreeBSD.ORG Mon Mar 18 15:18:57 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 22276EAB; Mon, 18 Mar 2013 15:18:57 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EF4241D1; Mon, 18 Mar 2013 15:18:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2IFIueU088998; Mon, 18 Mar 2013 15:18:56 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2IFIu48088992; Mon, 18 Mar 2013 15:18:56 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303181518.r2IFIu48088992@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 18 Mar 2013 15:18:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248467 - in head/sys: arm/include dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 15:18:57 -0000 Author: ray Date: Mon Mar 18 15:18:55 2013 New Revision: 248467 URL: http://svnweb.freebsd.org/changeset/base/248467 Log: o Switch to use physical addresses in rman for FDT. o Remove vtophys used to translate virtual address to physical in case rman carry virtual. Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/include/bus.h head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdtbus.c head/sys/dev/fdt/simplebus.c Modified: head/sys/arm/include/bus.h ============================================================================== --- head/sys/arm/include/bus.h Mon Mar 18 15:14:36 2013 (r248466) +++ head/sys/arm/include/bus.h Mon Mar 18 15:18:55 2013 (r248467) @@ -731,6 +731,6 @@ bs_c_8_proto(f); * designed. It also serves to mark the locations needing that fix. */ #define BUS_SPACE_PHYSADDR(res, offs) \ - (vtophys(rman_get_start(res)+(offs))) + ((u_int)(rman_get_start(res)+(offs))) #endif /* _MACHINE_BUS_H_ */ Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Mon Mar 18 15:14:36 2013 (r248466) +++ head/sys/dev/fdt/fdt_common.c Mon Mar 18 15:18:55 2013 (r248467) @@ -421,12 +421,12 @@ fdt_regsize(phandle_t node, u_long *base int fdt_reg_to_rl(phandle_t node, struct resource_list *rl) { - u_long start, end, count; + u_long count; pcell_t *reg, *regptr; pcell_t addr_cells, size_cells; int tuple_size, tuples; int i, rv; - bus_space_handle_t vaddr; + bus_space_handle_t start, end; long busaddr, bussize; if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells) != 0) @@ -457,14 +457,12 @@ fdt_reg_to_rl(phandle_t node, struct res /* Calculate address range relative to base. */ start += busaddr; - if (bus_space_map(fdtbus_bs_tag, start, count, 0, &vaddr) != 0) - panic("Couldn't map the device memory"); - end = vaddr + count - 1; + end = start + count - 1; - debugf("reg addr start = %lx, end = %lx, count = %lx\n", vaddr, + debugf("reg addr start = %lx, end = %lx, count = %lx\n", start, end, count); - resource_list_add(rl, SYS_RES_MEMORY, i, vaddr, end, + resource_list_add(rl, SYS_RES_MEMORY, i, start, end, count); } rv = 0; Modified: head/sys/dev/fdt/fdtbus.c ============================================================================== --- head/sys/dev/fdt/fdtbus.c Mon Mar 18 15:14:36 2013 (r248466) +++ head/sys/dev/fdt/fdtbus.c Mon Mar 18 15:18:55 2013 (r248467) @@ -617,6 +617,16 @@ static int fdtbus_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { + bus_space_handle_t p; + int error; + + if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { + error = bus_space_map(rman_get_bustag(res), + rman_get_bushandle(res), rman_get_size(res), 0, &p); + if (error) + return (error); + rman_set_bushandle(res, p); + } return (rman_activate_resource(res)); } Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Mon Mar 18 15:14:36 2013 (r248466) +++ head/sys/dev/fdt/simplebus.c Mon Mar 18 15:18:55 2013 (r248467) @@ -179,7 +179,6 @@ simplebus_attach(device_t dev) device_printf(dev, "%s: could not process 'reg' " "property\n", di->di_ofw.obd_name); - /* XXX should unmap */ ofw_bus_gen_destroy_devinfo(&di->di_ofw); free(di, M_SIMPLEBUS); continue; @@ -189,7 +188,6 @@ simplebus_attach(device_t dev) device_printf(dev, "%s: could not process " "'interrupts' property\n", di->di_ofw.obd_name); resource_list_free(&di->di_res); - /* XXX should unmap */ ofw_bus_gen_destroy_devinfo(&di->di_ofw); free(di, M_SIMPLEBUS); continue; @@ -201,7 +199,6 @@ simplebus_attach(device_t dev) device_printf(dev, "could not add child: %s\n", di->di_ofw.obd_name); resource_list_free(&di->di_res); - /* XXX should unmap */ ofw_bus_gen_destroy_devinfo(&di->di_ofw); free(di, M_SIMPLEBUS); continue;