From owner-freebsd-hackers Thu Jan 20 14:18:46 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from igw1.ericsson.com.au (igw1.ericsson.com.au [203.61.155.3]) by hub.freebsd.org (Postfix) with ESMTP id 0970E14D8B for ; Thu, 20 Jan 2000 14:18:43 -0800 (PST) (envelope-from Tony.Frank@ericsson.com.au) Received: from brsi02.epa.ericsson.se ([146.11.15.8]) by igw1.ericsson.com.au (8.9.1b+Sun/8.9.1) with ESMTP id JAA03664 for ; Fri, 21 Jan 2000 09:18:32 +1100 (EST) Received: from eaubrnt019.epa.ericsson.se (eaubrnt019 [146.11.9.165]) by brsi02.epa.ericsson.se (8.9.1/8.9.1) with ESMTP id JAA16894 for ; Fri, 21 Jan 2000 09:19:16 +1100 (EST) Received: by eaubrnt019.epa.ericsson.se with Internet Mail Service (5.5.2448.0) id ; Fri, 21 Jan 2000 09:18:30 +1100 Message-ID: <4B6BC00CD15FD2119E5F0008C7A419A5069CB744@eaubrnt018.epa.ericsson.se> From: "Tony Frank (EPA)" To: "'freebsd-hackers@freebsd.org'" Subject: How do I allocate 2 blocks of memory? Date: Fri, 21 Jan 2000 09:18:24 +1100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, In my spare time I have been working on a driver for IBM Shared RAM style token-ring adapters. So far I am progressing well enough (using Larry Lile's earlier version and also the NetBSD driver for reference) however I am running into one particular problem. The card itself has a block of memory mapped IO ports, size 0x2000, and another block of SRAM, size 0x4000. At the moment, I can successfully allocate the MMIO area using something similar to the following: struct resource *res; rid = 0; res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0ul, ~0ul, TR_MMIO_SIZE, RF_ACTIVE); if (res) { sc->mem_rid = rid; sc->mem_res = res; sc->mem_used = size; return (0); } else { return (ENOENT); } my config line is: device tr0 at isa? irq 9 iomem 0xd0000 My card has been configured to use 0xd0000 for the 0x2000 MMIO, and 0xd4000 for the 0x4000 SRAM... This then lets me access 0xd0000 - 0xd1fff. However if I try to use the above code with rid = 1, I get no resource back. I think I could configure the card to use the range 0xd0000 - 0xd3fff for the SRAM and then 0xd4000 - 0xd5fff for the MMIO, thus having a continuous block between 0xd0000 and 0xd5fff that I might be able to allocate in one hit. This however seems to be a bit of a workaround. Essentially I have been using the source from other drivers to try and understand how the system works, but I am yet to find one that allocates two sets of memory. One other issue that I am wondering about is overriding settings provided in the config file. If I specify an IRQ of 11, when the card is programmed to use 9, the bus_alloc_resource will give back an IRQ value of 11, which causes problems later as the card is using 9. I can read the IRQ value that the card is set to, but I'm not sure on the correct procedure to request that specific IRQ for my driver? Any suggestions would be most welcome. Regards, Tony Frank To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message