From owner-freebsd-current@FreeBSD.ORG Sun Apr 6 09:39:19 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3872C37B401 for ; Sun, 6 Apr 2003 09:39:19 -0700 (PDT) Received: from hak.cnd.mcgill.ca (hak.cnd.mcgill.ca [132.216.11.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7BAC643FCB for ; Sun, 6 Apr 2003 09:39:18 -0700 (PDT) (envelope-from mat@hak.cnd.mcgill.ca) Received: from hak.cnd.mcgill.ca (localhost.cnd.mcgill.ca [127.0.0.1]) by hak.cnd.mcgill.ca (8.12.3p2/8.12.3) with ESMTP id h36GfYqC041534 for ; Sun, 6 Apr 2003 12:41:34 -0400 (EDT) (envelope-from mat@hak.cnd.mcgill.ca) Received: (from mat@localhost) by hak.cnd.mcgill.ca (8.12.3p2/8.12.3/Submit) id h36GfY3H041533 for freebsd-current@freebsd.org; Sun, 6 Apr 2003 12:41:34 -0400 (EDT) Date: Sun, 6 Apr 2003 12:41:34 -0400 From: Mathew Kanner To: freebsd-current@freebsd.org Message-ID: <20030406164134.GN17533@cnd.mcgill.ca> References: <20030404182557.GK17533@cnd.mcgill.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030404182557.GK17533@cnd.mcgill.ca> Organization: I speak for myself, operating in Montreal, CANADA User-Agent: Mutt/1.5.3i Subject: Re: midi problem, an isa device on a pci card X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Apr 2003 16:39:19 -0000 Hello, I've recived no responses. Anyway, the following includes my own solution to the question, lots of trial and error. I've found that isahints was the closest exsting code to what I wanted. As always, I would love to hear any comments. > How do I create isa devices from a pci device. Do I search up the > soundcard tree for the pci bus then search down for the isa bus, then > create_child(..."mpushim")? In pci device_attach: isa=devclass_find("isa"); if( !isa ) { device_printf(sc->dev,"cmi midi error no devclass for isa\n"); goto err; } if (devclass_get_devices(isa, &isalistp, &isacountp) != 0 ) { device_printf(sc->dev,"cmi midi error fetching isa devices\n"); goto err; } if ( isacountp < 1 ) { device_printf(sc->dev,"cmi midi no isa busses found\n"); goto err; } /* * Be stupid and just pick the first isa bus */ sc->isadev = isalistp[0]; mpuisa=devclass_find("mpuisa"); if( !mpuisa ) { device_printf(sc->dev,"cmi: midi driver not found\n"); goto err; } i = devclass_find_free_unit(mpuisa,0); sc->mpudev = BUS_ADD_CHILD(sc->isadev, 1, "mpuisa", i); [Needs to be done with BUS_ADD_CHILD, I tried with others, m' yo they just don't work] > How do I tell the shim before the probe/attach what io region to look > at, do I fiddle with ivars (or some internal structure), do I mess with hints > via kenv(9) [Is there a kenv(9)? ] [ Say, p->port=0x300, then following would set it to 0x300-0x302 and the same IRQ as the pci device ] bus_set_resource(sc->mpudev, SYS_RES_IOPORT, 0, p->port, 2); bus_set_resource(sc->mpudev, SYS_RES_IRQ, 0, rman_get_start(sc->irq), 1); if( device_probe_and_attach(sc->mpudev) == 0 ) { device_printf(sc->dev,"added %s/%s\n", device_get_nameunit(sc->isadev), device_get_nameunit(sc->mpudev) ); return ; } Cheers, --Mat -- Brain: Are you pondering what I'm pondering? Pinky: I think so Brain, but the Rockettes, it's mostly girls, isn't it?