Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Aug 2000 00:23:46 -0600
From:      Warner Losh <imp@village.org>
To:        MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>
Cc:        mobile@FreeBSD.ORG
Subject:   Re: [PCCARD,PATCH] IOC_GET_RESOURCE_RANGE patch 
Message-ID:  <200008200623.AAA30742@harmony.village.org>
In-Reply-To: Your message of "Sun, 20 Aug 2000 13:45:50 %2B0900." <200008200445.e7K4jp402239@lavender.sanpei.org> 
References:  <200008200445.e7K4jp402239@lavender.sanpei.org>  

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008200623.AAA30742>