From owner-p4-projects@FreeBSD.ORG Mon May 7 19:05:27 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B8DA816A406; Mon, 7 May 2007 19:05:26 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 96E9A16A403 for ; Mon, 7 May 2007 19:05:26 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 87B8013C46C for ; Mon, 7 May 2007 19:05:26 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l47J5QUT097503 for ; Mon, 7 May 2007 19:05:26 GMT (envelope-from bms@incunabulum.net) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l47J5Qse097500 for perforce@freebsd.org; Mon, 7 May 2007 19:05:26 GMT (envelope-from bms@incunabulum.net) Date: Mon, 7 May 2007 19:05:26 GMT Message-Id: <200705071905.l47J5Qse097500@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bms@incunabulum.net using -f From: Bruce M Simpson To: Perforce Change Reviews Cc: Subject: PERFORCE change 119439 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2007 19:05:27 -0000 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 -__FBSDID("$FreeBSD: src/sys/arm/arm/nexus.c,v 1.7 2006/04/20 04:12:02 imp Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -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)); }