From owner-freebsd-mobile Sat Aug 19 23:24:51 2000 Delivered-To: freebsd-mobile@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id AC18637B424 for ; Sat, 19 Aug 2000 23:24:47 -0700 (PDT) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.9.3/8.9.3) with ESMTP id AAA47731; Sun, 20 Aug 2000 00:24:45 -0600 (MDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id AAA30742; Sun, 20 Aug 2000 00:23:46 -0600 (MDT) Message-Id: <200008200623.AAA30742@harmony.village.org> To: MIHIRA Sanpei Yoshiro Subject: Re: [PCCARD,PATCH] IOC_GET_RESOURCE_RANGE patch Cc: mobile@FreeBSD.ORG In-reply-to: Your message of "Sun, 20 Aug 2000 13:45:50 +0900." <200008200445.e7K4jp402239@lavender.sanpei.org> References: <200008200445.e7K4jp402239@lavender.sanpei.org> Date: Sun, 20 Aug 2000 00:23:46 -0600 From: Warner Losh Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org In message <200008200445.e7K4jp402239@lavender.sanpei.org> MIHIRA Sanpei Yoshiro writes: : In 4-stable and 5-current, /usr/sbin/pccardd did not know used : resource(io) range in kernel. We need to write free resource range : to /etc/pccard.conf from /var/run/dmesg.boot information by hand. Not sure about using /var/run/dmesg.boot, since it won't return information about drivers that are loaded after boot. and plug and play resources are now silently allocated, so that's not a good solution. : I created experimental IOC_GET_RESOURCE_RANGE(but rename : PIOCSRESOURCE) ioctl code in sys/pccard which was suggested by : Warner-san. With below patch we could read free ioport/irq/memory : resources from userland programs. Yes. This looks like a good, low impact solution for the near term to provide for better error detection for the pccard users until NEWCARD is stable. We're likely stuck with OLDCARD for the 4.x branch, and the number of problems where people just slap cards into the system and expect them to work has risen. The easier we make pccard stuff, the more we need good error detection. Now we have "xe0: no ports" which isn't useful to most people. : + child = device_add_child(pccarddev, devi->name, 3); However, I don't think that you need to add a child to the node tree just to get this information. It seems that you could get this same information from it, since normally it doesn't consume any resources. It would certainly clean up the code somewhat not having to do all of this extra work and wouldn't conflict if there ever was a ed3 on the system. : + for (i = pr->min; i + pr->size <= pr->max; : + i++) { : + err = bus_set_resource(child, pr->type, 0, i, pr->size); : + if (!err) { : + r = bus_alloc_resource(child, pr->type, &rid, 0ul, ~0ul, pr->size, RF_ACTIVE); : + if (r) { : + pr->resource_addr = (u_long)rman_get_start(r); : + bus_release_resource(child, pr->type, rid, r); : + break; : + } : + } : + } We might want to also look at bringing in the alignment patches that were given in one of the mailing lists a while ago. This would make it possible to not have to do these loops here, but instead have them moved up a level. Lemme see if I can find them. I'm in the middle of doing some newcard stuff right now, but could help you with this if you were interested. I think the add/delete of the child is worse than the aligment issues (which could, I suppose, be worked around in userland, I didn't look at those patches yet) and should be corrected before it is committed. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message