Ziatech 5503 watchdog driver

Warner Losh imp at bsdimp.com
Fri Mar 18 14:57:29 PST 2005


> 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


More information about the freebsd-hackers mailing list