diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2003-08-15 23:01:02 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2003-08-15 23:01:02 +0000 |
commit | a532b274cecd7b60bcb65ab26e1b31bd3b0d1b04 (patch) | |
tree | 78876456e86db69e1dc2dc2d7ac28e6778ef4ce0 /sys/dev/ic | |
parent | 57134a8bf6cb70f659cd9d8e29045ef33f5a55fb (diff) |
- remove ahc dependency, convert smc93cx6 into an attribute.
- support for 8 and 32 bit registers.
from NetBSD.
deraadt@ and krw@ testing and ok.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/smc93cx6var.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/sys/dev/ic/smc93cx6var.h b/sys/dev/ic/smc93cx6var.h index d82e54a9eeb..13c7652938d 100644 --- a/sys/dev/ic/smc93cx6var.h +++ b/sys/dev/ic/smc93cx6var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smc93cx6var.h,v 1.14 2003/08/12 10:27:10 fgsch Exp $ */ +/* $OpenBSD: smc93cx6var.h,v 1.15 2003/08/15 23:01:01 fgsch Exp $ */ /* $FreeBSD: sys/dev/aic7xxx/93cx6.h,v 1.3 1999/12/29 04:35:33 peter Exp $ */ /* * Interface to the 93C46 serial EEPROM that is used to store BIOS @@ -52,7 +52,9 @@ typedef enum { } seeprom_chip_t; struct seeprom_descriptor { - struct ahc_softc *sd_ahc; + bus_space_tag_t sd_tag; + bus_space_handle_t sd_bsh; + bus_size_t sd_regsize; bus_size_t sd_control_offset; bus_size_t sd_status_offset; bus_size_t sd_dataout_offset; @@ -82,17 +84,35 @@ struct seeprom_descriptor { */ #define SEEPROM_INB(sd) \ - ahc_inb(sd->sd_ahc, sd->sd_control_offset) + (((sd)->sd_regsize == 4) \ + ? bus_space_read_4((sd)->sd_tag, (sd)->sd_bsh, \ + (sd)->sd_control_offset) \ + : bus_space_read_1((sd)->sd_tag, (sd)->sd_bsh, \ + (sd)->sd_control_offset)) + #define SEEPROM_OUTB(sd, value) \ -do { \ - ahc_outb(sd->sd_ahc, sd->sd_control_offset, value); \ - ahc_flush_device_writes(sd->sd_ahc); \ +do { \ + if ((sd)->sd_regsize == 4) \ + bus_space_write_4((sd)->sd_tag, (sd)->sd_bsh, \ + (sd)->sd_control_offset, (value)); \ + else \ + bus_space_write_1((sd)->sd_tag, (sd)->sd_bsh, \ + (sd)->sd_control_offset, (u_int8_t) (value)); \ } while(0) #define SEEPROM_STATUS_INB(sd) \ - ahc_inb(sd->sd_ahc, sd->sd_status_offset) + (((sd)->sd_regsize == 4) \ + ? bus_space_read_4((sd)->sd_tag, (sd)->sd_bsh, \ + (sd)->sd_status_offset) \ + : bus_space_read_1((sd)->sd_tag, (sd)->sd_bsh, \ + (sd)->sd_status_offset)) + #define SEEPROM_DATA_INB(sd) \ - ahc_inb(sd->sd_ahc, sd->sd_dataout_offset) + (((sd)->sd_regsize == 4) \ + ? bus_space_read_4((sd)->sd_tag, (sd)->sd_bsh, \ + (sd)->sd_dataout_offset) \ + : bus_space_read_1((sd)->sd_tag, (sd)->sd_bsh, \ + (sd)->sd_dataout_offset)) int read_seeprom(struct seeprom_descriptor *, u_int16_t *, bus_size_t, bus_size_t); |