Re: Ziatech 5503 watchdog driver

2005-03-23 Thread John Baldwin
On Saturday 19 March 2005 04:04 am, Devon H. O'Dell wrote:
 On Sat, Mar 19, 2005 at 09:43:41AM +0100, Devon H. O'Dell  wrote:
  On Sat, Mar 19, 2005 at 09:02:15AM +0100, Devon H. O'Dell  wrote:
   On Fri, Mar 18, 2005 at 03:55:53PM -0700, Warner Losh wrote:
 I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
 porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
 driver, I have no way to identify that the system has the driver,
 so I wanted to make it conditional on
  
   Rather, I have no way to identify that the system has the device :).
 
  AHA! But I have finally found something that will make my life a
  little easier, I think. I just noticed a read only register with a
  default value of 0x80 and tested it. It returns 0x80. Is this enough
  to test on / probe for?
 
  --Devon

 Sorry, hate replying to myself. Turns out the value here is variable.

 Assuming I cannot find anything to identify the system, can I simply
 attach the driver if it is enabled in the configuration file?

Yes.  See the identify routines for things like apm and pmtimer for examples.

-- 
John Baldwin [EMAIL PROTECTED]http://www.FreeBSD.org/~jhb/
Power Users Use the Power to Serve  =  http://www.FreeBSD.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Ziatech 5503 watchdog driver

2005-03-23 Thread Devon H. O'Dell
On Wed, Mar 23, 2005 at 02:24:54PM -0500, John Baldwin wrote:
 On Saturday 19 March 2005 04:04 am, Devon H. O'Dell wrote:
  On Sat, Mar 19, 2005 at 09:43:41AM +0100, Devon H. O'Dell  wrote:
 
  Sorry, hate replying to myself. Turns out the value here is variable.
 
  Assuming I cannot find anything to identify the system, can I simply
  attach the driver if it is enabled in the configuration file?
 
 Yes.  See the identify routines for things like apm and pmtimer for examples.

Thanks, looks like I will have to do it this way. :) I'm going
to have time for it this weekend, so it should be ready by
Monday.

--Devon

 -- 
 John Baldwin [EMAIL PROTECTED]http://www.FreeBSD.org/~jhb/
 Power Users Use the Power to Serve  =  http://www.FreeBSD.org
 ___
 freebsd-hackers@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 


pgpKk4l3fEtf6.pgp
Description: PGP signature


Re: Ziatech 5503 watchdog driver

2005-03-19 Thread Devon H. O'Dell
On Fri, Mar 18, 2005 at 03:55:53PM -0700, Warner Losh wrote:
  I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
  porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
  driver, I have no way to identify that the system has the driver, so
  I wanted to make it conditional on

Rather, I have no way to identify that the system has the device :).

  options ZT5503
 
 That's not a good enough reason to make it an option, it should really
 be a device.  Users that want it can add it to their kernel config.
 In fact, they'd have to add it either way, so why make it weird for
 them.
 
 Put this device on the ISA bus, give it an identify routine that
 always adds it (this isn't GENERIC safe, but since there's no way to
 know the device is there, you are stuck with that).

OK. I don't know a hell of a lot about how the ISA bus works, though
I suppose that I remember that things using the old SB 16 cards
(Wolfenstein, anyone?) would simply probe various I/O ports.

Unfortunately, in my case, there are really no board specific I/O
registers that will give me information I can detect (or so it seems
from the manufacturer's manuals), though I am going to write a
couple of tests today to read some of these registers and see if
there is any useful information contained within them which I
might use to probe.

Assuming no useful information exists, is it enough to let the
device attach regardless if the user has

device zt5503

in the configuration file? Maxime suggested that I use device hints
to gather the port and such. Where should I put these hints? NOTES?

If I understand correctly, to hook this up into the build, I will
still have a line in files which will look something like:

dev/ziatech/zt5503.coptional zt5503

Hm, Ziatech is now Performance Technologies. Should that perhaps be
dev/pt then instead?

  existing in the kernel configuration file. I have a couple of
  related questions:
  
  1) Where in the tree should my zt5503wd.c file be placed?
 
 usually these thigns go in dev/foo/foo.c.  However FreeBSD and
 DragonFly have differeing layouts.  FreeBSD has a modules subtree to
 build modules, while DF has it in the dev tree.  The dev tree is also
 partitioned so it would be in dev/misc/foo/foo.c.

Yeah, I figured I'd ask Matt or Joerg where it'd best go there :). I
Think the preferred location was dev/misc/foo as you suggest.

  2) Regarding watchdog.h; this device supports other times than those
  provided from between 250MS to 256S. Hope nobody minds this changing
  :).
 
 Nope. :-)

Ok then :)

  3) To make sure I understand how this works:
  o The device is compiled in / loaded
 
 You'll need to make it a real device if you want loading to work.  The
 alternative is to make it a pseudo-device, but that's more hassle than
 it is worth since you need to access resources.  An option definitely
 won't work.

Another good reason to not write it as such.

  o watchdogd is used to tell the system to start the timer
  o I get a bunch of flags in my eventhandler function's 2nd
  argument that I can then use to write to my device's
  registers with the proper information
 
 These don't look like questions...

They're not stated as such; I've only taken a brief look around the 
watchdog functionality and I just wanted to confirm that this is how
the stuff works so I don't end up goofing it up :).

 
 Warner

Thanks for the help!

--Devon


pgpEDn9ivlh3s.pgp
Description: PGP signature


Re: Ziatech 5503 watchdog driver

2005-03-19 Thread Devon H. O'Dell
On Sat, Mar 19, 2005 at 09:02:15AM +0100, Devon H. O'Dell  wrote:
 On Fri, Mar 18, 2005 at 03:55:53PM -0700, Warner Losh wrote:
   I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
   porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
   driver, I have no way to identify that the system has the driver, so
   I wanted to make it conditional on
 
 Rather, I have no way to identify that the system has the device :).

AHA! But I have finally found something that will make my life a
little easier, I think. I just noticed a read only register with a
default value of 0x80 and tested it. It returns 0x80. Is this enough
to test on / probe for?

--Devon


pgpXutcVaHxAF.pgp
Description: PGP signature


Re: Ziatech 5503 watchdog driver

2005-03-19 Thread Devon H. O'Dell
On Sat, Mar 19, 2005 at 09:43:41AM +0100, Devon H. O'Dell  wrote:
 On Sat, Mar 19, 2005 at 09:02:15AM +0100, Devon H. O'Dell  wrote:
  On Fri, Mar 18, 2005 at 03:55:53PM -0700, Warner Losh wrote:
I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
driver, I have no way to identify that the system has the driver, so
I wanted to make it conditional on
  
  Rather, I have no way to identify that the system has the device :).
 
 AHA! But I have finally found something that will make my life a
 little easier, I think. I just noticed a read only register with a
 default value of 0x80 and tested it. It returns 0x80. Is this enough
 to test on / probe for?
 
 --Devon

Sorry, hate replying to myself. Turns out the value here is variable.

Assuming I cannot find anything to identify the system, can I simply
attach the driver if it is enabled in the configuration file?

--Devon


pgpiI4n0WkP7o.pgp
Description: PGP signature


Re: Ziatech 5503 watchdog driver

2005-03-19 Thread Daniel O'Connor
On Sat, 19 Mar 2005 19:34, Devon H. O'Dell wrote:
 Assuming I cannot find anything to identify the system, can I simply
 attach the driver if it is enabled in the configuration file?

You use the identify routine to create an instance of the device at a certain 
location. There are quite a number of examples in the tree.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


pgpjQuG7Rpfhb.pgp
Description: PGP signature


Re: Ziatech 5503 watchdog driver

2005-03-19 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Devon H. O'Dell  [EMAIL PROTECTED] writes:
: On Fri, Mar 18, 2005 at 03:55:53PM -0700, Warner Losh wrote:
:   I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
:   porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
:   driver, I have no way to identify that the system has the driver, so
:   I wanted to make it conditional on
: 
: Rather, I have no way to identify that the system has the device :).
: 
:   options ZT5503
:  
:  That's not a good enough reason to make it an option, it should really
:  be a device.  Users that want it can add it to their kernel config.
:  In fact, they'd have to add it either way, so why make it weird for
:  them.
:  
:  Put this device on the ISA bus, give it an identify routine that
:  always adds it (this isn't GENERIC safe, but since there's no way to
:  know the device is there, you are stuck with that).
: 
: OK. I don't know a hell of a lot about how the ISA bus works, though
: I suppose that I remember that things using the old SB 16 cards
: (Wolfenstein, anyone?) would simply probe various I/O ports.

:-)  Yes.  Usually one does try to probe for things, but the devices
must be cooperative.

: Unfortunately, in my case, there are really no board specific I/O
: registers that will give me information I can detect (or so it seems
: from the manufacturer's manuals), though I am going to write a
: couple of tests today to read some of these registers and see if
: there is any useful information contained within them which I
: might use to probe.

Right.  That's too bad, but with somehardware that's what you get.

: Assuming no useful information exists, is it enough to let the
: device attach regardless if the user has
: 
: device zt5503
: 
: in the configuration file? Maxime suggested that I use device hints
: to gather the port and such. Where should I put these hints? NOTES?

/boot/device.hints and also NOTES.

: If I understand correctly, to hook this up into the build, I will
: still have a line in files which will look something like:
: 
: dev/ziatech/zt5503.c  optional zt5503

Yes.
 
: Hm, Ziatech is now Performance Technologies. Should that perhaps be
: dev/pt then instead?

We generally don't have directories for manufacturers.

: Thanks for the help!

No problem.

Warner
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Ziatech 5503 watchdog driver

2005-03-18 Thread Devon H. O'Dell
Hey,

I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
driver, I have no way to identify that the system has the driver, so
I wanted to make it conditional on

options ZT5503

existing in the kernel configuration file. I have a couple of
related questions:

1) Where in the tree should my zt5503wd.c file be placed?

2) Regarding watchdog.h; this device supports other times than those
provided from between 250MS to 256S. Hope nobody minds this changing
:).

3) To make sure I understand how this works:
o The device is compiled in / loaded
o watchdogd is used to tell the system to start the timer
o I get a bunch of flags in my eventhandler function's 2nd
argument that I can then use to write to my device's
registers with the proper information

The first and third questions are the most important, I think.

--Devon


pgpKSN1sdBwYt.pgp
Description: PGP signature


Re: Ziatech 5503 watchdog driver

2005-03-18 Thread Warner Losh
 I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
 porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
 driver, I have no way to identify that the system has the driver, so
 I wanted to make it conditional on
 
 options ZT5503

That's not a good enough reason to make it an option, it should really
be a device.  Users that want it can add it to their kernel config.
In fact, they'd have to add it either way, so why make it weird for
them.

Put this device on the ISA bus, give it an identify routine that
always adds it (this isn't GENERIC safe, but since there's no way to
know the device is there, you are stuck with that).

 existing in the kernel configuration file. I have a couple of
 related questions:
 
 1) Where in the tree should my zt5503wd.c file be placed?

usually these thigns go in dev/foo/foo.c.  However FreeBSD and
DragonFly have differeing layouts.  FreeBSD has a modules subtree to
build modules, while DF has it in the dev tree.  The dev tree is also
partitioned so it would be in dev/misc/foo/foo.c.

 2) Regarding watchdog.h; this device supports other times than those
 provided from between 250MS to 256S. Hope nobody minds this changing
 :).

Nope. :-)

 3) To make sure I understand how this works:
   o The device is compiled in / loaded

You'll need to make it a real device if you want loading to work.  The
alternative is to make it a pseudo-device, but that's more hassle than
it is worth since you need to access resources.  An option definitely
won't work.

   o watchdogd is used to tell the system to start the timer
   o I get a bunch of flags in my eventhandler function's 2nd
 argument that I can then use to write to my device's
 registers with the proper information

These don't look like questions...


Warner
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Ziatech 5503 watchdog driver

2005-03-18 Thread Daniel O'Connor
On Sat, 19 Mar 2005 09:25, Warner Losh wrote:
 That's not a good enough reason to make it an option, it should really
 be a device.  Users that want it can add it to their kernel config.
 In fact, they'd have to add it either way, so why make it weird for
 them.

 Put this device on the ISA bus, give it an identify routine that
 always adds it (this isn't GENERIC safe, but since there's no way to
 know the device is there, you are stuck with that).

A good example of this (which I shamelessly stole for work :) is in if_ep 
(although you only need the stuff from child = .. to bus_set_resource..).

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


pgp49WiAhGg3E.pgp
Description: PGP signature