aic7xxx_93cx6.h (63457) | aic7xxx_93cx6.h (65942) |
---|---|
1/* | 1/* |
2 * Interface to the 93C46 serial EEPROM that is used to store BIOS | 2 * Interface to the 93C46/56 serial EEPROM that is used to store BIOS |
3 * settings for the aic7xxx based adaptec SCSI controllers. It can 4 * also be used for 93C26 and 93C06 serial EEPROMS. 5 * | 3 * settings for the aic7xxx based adaptec SCSI controllers. It can 4 * also be used for 93C26 and 93C06 serial EEPROMS. 5 * |
6 * Copyright (c) 1994, 1995 Justin T. Gibbs. | 6 * Copyright (c) 1994, 1995, 2000 Justin T. Gibbs. |
7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions, and the following disclaimer, 14 * without modification. --- 10 unchanged lines hidden (view full) --- 25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions, and the following disclaimer, 14 * without modification. --- 10 unchanged lines hidden (view full) --- 25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/dev/aic7xxx/aic7xxx_93cx6.h 63457 2000-07-18 20:12:14Z gibbs $ | 33 * $Id$ 34 * 35 * $FreeBSD: head/sys/dev/aic7xxx/aic7xxx_93cx6.h 65942 2000-09-16 20:02:28Z gibbs $ |
34 */ | 36 */ |
37#ifndef _AIC7XXX_93CX6_H_ 38#define _AIC7XXX_93CX6_H_ |
|
35 | 39 |
36#include <sys/param.h> 37#if !defined(__NetBSD__) 38#include <sys/systm.h> 39#endif 40 41#ifdef _KERNEL 42 | |
43typedef enum { 44 C46 = 6, 45 C56_66 = 8 46} seeprom_chip_t; 47 48struct seeprom_descriptor { | 40typedef enum { 41 C46 = 6, 42 C56_66 = 8 43} seeprom_chip_t; 44 45struct seeprom_descriptor { |
49 bus_space_tag_t sd_tag; 50 bus_space_handle_t sd_bsh; 51 bus_size_t sd_control_offset; 52 bus_size_t sd_status_offset; 53 bus_size_t sd_dataout_offset; | 46 struct ahc_softc *sd_ahc; 47 u_int sd_control_offset; 48 u_int sd_status_offset; 49 u_int sd_dataout_offset; |
54 seeprom_chip_t sd_chip; 55 uint16_t sd_MS; 56 uint16_t sd_RDY; 57 uint16_t sd_CS; 58 uint16_t sd_CK; 59 uint16_t sd_DO; 60 uint16_t sd_DI; 61}; --- 10 unchanged lines hidden (view full) --- 72 * DI - Data in 73 * RDY - SEEPROM ready 74 * MS - Memory port mode select 75 * 76 * A failed read attempt returns 0, and a successful read returns 1. 77 */ 78 79#define SEEPROM_INB(sd) \ | 50 seeprom_chip_t sd_chip; 51 uint16_t sd_MS; 52 uint16_t sd_RDY; 53 uint16_t sd_CS; 54 uint16_t sd_CK; 55 uint16_t sd_DO; 56 uint16_t sd_DI; 57}; --- 10 unchanged lines hidden (view full) --- 68 * DI - Data in 69 * RDY - SEEPROM ready 70 * MS - Memory port mode select 71 * 72 * A failed read attempt returns 0, and a successful read returns 1. 73 */ 74 75#define SEEPROM_INB(sd) \ |
80 bus_space_read_1(sd->sd_tag, sd->sd_bsh, sd->sd_control_offset) 81#define SEEPROM_OUTB(sd, value) \ 82 bus_space_write_1(sd->sd_tag, sd->sd_bsh, sd->sd_control_offset, value) | 76 ahc_inb(sd->sd_ahc, sd->sd_control_offset) 77#define SEEPROM_OUTB(sd, value) \ 78do { \ 79 ahc_outb(sd->sd_ahc, sd->sd_control_offset, value); \ 80 ahc_flush_device_writes(sd->sd_ahc); \ 81} while(0) 82 |
83#define SEEPROM_STATUS_INB(sd) \ | 83#define SEEPROM_STATUS_INB(sd) \ |
84 bus_space_read_1(sd->sd_tag, sd->sd_bsh, sd->sd_status_offset) | 84 ahc_inb(sd->sd_ahc, sd->sd_status_offset) |
85#define SEEPROM_DATA_INB(sd) \ | 85#define SEEPROM_DATA_INB(sd) \ |
86 bus_space_read_1(sd->sd_tag, sd->sd_bsh, sd->sd_dataout_offset) | 86 ahc_inb(sd->sd_ahc, sd->sd_dataout_offset) |
87 88int read_seeprom(struct seeprom_descriptor *sd, uint16_t *buf, | 87 88int read_seeprom(struct seeprom_descriptor *sd, uint16_t *buf, |
89 bus_size_t start_addr, bus_size_t count); | 89 u_int start_addr, u_int count); 90int verify_cksum(struct seeprom_config *sc); |
90 | 91 |
91#endif /* _KERNEL */ | 92#endif /* _AIC7XXX_93CX6_H_ */ |