Re: kldloaded driver not called at load time

2000-02-02 Thread Mike Smith

 
  I never liked the unknown driver.  I vote we kill it and let
  isa_probe_nomatch() deal with things.  (I'll have to write
  isa_probe_nomatch() but I don't see that as a problem.)
 
 I'll dig out my patches for that area and send you a copy.
 
 We do need something when we use PNPBIOS because the motherboard devices are
 not programmable and their port space is "fixed".  Their space needs to
 either be allocated to something or otherwise avoided when we are choosing
 ports for real programmable devices.

I was looking at this the other day, trying to work out how to 
differentiate easily between things that we _know_ are in a single, 
immovable place (eg. most of the stuff that we see from the PnP BIOS), 
things that "might" be there, and things that are there and can be 
shuffled around.

Basically we need a way of sorting the ISA bus children in a more 
sophisticated fashion that the isa_probe_children code currently does.

-- 
\\ Give a man a fish, and you feed him for a day. \\  Mike Smith
\\ Tell him he should learn how to fish himself,  \\  [EMAIL PROTECTED]
\\ and he'll hate you for a lifetime. \\  [EMAIL PROTECTED]




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



kldloaded driver not called at load time

2000-01-31 Thread Nikolai Saoukh

I am trying to make kldloadable driver. But
none of functions are called when I kldload it.
Is this a bug or I am missing something essential?

Sources, dmesg, config and makefile (for module) are at

http://ethereal.ru/~nms/TR/tk.tar (~40Kb)

P.S. I am chasing for IBM Token Ring Adapter (unknown0:).

Thanks


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Matthew N. Dodd

On Mon, 31 Jan 2000, Nikolai Saoukh wrote:
 I am trying to make kldloadable driver. But none of functions are
 called when I kldload it. Is this a bug or I am missing something
 essential?

You're missing something essential.

The return values for the DEVICE_PROBE method should be 0 or negative for
priority, or positive to indicate an error.

if_tok.c:tok_probe() returns ENXIO which is in the return value you use
for if_tok_isa.c:tok_isa_probe().

You should take a good look at /sys/dev/{ex,ep} for an example of how to
accommodate PnP probes.

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| [EMAIL PROTECTED] |   2 x '84 Volvo 245DL| ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Matthew N. Dodd

On Mon, 31 Jan 2000, Nikolai Saoukh wrote:
 THE PROBLEM is that tok_isa_probe is not called at all,
 when driver kldloaded. Return value is irrelevant for this case.

Yea, I see what could be the problem.  I'll get back to you.

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| [EMAIL PROTECTED] |   2 x '84 Volvo 245DL| ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Matthew N. Dodd

On Mon, 31 Jan 2000, Nikolai Saoukh wrote:
 THE PROBLEM is that tok_isa_probe is not called at all,
 when driver kldloaded. Return value is irrelevant for this case.

Try the attached patch.

(cd /sys/isa  patch  isa_common.c.patch)

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| [EMAIL PROTECTED] |   2 x '84 Volvo 245DL| ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |


Index: isa_common.c
===
RCS file: /cvs/src/sys/isa/isa_common.c,v
retrieving revision 1.15
diff -u -r1.15 isa_common.c
--- isa_common.c2000/01/18 02:15:05 1.15
+++ isa_common.c2000/01/31 20:42:03
@@ -783,8 +783,7 @@
 static void
 isa_driver_added(device_t dev, driver_t *driver)
 {
-   device_t *children;
-   int nchildren, i;
+   device_t child;
 
/*
 * Don't do anything if drivers are dynamically
@@ -796,11 +795,10 @@
return;
 
DEVICE_IDENTIFY(driver, dev);
-   if (device_get_children(dev, children, nchildren))
-   return;
 
-   for (i = 0; i  nchildren; i++) {
-   device_t child = children[i];
+   for (child = TAILQ_FIRST(dev-children);
+child;
+child = TAILQ_NEXT(child, link)) {
struct isa_device *idev = DEVTOISA(child);
struct resource_list *rl = idev-id_resources;
struct resource_list_entry *rle;
@@ -831,8 +829,6 @@
}
}
}
-
-   free(children, M_TEMP);
 }
 
 static int



Re: kldloaded driver not called at load time

2000-01-31 Thread Mike Smith

   I am trying to make kldloadable driver. But none of functions are
   called when I kldload it. Is this a bug or I am missing something
   essential?
  
  You're missing something essential.
  
  The return values for the DEVICE_PROBE method should be 0 or negative for
  priority, or positive to indicate an error.
 
 THE PROBLEM is that tok_isa_probe is not called at all,
 when driver kldloaded. Return value is irrelevant for this case.

This is because the unknown driver is never revoked once it owns your 
device.  It's a(nother) bug in the ISA bus code. 8(

-- 
\\ Give a man a fish, and you feed him for a day. \\  Mike Smith
\\ Tell him he should learn how to fish himself,  \\  [EMAIL PROTECTED]
\\ and he'll hate you for a lifetime. \\  [EMAIL PROTECTED]




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Matthew N. Dodd

On Mon, 31 Jan 2000, Mike Smith wrote:
 This is because the unknown driver is never revoked once it owns your
 device.  It's a(nother) bug in the ISA bus code. 8(

Looking at the code in sys/kern/subr_bus.c I'm not sure how any drivers
are revoked by a higher priority match.

This is probably desirable given the nature of most drivers and one of the
reasons for letting BUS_PROBE_NOMATCH announce your 'unknown' hardware.

If a driver is attached and providing interfaces to the system (network,
scsi, what have you.) then loading a higher priority driver shouldn't
cause that device to detach as it would potentially cause the system to
become confused.

I never liked the unknown driver.  I vote we kill it and let
isa_probe_nomatch() deal with things.  (I'll have to write
isa_probe_nomatch() but I don't see that as a problem.)

Nikolai, your easy fix is to comment out the relevent module declaration
for the 'unknown' driver in isa_common.c.

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| [EMAIL PROTECTED] |   2 x '84 Volvo 245DL| ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Doug Rabson

On Mon, 31 Jan 2000, Matthew N. Dodd wrote:

 On Mon, 31 Jan 2000, Mike Smith wrote:
  This is because the unknown driver is never revoked once it owns your
  device.  It's a(nother) bug in the ISA bus code. 8(
 
 Looking at the code in sys/kern/subr_bus.c I'm not sure how any drivers
 are revoked by a higher priority match.
 
 This is probably desirable given the nature of most drivers and one of the
 reasons for letting BUS_PROBE_NOMATCH announce your 'unknown' hardware.
 
 If a driver is attached and providing interfaces to the system (network,
 scsi, what have you.) then loading a higher priority driver shouldn't
 cause that device to detach as it would potentially cause the system to
 become confused.
 
 I never liked the unknown driver.  I vote we kill it and let
 isa_probe_nomatch() deal with things.  (I'll have to write
 isa_probe_nomatch() but I don't see that as a problem.)
 
 Nikolai, your easy fix is to comment out the relevent module declaration
 for the 'unknown' driver in isa_common.c.

This is probably the right workaround for now.

The unknown driver does serve a purpose. It indirectly allows resources
associated with the device to be allocated so that other PnP devices are
not allocated on top.

On reviewing the code, this seems to happen (in isa_probe_children)
whether or not the preceding call to device_probe_and_attach() succeeded
so removing the unknown driver would mean that resources are allocated for
the un-attached device which is likely to cause trouble.

--
Doug Rabson Mail:  [EMAIL PROTECTED]
Nonlinear Systems Ltd.  Phone: +44 181 442 9037




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Nikolai Saoukh

 Nikolai, your easy fix is to comment out the relevent module declaration
 for the 'unknown' driver in isa_common.c.

Yes, this fix does the job, BUT

Comments for 'unknown' driver says '... for unknown pnp cards ...'.
Will my driver be called on computer _without_ any pnp card?


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Doug Rabson

On Mon, 31 Jan 2000, Matthew N. Dodd wrote:

 On Mon, 31 Jan 2000, Nikolai Saoukh wrote:
  THE PROBLEM is that tok_isa_probe is not called at all,
  when driver kldloaded. Return value is irrelevant for this case.
 
 Try the attached patch.
 
 (cd /sys/isa  patch  isa_common.c.patch)

This patch doesn't (shouldn't) compile since it uses private information
from bus_private.h. I hope you are not including bus_private.h anywhere in
your code - its strictly off limits to driver code, even bus drivers.

--
Doug Rabson Mail:  [EMAIL PROTECTED]
Nonlinear Systems Ltd.  Phone: +44 181 442 9037




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Matthew N. Dodd

On Tue, 1 Feb 2000, Nikolai Saoukh wrote:
 Comments for 'unknown' driver says '... for unknown pnp cards ...'.
 Will my driver be called on computer _without_ any pnp card?

Does your driver have an identify method for non-PnP cards?

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| [EMAIL PROTECTED] |   2 x '84 Volvo 245DL| ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Matthew N. Dodd

On Mon, 31 Jan 2000, Doug Rabson wrote:
 This patch doesn't (shouldn't) compile since it uses private
 information from bus_private.h. I hope you are not including
 bus_private.h anywhere in your code - its strictly off limits to
 driver code, even bus drivers.

Yea, I figured that out.  My patch didn't change the function of the code
anyway.  Not sure what I was thinking.

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| [EMAIL PROTECTED] |   2 x '84 Volvo 245DL| ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Nikolai Saoukh

 On Tue, 1 Feb 2000, Nikolai Saoukh wrote:
  Comments for 'unknown' driver says '... for unknown pnp cards ...'.
  Will my driver be called on computer _without_ any pnp card?
 
 Does your driver have an identify method for non-PnP cards?

This particular card can be "downgraded" to previous model
(Auto 16/4) in strict legacy mode (no pnp at all). Or with some pnp.
Well, my question was not about my case, rather general one.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Peter Wemm

"Matthew N. Dodd" wrote:
 On Mon, 31 Jan 2000, Mike Smith wrote:
  This is because the unknown driver is never revoked once it owns your
  device.  It's a(nother) bug in the ISA bus code. 8(
 
 Looking at the code in sys/kern/subr_bus.c I'm not sure how any drivers
 are revoked by a higher priority match.
 
 This is probably desirable given the nature of most drivers and one of the
 reasons for letting BUS_PROBE_NOMATCH announce your 'unknown' hardware.


 I never liked the unknown driver.  I vote we kill it and let
 isa_probe_nomatch() deal with things.  (I'll have to write
 isa_probe_nomatch() but I don't see that as a problem.)

I'll dig out my patches for that area and send you a copy.

We do need something when we use PNPBIOS because the motherboard devices are
not programmable and their port space is "fixed".  Their space needs to
either be allocated to something or otherwise avoided when we are choosing
ports for real programmable devices.

Cheers,
-Peter




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: kldloaded driver not called at load time

2000-01-31 Thread Matthew N. Dodd

On Tue, 1 Feb 2000, Peter Wemm wrote:
 We do need something when we use PNPBIOS because the motherboard
 devices are not programmable and their port space is "fixed".  Their
 space needs to either be allocated to something or otherwise avoided
 when we are choosing ports for real programmable devices.

If we can make the relevent code use RF_ALLOCATED vs. RF_ACTIVE for
determining resource availability I think this will work fine.

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| [EMAIL PROTECTED] |   2 x '84 Volvo 245DL| ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message