Date: Fri, 21 Jan 2000 09:18:24 +1100 From: "Tony Frank (EPA)" <Tony.Frank@ericsson.com.au> To: "'freebsd-hackers@freebsd.org'" <freebsd-hackers@freebsd.org> Subject: How do I allocate 2 blocks of memory? Message-ID: <4B6BC00CD15FD2119E5F0008C7A419A5069CB744@eaubrnt018.epa.ericsson.se>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B6BC00CD15FD2119E5F0008C7A419A5069CB744>