Date: Mon, 7 May 2007 19:05:26 GMT From: Bruce M Simpson <bms@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 119439 for review Message-ID: <200705071905.l47J5Qse097500@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119439 Change 119439 by bms@bms_anglepoise on 2007/05/07 19:04:54 Add memory resource manager. Update comments. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/nexus.c#7 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/nexus.c#7 (text+ko) ==== @@ -34,13 +34,11 @@ * attachment point for both processors and buses, and to manage * resources which are common to all of them. In particular, * this code implements the core resource managers for interrupt - * requests, DMA requests (which rightfully should be a part of the - * ISA code but it's easier to do it here for now), I/O port addresses, - * and I/O memory address space. + * requests and memory address space. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/nexus.c,v 1.7 2006/04/20 04:12:02 imp Exp $"); +__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> @@ -69,6 +67,7 @@ #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) static struct rman irq_rman; +static struct rman mem_rman; static int nexus_probe(device_t); static int nexus_attach(device_t); @@ -122,6 +121,14 @@ panic("nexus_probe irq_rman"); } + mem_rman.rm_start = 0; + mem_rman.rm_end = ~0u; + 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) + panic("nexus_probe mem_rman"); + return (0); } @@ -229,6 +236,10 @@ rm = &irq_rman; break; + case SYS_RES_MEMORY: + rm = &mem_rman; + break; + default: return (0); } @@ -249,12 +260,24 @@ return (rv); } - static int nexus_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + /* + * If this is a memory resource, track the virtual direct mapping. + * XXX is this correct? + */ + if (type == SYS_RES_MEMORY) { + void *vaddr; + + vaddr = (void *)MIPS_PHYS_TO_KSEG1((intptr_t)rman_get_start(r)); + rman_set_virtual(r, vaddr); + rman_set_bustag(r, MIPS_BUS_SPACE_MEM); + rman_set_bushandle(r, (bus_space_handle_t)vaddr); + } + return (rman_activate_resource(r)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705071905.l47J5Qse097500>