summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2003-08-15 23:01:02 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2003-08-15 23:01:02 +0000
commita532b274cecd7b60bcb65ab26e1b31bd3b0d1b04 (patch)
tree78876456e86db69e1dc2dc2d7ac28e6778ef4ce0
parent57134a8bf6cb70f659cd9d8e29045ef33f5a55fb (diff)
- remove ahc dependency, convert smc93cx6 into an attribute.
- support for 8 and 32 bit registers. from NetBSD. deraadt@ and krw@ testing and ok.
-rw-r--r--sys/arch/i386/isa/ahc_isa.c5
-rw-r--r--sys/conf/files9
-rw-r--r--sys/dev/ic/smc93cx6var.h36
-rw-r--r--sys/dev/pci/ahc_pci.c6
4 files changed, 42 insertions, 14 deletions
diff --git a/sys/arch/i386/isa/ahc_isa.c b/sys/arch/i386/isa/ahc_isa.c
index a3f431c3140..c4fb4454299 100644
--- a/sys/arch/i386/isa/ahc_isa.c
+++ b/sys/arch/i386/isa/ahc_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahc_isa.c,v 1.10 2002/06/28 00:34:54 smurph Exp $ */
+/* $OpenBSD: ahc_isa.c,v 1.11 2003/08/15 23:01:00 fgsch Exp $ */
/* $NetBSD: ahc_isa.c,v 1.5 1996/10/21 22:27:39 thorpej Exp $ */
/*
@@ -516,6 +516,9 @@ aha2840_load_seeprom(struct ahc_softc *ahc)
u_int8_t scsi_conf;
int have_seeprom;
+ sd.sd_tag = ahc->tag;
+ sd.sd_bsh = ahc->bsh;
+ sd.sd_regsize = 1;
sd.sd_control_offset = SEECTL_2840;
sd.sd_status_offset = STATUS_2840;
sd.sd_dataout_offset = STATUS_2840;
diff --git a/sys/conf/files b/sys/conf/files
index 4079122fb2b..73fcb67bb1b 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.276 2003/08/12 11:05:47 hin Exp $
+# $OpenBSD: files,v 1.277 2003/08/15 23:01:01 fgsch Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -73,6 +73,10 @@ define wskbddev {[console = -1], [mux = -1]}
define wsmousedev {[mux = -1]}
define wsrasteremulops
+# SMC 93Cx6 Serial EEPROM devices
+define smc93cx6
+file dev/ic/smc93cx6.c smc93cx6
+
# common PC display functions
define pcdisplayops
file dev/ic/pcdisplay_subr.c pcdisplayops
@@ -103,10 +107,9 @@ file dev/ic/wdc.c wdc_base
# contain the cfdrivers. Attachments are provided by files.<bus>
# Adaptec 2[789]4X, 394X, aic7770 and aic78[5678]0 SCSI controllers
-device ahc: scsi
+device ahc: scsi, smc93cx6
file dev/ic/aic7xxx.c ahc
file dev/ic/aic7xxx_openbsd.c ahc
-file dev/ic/smc93cx6.c ahc
# Adaptec AIC-6[23]60 SCSI controllers
device aic: scsi
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);
diff --git a/sys/dev/pci/ahc_pci.c b/sys/dev/pci/ahc_pci.c
index 8f6094a494f..e76c23e0c2f 100644
--- a/sys/dev/pci/ahc_pci.c
+++ b/sys/dev/pci/ahc_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahc_pci.c,v 1.39 2003/08/12 10:27:10 fgsch Exp $ */
+/* $OpenBSD: ahc_pci.c,v 1.40 2003/08/15 23:01:01 fgsch Exp $ */
/* $NetBSD: ahc_pci.c,v 1.9 1996/10/21 22:56:24 thorpej Exp $ */
/*
@@ -948,7 +948,9 @@ check_extport(ahc, sxfrctl1)
int have_seeprom;
int have_autoterm;
- sd.sd_ahc = ahc;
+ sd.sd_tag = ahc->tag;
+ sd.sd_bsh = ahc->bsh;
+ sd.sd_regsize = 1;
sd.sd_control_offset = SEECTL;
sd.sd_status_offset = SEECTL;
sd.sd_dataout_offset = SEECTL;