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/netif/rtw/smc93cx6var.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 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  * Copyright (c) 1994, 1995 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.
   15  * 2. The name of the author may not be used to endorse or promote products
   16  *    derived from this software without specific prior written permission.
   17  *
   18  * Alternatively, this software may be distributed under the terms of the
   19  * the GNU Public License ("GPL").
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
   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: src/sys/dev/aic7xxx/aic7xxx.c,v 1.40 2000/01/07 23:08:17 gibbs Exp $
   34  * $NetBSD: smc93cx6var.h,v 1.9 2005/12/11 12:21:28 christos Exp $
   35  * $DragonFly: src/sys/dev/netif/rtw/smc93cx6var.h,v 1.1 2006/09/03 07:37:58 sephe Exp $
   36  */
   37 
   38 typedef enum {
   39         C46 = 6,
   40         C56_66 = 8
   41 } seeprom_chip_t;
   42 
   43 struct seeprom_descriptor {
   44         bus_space_tag_t sd_tag;
   45         bus_space_handle_t sd_bsh;
   46         bus_size_t sd_regsize;
   47         bus_size_t sd_control_offset;
   48         bus_size_t sd_status_offset;
   49         bus_size_t sd_dataout_offset;
   50         seeprom_chip_t sd_chip;
   51         uint32_t sd_MS;
   52         uint32_t sd_RDY;
   53         uint32_t sd_CS;
   54         uint32_t sd_CK;
   55         uint32_t sd_DO;
   56         uint32_t sd_DI;
   57 };
   58 
   59 /*
   60  * This function will read count 16-bit words from the serial EEPROM and
   61  * return their value in buf.  The port address of the aic7xxx serial EEPROM
   62  * control register is passed in as offset.  The following parameters are
   63  * also passed in:
   64  *
   65  *   CS  - Chip select
   66  *   CK  - Clock
   67  *   DO  - Data out
   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 /* XXX bus barriers */
   76 #define SEEPROM_INB(sd) \
   77         (((sd)->sd_regsize == 4) \
   78             ? bus_space_read_4((sd)->sd_tag, (sd)->sd_bsh, \
   79                   (sd)->sd_control_offset) \
   80             : bus_space_read_1((sd)->sd_tag, (sd)->sd_bsh, \
   81                   (sd)->sd_control_offset))
   82 
   83 #define SEEPROM_OUTB(sd, value) do { \
   84         if ((sd)->sd_regsize == 4) \
   85                 bus_space_write_4((sd)->sd_tag, (sd)->sd_bsh, \
   86                     (sd)->sd_control_offset, (value)); \
   87         else \
   88                 bus_space_write_1((sd)->sd_tag, (sd)->sd_bsh, \
   89                     (sd)->sd_control_offset, (u_int8_t) (value)); \
   90 } while (0)
   91 
   92 #define SEEPROM_STATUS_INB(sd) \
   93         (((sd)->sd_regsize == 4) \
   94             ? bus_space_read_4((sd)->sd_tag, (sd)->sd_bsh, \
   95                   (sd)->sd_status_offset) \
   96             : bus_space_read_1((sd)->sd_tag, (sd)->sd_bsh, \
   97                   (sd)->sd_status_offset))
   98 
   99 #define SEEPROM_DATA_INB(sd) \
  100         (((sd)->sd_regsize == 4) \
  101             ? bus_space_read_4((sd)->sd_tag, (sd)->sd_bsh, \
  102                   (sd)->sd_dataout_offset) \
  103             : bus_space_read_1((sd)->sd_tag, (sd)->sd_bsh, \
  104                   (sd)->sd_dataout_offset))
  105 
  106 int read_seeprom(struct seeprom_descriptor *, uint16_t *, bus_size_t,
  107                  bus_size_t);

Cache object: 150d6cab1efefc374172f0cb5279f313


[ 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.