Date: Wed, 18 Oct 2000 15:07:04 +0400 (MSD) From: nms@otdel-1.org To: FreeBSD-gnats-submit@freebsd.org Subject: kern/22078: Option ROM(s) must be excluded from ISA IO memory space allocation Message-ID: <20001018110704.23694F3@Draculina.otdel-1.org>
next in thread | raw e-mail | index | archive | help
>Number: 22078
>Category: kern
>Synopsis: Option ROM(s) must be excluded from ISA IO memory space allocation
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 18 04:10:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Nikolai Saoukh
>Release: FreeBSD 4.1.1-STABLE i386
>Organization:
>Environment:
Any device on ISA bus with io memory window request with current
resource manager.
>Description:
Option ROM(s) are not excluded from ISA io memory, thus
any request for io memory window can land upon video/...
BIOS. See also kern/17715.
>How-To-Repeat:
>Fix:
Attached patch introduce new device wich take care of any option ROM(s)
present on ISA address space.
--- src/sys/isa/isa_common.c.orig Tue Oct 10 13:49:04 2000
+++ src/sys/isa/isa_common.c Thu Oct 12 18:24:16 2000
@@ -1047,3 +1047,95 @@
DRIVER_MODULE(isa, nexus, isa_driver, isa_devclass, 0, 0);
#endif
+/*
+ * Pseudo driver to take care of holes in ISA iomem occupied
+ * by option rom(s)
+ */
+
+#define ORM_ID 0x00004d3e
+
+static struct isa_pnp_id orm_ids[] = {
+ { ORM_ID, NULL }, /* ORM0000 */
+ { 0, NULL },
+};
+
+static int
+orm_probe(device_t dev) {
+ return ISA_PNP_PROBE(device_get_parent(dev), dev, orm_ids);
+}
+
+static int
+orm_attach(device_t dev) {
+ return 0;
+}
+
+#define IOMEM_START 0x0a0000
+#define IOMEM_STEP 0x000800
+#define IOMEM_END 0x100000
+
+static void
+orm_identify(driver_t* driver, device_t parent) {
+ device_t child;
+ u_int32_t chunk;
+ int rnum = 0;
+
+ child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "orm", -1);
+ device_set_driver(child, driver);
+ device_set_desc(child, "Option ROM(s)");
+ isa_set_logicalid(child, ORM_ID);
+ isa_set_vendorid(child, ORM_ID);
+ for (chunk = IOMEM_START; chunk < IOMEM_END; chunk += IOMEM_STEP) {
+ struct resource* res;
+ int rid;
+ bus_space_tag_t bt;
+ bus_space_handle_t bh;
+ u_int32_t rom_size;
+ u_int8_t buf[3];
+
+ bus_set_resource(child, SYS_RES_MEMORY, rnum, chunk, IOMEM_STEP);
+ rid = rnum;
+ res = bus_alloc_resource(child, SYS_RES_MEMORY, &rid, 0ul, ~0ul, IOMEM_STEP, RF_ACTIVE);
+ if (res == NULL) {
+ bus_delete_resource(child, SYS_RES_MEMORY, rnum);
+ continue;
+ }
+ bt = rman_get_bustag(res);
+ bh = rman_get_bushandle(res);
+ bus_space_read_region_1(bt, bh, 0, buf, sizeof(buf));
+ bus_release_resource(child, SYS_RES_MEMORY, rid, res);
+ bus_delete_resource(child, SYS_RES_MEMORY, rnum);
+ if (buf[0] != 0x55 || buf[1] != 0xAA || (buf[2] & 0x03) != 0) {
+ continue;
+ }
+ rom_size = buf[2] << 9;
+ bus_set_resource(child, SYS_RES_MEMORY, rnum, chunk, rom_size);
+ rid = rnum;
+ res = bus_alloc_resource(child, SYS_RES_MEMORY, &rid, 0ul, ~0ul, rom_size, 0);
+ if (res == NULL) {
+ bus_delete_resource(child, SYS_RES_MEMORY, rnum);
+ continue;
+ }
+ chunk += rom_size - IOMEM_STEP;
+ rnum++;
+ }
+ if(rnum == 0)
+ device_delete_child(parent, child);
+}
+
+static device_method_t orm_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_identify, orm_identify),
+ DEVMETHOD(device_probe, orm_probe),
+ DEVMETHOD(device_attach, orm_attach),
+ { 0, 0 }
+};
+
+static driver_t orm_driver = {
+ "orm",
+ orm_methods,
+ 0
+};
+
+static devclass_t orm_devclass;
+
+DRIVER_MODULE(orm, isa, orm_driver, orm_devclass, 0, 0);
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001018110704.23694F3>
