![]() |
|
|||
0001 /* 0002 * Interface to the 93C46/56 serial EEPROM that is used to store BIOS 0003 * settings for the aic7xxx based adaptec SCSI controllers. It can 0004 * also be used for 93C26 and 93C06 serial EEPROMS. 0005 * 0006 * Copyright (c) 1994, 1995, 2000 Justin T. Gibbs. 0007 * All rights reserved. 0008 * 0009 * Redistribution and use in source and binary forms, with or without 0010 * modification, are permitted provided that the following conditions 0011 * are met: 0012 * 1. Redistributions of source code must retain the above copyright 0013 * notice, this list of conditions, and the following disclaimer, 0014 * without modification. 0015 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 0016 * substantially similar to the "NO WARRANTY" disclaimer below 0017 * ("Disclaimer") and any redistribution must be conditioned upon 0018 * including a substantially similar Disclaimer requirement for further 0019 * binary redistribution. 0020 * 3. Neither the names of the above-listed copyright holders nor the names 0021 * of any contributors may be used to endorse or promote products derived 0022 * from this software without specific prior written permission. 0023 * 0024 * Alternatively, this software may be distributed under the terms of the 0025 * GNU General Public License ("GPL") version 2 as published by the Free 0026 * Software Foundation. 0027 * 0028 * NO WARRANTY 0029 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0030 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0031 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 0032 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0033 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 0034 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 0035 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 0036 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 0037 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 0038 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0039 * POSSIBILITY OF SUCH DAMAGES. 0040 * 0041 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_93cx6.h#12 $ 0042 * 0043 * $FreeBSD$ 0044 */ 0045 #ifndef _AIC7XXX_93CX6_H_ 0046 #define _AIC7XXX_93CX6_H_ 0047 0048 typedef enum { 0049 C46 = 6, 0050 C56_66 = 8 0051 } seeprom_chip_t; 0052 0053 struct seeprom_descriptor { 0054 struct ahc_softc *sd_ahc; 0055 u_int sd_control_offset; 0056 u_int sd_status_offset; 0057 u_int sd_dataout_offset; 0058 seeprom_chip_t sd_chip; 0059 uint16_t sd_MS; 0060 uint16_t sd_RDY; 0061 uint16_t sd_CS; 0062 uint16_t sd_CK; 0063 uint16_t sd_DO; 0064 uint16_t sd_DI; 0065 }; 0066 0067 /* 0068 * This function will read count 16-bit words from the serial EEPROM and 0069 * return their value in buf. The port address of the aic7xxx serial EEPROM 0070 * control register is passed in as offset. The following parameters are 0071 * also passed in: 0072 * 0073 * CS - Chip select 0074 * CK - Clock 0075 * DO - Data out 0076 * DI - Data in 0077 * RDY - SEEPROM ready 0078 * MS - Memory port mode select 0079 * 0080 * A failed read attempt returns 0, and a successful read returns 1. 0081 */ 0082 0083 #define SEEPROM_INB(sd) \ 0084 ahc_inb(sd->sd_ahc, sd->sd_control_offset) 0085 #define SEEPROM_OUTB(sd, value) \ 0086 do { \ 0087 ahc_outb(sd->sd_ahc, sd->sd_control_offset, value); \ 0088 ahc_flush_device_writes(sd->sd_ahc); \ 0089 } while(0) 0090 0091 #define SEEPROM_STATUS_INB(sd) \ 0092 ahc_inb(sd->sd_ahc, sd->sd_status_offset) 0093 #define SEEPROM_DATA_INB(sd) \ 0094 ahc_inb(sd->sd_ahc, sd->sd_dataout_offset) 0095 0096 int ahc_read_seeprom(struct seeprom_descriptor *sd, uint16_t *buf, 0097 u_int start_addr, u_int count); 0098 int ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf, 0099 u_int start_addr, u_int count); 0100 int ahc_verify_cksum(struct seeprom_config *sc); 0101 0102 #endif /* _AIC7XXX_93CX6_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |