1129794Stackerman/*******************************************************************************
2129794Stackerman
3129794Stackerman  Copyright (c) 2001-2004, Intel Corporation
4129794Stackerman  All rights reserved.
5129794Stackerman
6129794Stackerman  Redistribution and use in source and binary forms, with or without
7129794Stackerman  modification, are permitted provided that the following conditions are met:
8129794Stackerman
9129794Stackerman   1. Redistributions of source code must retain the above copyright notice,
10129794Stackerman      this list of conditions and the following disclaimer.
11129794Stackerman
12129794Stackerman   2. Redistributions in binary form must reproduce the above copyright
13129794Stackerman      notice, this list of conditions and the following disclaimer in the
14129794Stackerman      documentation and/or other materials provided with the distribution.
15129794Stackerman
16129794Stackerman   3. Neither the name of the Intel Corporation nor the names of its
17129794Stackerman      contributors may be used to endorse or promote products derived from
18129794Stackerman      this software without specific prior written permission.
19129794Stackerman
20129794Stackerman  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21129794Stackerman  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22129794Stackerman  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23129794Stackerman  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24129794Stackerman  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25129794Stackerman  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26129794Stackerman  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27129794Stackerman  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28129794Stackerman  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29129794Stackerman  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30129794Stackerman  POSSIBILITY OF SUCH DAMAGE.
31129794Stackerman
32129794Stackerman*******************************************************************************/
33129794Stackerman
34129794Stackerman/*$FreeBSD$*/
35129794Stackerman#ifndef _IXGB_EE_H_
36129794Stackerman#define _IXGB_EE_H_
37129794Stackerman
38129794Stackerman
39129794Stackerman#define IXGB_EEPROM_SIZE    64   /* Size in words */
40129794Stackerman
41129794Stackerman#define IXGB_ETH_LENGTH_OF_ADDRESS   6
42129794Stackerman
43129794Stackerman
44129794Stackerman/* EEPROM Commands */
45129794Stackerman#define EEPROM_READ_OPCODE  0x6  /* EERPOM read opcode */
46129794Stackerman#define EEPROM_WRITE_OPCODE 0x5  /* EERPOM write opcode */
47129794Stackerman#define EEPROM_ERASE_OPCODE 0x7  /* EERPOM erase opcode */
48129794Stackerman#define EEPROM_EWEN_OPCODE  0x13 /* EERPOM erase/write enable */
49129794Stackerman#define EEPROM_EWDS_OPCODE  0x10 /* EERPOM erast/write disable */
50129794Stackerman
51129794Stackerman/* EEPROM MAP (Word Offsets) */
52129794Stackerman#define EEPROM_IA_1_2_REG        0x0000
53129794Stackerman#define EEPROM_IA_3_4_REG        0x0001
54129794Stackerman#define EEPROM_IA_5_6_REG        0x0002
55129794Stackerman#define EEPROM_COMPATIBILITY_REG 0x0003
56129794Stackerman#define EEPROM_PBA_1_2_REG       0x0008
57129794Stackerman#define EEPROM_PBA_3_4_REG       0x0009
58129794Stackerman#define EEPROM_INIT_CONTROL1_REG 0x000A
59129794Stackerman#define EEPROM_SUBSYS_ID_REG     0x000B
60129794Stackerman#define EEPROM_SUBVEND_ID_REG    0x000C
61129794Stackerman#define EEPROM_DEVICE_ID_REG     0x000D
62129794Stackerman#define EEPROM_VENDOR_ID_REG     0x000E
63129794Stackerman#define EEPROM_INIT_CONTROL2_REG 0x000F
64129794Stackerman#define EEPROM_SWDPINS_REG       0x0020
65129794Stackerman#define EEPROM_CIRCUIT_CTRL_REG  0x0021
66129794Stackerman#define EEPROM_D0_D3_POWER_REG   0x0022
67129794Stackerman#define EEPROM_FLASH_VERSION     0x0032
68129794Stackerman#define EEPROM_CHECKSUM_REG      0x003F
69129794Stackerman
70129794Stackerman/* Mask bits for fields in Word 0x0a of the EEPROM */
71129794Stackerman
72129794Stackerman#define EEPROM_ICW1_SIGNATURE_MASK  0xC000
73129794Stackerman#define EEPROM_ICW1_SIGNATURE_VALID 0x4000
74129794Stackerman
75129794Stackerman/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA. */
76129794Stackerman#define EEPROM_SUM 0xBABA
77129794Stackerman
78129794Stackerman/* EEPROM Map Sizes (Byte Counts) */
79129794Stackerman#define PBA_SIZE 4
80129794Stackerman
81129794Stackerman/* EEPROM Map defines (WORD OFFSETS)*/
82129794Stackerman
83129794Stackerman/* EEPROM structure */
84129794Stackermanstruct  ixgb_ee_map_type{
85129794Stackerman    uint8_t         mac_addr[IXGB_ETH_LENGTH_OF_ADDRESS];
86129794Stackerman    uint16_t        compatibility;
87129794Stackerman    uint16_t        reserved1[4];
88129794Stackerman    uint32_t        pba_number;
89129794Stackerman    uint16_t        init_ctrl_reg_1;
90129794Stackerman    uint16_t        subsystem_id;
91129794Stackerman    uint16_t        subvendor_id;
92129794Stackerman    uint16_t        device_id;
93129794Stackerman    uint16_t        vendor_id;
94129794Stackerman    uint16_t        init_ctrl_reg_2;
95129794Stackerman    uint16_t        oem_reserved[16];
96129794Stackerman    uint16_t        swdpins_reg;
97129794Stackerman    uint16_t        circuit_ctrl_reg;
98129794Stackerman    uint8_t         d3_power;
99129794Stackerman    uint8_t         d0_power;
100129794Stackerman    uint16_t        reserved2[28];
101129794Stackerman    uint16_t        checksum;
102129794Stackerman        };
103129794Stackerman
104129794Stackerman/* EEPROM Functions */
105129794Stackermanuint16_t ixgb_read_eeprom(struct ixgb_hw *hw,
106129794Stackerman                           uint16_t reg);
107129794Stackerman
108129794Stackermanboolean_t ixgb_validate_eeprom_checksum(struct ixgb_hw *hw);
109129794Stackerman
110129794Stackermanvoid ixgb_update_eeprom_checksum(struct ixgb_hw *hw);
111129794Stackerman
112129794Stackermanvoid ixgb_write_eeprom(struct ixgb_hw *hw,
113129794Stackerman                             uint16_t reg,
114129794Stackerman                             uint16_t data);
115129794Stackerman
116129794Stackerman#endif /* IXGB_EE_H */
117129794Stackerman
118