From owner-freebsd-hackers Fri Jan 26 18: 3:20 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.matriplex.com (ns1.matriplex.com [208.131.42.8]) by hub.freebsd.org (Postfix) with ESMTP id 3BD7737B400 for ; Fri, 26 Jan 2001 18:03:01 -0800 (PST) Received: from mail.matriplex.com (mail.matriplex.com [208.131.42.9]) by mail.matriplex.com (8.9.2/8.9.2) with ESMTP id SAA31833 for ; Fri, 26 Jan 2001 18:02:50 -0800 (PST) (envelope-from rh@matriplex.com) Date: Fri, 26 Jan 2001 18:02:50 -0800 (PST) From: Richard Hodges To: freebsd-hackers@FreeBSD.ORG Subject: NEWBUS: multiple calls needed? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, all! I am writing a device driver for a device that has three separate memory areas (plus a 256-byte IO block). At first glance, it would seem that the correct thing would be something like: for(x = 0; x < 3; x++) { device->mem[x] = bus_alloc_resource(dev, SYS_RES_MEMORY, &device->rid_mem[x], 0, ~0, 1, RF_ACTIVE); if(device->mem[x] == NULL) FAIL; device->bustag[x] = rman_get_bustag(device->mem[x]); device->bushandle[x] = rman_get_bushandle(device->mem[x]); device->virt_addr[x] = rman_get_virtual(device->mem[x]); } The memory areas "appear" to be fixed relative to each other: mem1 == base + 0x000000 (size==0x200000) mem2 == base + 0x201000 (size==0x000100) mem3 == base + 0x203000 (size==0x000400) So of course, it is tempting to wonder whether it is really neccessary to allocate three newbus entities for them. On the other hand, I have to believe that the BIOS has already set the base and sizes of these areas, and it would be a really bad idea to pretend that they are a single (say 3-meg) resource. I think I will just go ahead with allocating three separate resources for them, but I would be very interested in other opinions. Thanks, -Richard ------------------------------------------- Richard Hodges | Matriplex, inc. | 769 Basque Way rh@matriplex.com | Carson City, NV 89706 775-886-6477 | www.matriplex.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message