The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/aic7xxx/aic7xxx_93cx6.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: db87a1cb16e12dedfc72b00f57c9f5f7


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.