NFE - Change default RX ring size from 128 -> 256, Adjust moderation timer.
[dragonfly.git] / sys / dev / disk / aic7xxx / aic7xxx_93cx6.h
blob6b27cd02cf69cfd5e3d6b7ca362483eb7071bb78
1 /*
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.
6 * Copyright (c) 1994, 1995, 2000 Justin T. Gibbs.
7 * All rights reserved.
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.
15 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
16 * substantially similar to the "NO WARRANTY" disclaimer below
17 * ("Disclaimer") and any redistribution must be conditioned upon
18 * including a substantially similar Disclaimer requirement for further
19 * binary redistribution.
20 * 3. Neither the names of the above-listed copyright holders nor the names
21 * of any contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * Alternatively, this software may be distributed under the terms of the
25 * GNU General Public License ("GPL") version 2 as published by the Free
26 * Software Foundation.
28 * NO WARRANTY
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
38 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGES.
41 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_93cx6.h#12 $
43 * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx_93cx6.h,v 1.7.2.4 2002/08/31 07:25:53 gibbs Exp $
44 * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_93cx6.h,v 1.2 2003/06/17 04:28:22 dillon Exp $
46 #ifndef _AIC7XXX_93CX6_H_
47 #define _AIC7XXX_93CX6_H_
49 typedef enum {
50 C46 = 6,
51 C56_66 = 8
52 } seeprom_chip_t;
54 struct seeprom_descriptor {
55 struct ahc_softc *sd_ahc;
56 u_int sd_control_offset;
57 u_int sd_status_offset;
58 u_int sd_dataout_offset;
59 seeprom_chip_t sd_chip;
60 uint16_t sd_MS;
61 uint16_t sd_RDY;
62 uint16_t sd_CS;
63 uint16_t sd_CK;
64 uint16_t sd_DO;
65 uint16_t sd_DI;
69 * This function will read count 16-bit words from the serial EEPROM and
70 * return their value in buf. The port address of the aic7xxx serial EEPROM
71 * control register is passed in as offset. The following parameters are
72 * also passed in:
74 * CS - Chip select
75 * CK - Clock
76 * DO - Data out
77 * DI - Data in
78 * RDY - SEEPROM ready
79 * MS - Memory port mode select
81 * A failed read attempt returns 0, and a successful read returns 1.
84 #define SEEPROM_INB(sd) \
85 ahc_inb(sd->sd_ahc, sd->sd_control_offset)
86 #define SEEPROM_OUTB(sd, value) \
87 do { \
88 ahc_outb(sd->sd_ahc, sd->sd_control_offset, value); \
89 ahc_flush_device_writes(sd->sd_ahc); \
90 } while(0)
92 #define SEEPROM_STATUS_INB(sd) \
93 ahc_inb(sd->sd_ahc, sd->sd_status_offset)
94 #define SEEPROM_DATA_INB(sd) \
95 ahc_inb(sd->sd_ahc, sd->sd_dataout_offset)
97 int ahc_read_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
98 u_int start_addr, u_int count);
99 int ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
100 u_int start_addr, u_int count);
101 int ahc_verify_cksum(struct seeprom_config *sc);
103 #endif /* _AIC7XXX_93CX6_H_ */