aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bxe/bxe_ioctl.h
blob: a0f8478010099413e4423017f468df29193f504b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * Copyright (c) 2015-2016 Qlogic Corporation
 * All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 *  POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _BXE_IOCTL_H_
#define _BXE_IOCTL_H_

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/ioccom.h>


struct bxe_grcdump {
    uint16_t pci_func;
    uint32_t grcdump_size;
    void *grcdump;
    uint32_t grcdump_dwords;
};
typedef struct bxe_grcdump bxe_grcdump_t;

#define BXE_DRV_NAME_LENGTH             32
#define BXE_DRV_VERSION_LENGTH          32
#define BXE_MFW_VERSION_LENGTH          32
#define BXE_STORMFW_VERSION_LENGTH      32
#define BXE_BUS_INFO_LENGTH             32

struct bxe_drvinfo {
    char drv_name[BXE_DRV_NAME_LENGTH];
    char drv_version[BXE_DRV_VERSION_LENGTH];
    char mfw_version[BXE_MFW_VERSION_LENGTH];
    char stormfw_version[BXE_STORMFW_VERSION_LENGTH];
    uint32_t eeprom_dump_len; /* in bytes */
    uint32_t reg_dump_len; /* in bytes */
    char bus_info[BXE_BUS_INFO_LENGTH];
};
typedef struct bxe_drvinfo bxe_drvinfo_t;

struct bxe_dev_setting {

    uint32_t supported;  /* Features this interface supports */
    uint32_t advertising;/* Features this interface advertises */
    uint32_t speed;      /* The forced speed, 10Mb, 100Mb, gigabit */
    uint32_t duplex;     /* Duplex, half or full */
    uint32_t port;       /* Which connector port */
    uint32_t phy_address;/* port number*/
    uint32_t autoneg;    /* Enable or disable autonegotiation */
};
typedef struct bxe_dev_setting bxe_dev_setting_t;

struct bxe_get_regs {
    void *reg_buf;
    uint32_t reg_buf_len;
};
typedef struct bxe_get_regs bxe_get_regs_t;

#define BXE_EEPROM_MAX_DATA_LEN   524288

struct bxe_eeprom {
    uint32_t eeprom_cmd;
#define BXE_EEPROM_CMD_SET_EEPROM       0x01
#define BXE_EEPROM_CMD_GET_EEPROM       0x02

    void *eeprom_data;
    uint32_t eeprom_offset;
    uint32_t eeprom_data_len;
    uint32_t eeprom_magic;
};
typedef struct bxe_eeprom bxe_eeprom_t;

struct bxe_reg_rdw {
    uint32_t reg_cmd;
#define BXE_READ_REG_CMD                0x01
#define BXE_WRITE_REG_CMD               0x02

    uint32_t reg_id;
    uint32_t reg_val;
    uint32_t reg_access_type;
#define BXE_REG_ACCESS_DIRECT           0x01
#define BXE_REG_ACCESS_INDIRECT         0x02
};

typedef struct bxe_reg_rdw bxe_reg_rdw_t;

struct bxe_pcicfg_rdw {
    uint32_t cfg_cmd;
#define BXE_READ_PCICFG                 0x01
#define BXE_WRITE_PCICFG                0x01
    uint32_t cfg_id;
    uint32_t cfg_val;
    uint32_t cfg_width;
};

typedef struct bxe_pcicfg_rdw bxe_pcicfg_rdw_t;

struct bxe_perm_mac_addr {
    char mac_addr_str[32];
};

typedef struct bxe_perm_mac_addr bxe_perm_mac_addr_t;


/*
 * Read grcdump size
 */
#define BXE_GRC_DUMP_SIZE     _IOWR('e', 1, bxe_grcdump_t)

/*
 * Read grcdump
 */
#define BXE_GRC_DUMP          _IOWR('e', 2, bxe_grcdump_t)

/*
 * Read driver info
 */
#define BXE_DRV_INFO          _IOR('e', 3, bxe_drvinfo_t)

/*
 * Read Device Setting
 */
#define BXE_DEV_SETTING       _IOR('e', 4, bxe_dev_setting_t)

/*
 * Get Registers
 */
#define BXE_GET_REGS          _IOR('e', 5, bxe_get_regs_t)

/*
 * Get/Set EEPROM
 */
#define BXE_EEPROM            _IOWR('e', 6, bxe_eeprom_t)

/*
 * read/write a register
 */
#define BXE_RDW_REG           _IOWR('e', 7, bxe_reg_rdw_t)

/*
 * read/write PCIcfg
 */
#define BXE_RDW_PCICFG        _IOWR('e', 8, bxe_reg_rdw_t)

/*
 * get permanent mac address
 */

#define BXE_MAC_ADDR          _IOWR('e', 9, bxe_perm_mac_addr_t)


#endif /* #ifndef _QLNX_IOCTL_H_ */