diff options
author | peter <peter@FreeBSD.org> | 2000-01-05 16:31:27 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-01-05 16:31:27 +0000 |
commit | 159a4659df9c257aebb474b1fb62d045fbac18c7 (patch) | |
tree | 2a4a86de87e019f74b69ced850fd4fe1772de36c /sys/isa/fdc.h | |
parent | 3a2a6cb025fbd82b8afee5ad1326a8e00ad4bb41 (diff) | |
download | FreeBSD-src-159a4659df9c257aebb474b1fb62d045fbac18c7.zip FreeBSD-src-159a4659df9c257aebb474b1fb62d045fbac18c7.tar.gz |
Patch up some of the evilness left over from the early newbus porting.
In particular:
- Don't leave resources allocated in the probe routine. Allocate them
during probe and release them. Probe's job is to identify devices only.
- Don't abuse the ivars pointer.. (!). Create real ivars and use the
proper access system. (the bus_read_ivar method)
- Don't add the children until attach() has successfully grabbed the
hardware, otherwise there are potential leaks if attach fails.
Diffstat (limited to 'sys/isa/fdc.h')
-rw-r--r-- | sys/isa/fdc.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/isa/fdc.h b/sys/isa/fdc.h index 73d9bc8..caa0a07 100644 --- a/sys/isa/fdc.h +++ b/sys/isa/fdc.h @@ -79,6 +79,7 @@ struct fdc_data bus_space_handle_t ctlh; void *fdc_intr; struct device *fdc_dev; + int fdc_ispnp; }; /***********************************************************************\ @@ -98,3 +99,22 @@ typedef enum fdc_type fdc_t; #define FDUNIT(s) (((s)>>6)&03) #define FDTYPE(s) ((s)&077) + +/* + * fdc maintains a set (1!) of ivars per child of each controller. + */ +enum fdc_device_ivars { + FDC_IVAR_FDUNIT, +}; + +/* + * Simple access macros for the ivars. + */ +#define FDC_ACCESSOR(A, B, T) \ +static __inline T fdc_get_ ## A(device_t dev) \ +{ \ + uintptr_t v; \ + BUS_READ_IVAR(device_get_parent(dev), dev, FDC_IVAR_ ## B, &v); \ + return (T) v; \ +} +FDC_ACCESSOR(fdunit, FDUNIT, int) |