Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Jun 2001 16:09:35 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        j mckitrick <jcm@FreeBSD-uk.eu.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: newbussifying drivers 
Message-ID:  <200106052309.f55N9Zj02982@mass.dis.org>
In-Reply-To: Your message of "Tue, 05 Jun 2001 23:00:32 BST." <20010605230032.B96188@dogma.freebsd-uk.eu.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> | Typically, probe routines these days are invoked with a single set of I/O 
> | parameters to probe (and even this is only ISA devices).
> | 
> | It's pretty rare to need to bit-bang to find a device these days anyway; 
> | you should probably be looking for PnP data or similar.  This is what 
> | hints are (basically) - manually-supplied PnP data.
> 
> How would you recommending fixing this, taken from the ex driver?

Ok, this is basically a manual PnP scan for a card that has pre-PnP 
metaconfig.  The only way to do this "right" is going to be to call 
bus_alloc_resource() to pick up the PnP port, something like:

> for (ioport = 0x200; ioport < 0x3a0; ioport += 0x10) {

		rid = 0;
		if ((res = bus_alloc_resource(parent, SYS_RES_IOPORT, &rid,
		    ioport, ioport + 0x10, 0x10, RF_ACTIVE)) == NULL)
			continue;

>             /* No board found at address */
>             if (!look_for_card(ioport)) {
>                     continue;
>             }

		if (!look_for_card(res))
			goto complete;

>             if (bootverbose)
>                     printf("ex: Found card at 0x%03x!\n", ioport);
>             /* Board in PnP mode */
>             if (eeprom_read(ioport, EE_W0) & EE_W0_PNP) {

		/* PnP probe will find this card */
		if (eeprom_read(res, EE_WO) & EE_WO_PNP)
			goto complete;

...

	complete:
		bus_release_resource(parent, SYS_RES_IOPORT, rid, res);
	}
>  
> 
> I'm taking this on as my personal project, so the more info i get, the
> better work i can do.  :-)

You'll want to replace all the inb/outb stuff with macros that wrap the 
bus_space_read/write functions.  You can use the same macros in the 
identify routine, you'll just be allocating the resources differently.

I hope this helps.

Regards,
Mike

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E



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?200106052309.f55N9Zj02982>