xref: /freebsd/sys/dev/qlxgb/qla_ioctl.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1718cf2ccSPedro F. Giffuni /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
4088fc971SDavid C Somayajulu  * Copyright (c) 2011-2013 Qlogic Corporation
50bc7cf6fSBjoern A. Zeeb  * All rights reserved.
60bc7cf6fSBjoern A. Zeeb  *
70bc7cf6fSBjoern A. Zeeb  *  Redistribution and use in source and binary forms, with or without
80bc7cf6fSBjoern A. Zeeb  *  modification, are permitted provided that the following conditions
90bc7cf6fSBjoern A. Zeeb  *  are met:
100bc7cf6fSBjoern A. Zeeb  *
110bc7cf6fSBjoern A. Zeeb  *  1. Redistributions of source code must retain the above copyright
120bc7cf6fSBjoern A. Zeeb  *     notice, this list of conditions and the following disclaimer.
130bc7cf6fSBjoern A. Zeeb  *  2. Redistributions in binary form must reproduce the above copyright
140bc7cf6fSBjoern A. Zeeb  *     notice, this list of conditions and the following disclaimer in the
150bc7cf6fSBjoern A. Zeeb  *     documentation and/or other materials provided with the distribution.
160bc7cf6fSBjoern A. Zeeb  *
170bc7cf6fSBjoern A. Zeeb  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
180bc7cf6fSBjoern A. Zeeb  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
190bc7cf6fSBjoern A. Zeeb  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
200bc7cf6fSBjoern A. Zeeb  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
210bc7cf6fSBjoern A. Zeeb  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
220bc7cf6fSBjoern A. Zeeb  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
230bc7cf6fSBjoern A. Zeeb  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
240bc7cf6fSBjoern A. Zeeb  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
250bc7cf6fSBjoern A. Zeeb  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
260bc7cf6fSBjoern A. Zeeb  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
270bc7cf6fSBjoern A. Zeeb  *  POSSIBILITY OF SUCH DAMAGE.
280bc7cf6fSBjoern A. Zeeb  */
290bc7cf6fSBjoern A. Zeeb /*
300bc7cf6fSBjoern A. Zeeb  * File: qla_ioctl.h
310bc7cf6fSBjoern A. Zeeb  * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
320bc7cf6fSBjoern A. Zeeb  */
330bc7cf6fSBjoern A. Zeeb 
340bc7cf6fSBjoern A. Zeeb #ifndef _QLA_IOCTL_H_
350bc7cf6fSBjoern A. Zeeb #define _QLA_IOCTL_H_
360bc7cf6fSBjoern A. Zeeb 
370bc7cf6fSBjoern A. Zeeb #include <sys/ioccom.h>
380bc7cf6fSBjoern A. Zeeb 
390bc7cf6fSBjoern A. Zeeb struct qla_reg_val {
400bc7cf6fSBjoern A. Zeeb         uint16_t rd;
410bc7cf6fSBjoern A. Zeeb         uint16_t direct;
420bc7cf6fSBjoern A. Zeeb         uint32_t reg;
430bc7cf6fSBjoern A. Zeeb         uint32_t val;
440bc7cf6fSBjoern A. Zeeb };
450bc7cf6fSBjoern A. Zeeb typedef struct qla_reg_val qla_reg_val_t;
460bc7cf6fSBjoern A. Zeeb 
470bc7cf6fSBjoern A. Zeeb struct qla_rd_flash {
480bc7cf6fSBjoern A. Zeeb         uint32_t off;
490bc7cf6fSBjoern A. Zeeb         uint32_t data;
500bc7cf6fSBjoern A. Zeeb };
510bc7cf6fSBjoern A. Zeeb typedef struct qla_rd_flash qla_rd_flash_t;
520bc7cf6fSBjoern A. Zeeb 
53088fc971SDavid C Somayajulu struct qla_wr_flash {
54088fc971SDavid C Somayajulu 	uint32_t off;
55088fc971SDavid C Somayajulu 	uint32_t size;
56088fc971SDavid C Somayajulu 	void *buffer;
57088fc971SDavid C Somayajulu 	uint32_t pattern;
58088fc971SDavid C Somayajulu };
59088fc971SDavid C Somayajulu typedef struct qla_wr_flash qla_wr_flash_t;
60088fc971SDavid C Somayajulu 
61088fc971SDavid C Somayajulu struct qla_erase_flash {
62088fc971SDavid C Somayajulu 	uint32_t off;
63088fc971SDavid C Somayajulu 	uint32_t size;
64088fc971SDavid C Somayajulu };
65088fc971SDavid C Somayajulu typedef struct qla_erase_flash qla_erase_flash_t;
66088fc971SDavid C Somayajulu 
67088fc971SDavid C Somayajulu struct qla_rd_pci_ids {
68088fc971SDavid C Somayajulu 	uint16_t ven_id;
69088fc971SDavid C Somayajulu 	uint16_t dev_id;
70088fc971SDavid C Somayajulu 	uint16_t subsys_ven_id;
71088fc971SDavid C Somayajulu 	uint16_t subsys_dev_id;
72088fc971SDavid C Somayajulu 	uint8_t rev_id;
73088fc971SDavid C Somayajulu };
74088fc971SDavid C Somayajulu typedef struct qla_rd_pci_ids qla_rd_pci_ids_t;
750bc7cf6fSBjoern A. Zeeb 
760bc7cf6fSBjoern A. Zeeb /*
770bc7cf6fSBjoern A. Zeeb  * Read/Write Register
780bc7cf6fSBjoern A. Zeeb  */
790bc7cf6fSBjoern A. Zeeb #define QLA_RDWR_REG                    _IOWR('q', 1, qla_reg_val_t)
800bc7cf6fSBjoern A. Zeeb 
810bc7cf6fSBjoern A. Zeeb /*
820bc7cf6fSBjoern A. Zeeb  * Read Flash
830bc7cf6fSBjoern A. Zeeb  */
840bc7cf6fSBjoern A. Zeeb #define QLA_RD_FLASH                    _IOWR('q', 2, qla_rd_flash_t)
850bc7cf6fSBjoern A. Zeeb 
86088fc971SDavid C Somayajulu /*
87088fc971SDavid C Somayajulu  * Write Flash
88088fc971SDavid C Somayajulu  */
89088fc971SDavid C Somayajulu #define QLA_WR_FLASH			_IOWR('q', 3, qla_wr_flash_t)
90088fc971SDavid C Somayajulu 
91088fc971SDavid C Somayajulu /*
92088fc971SDavid C Somayajulu  * Erase Flash
93088fc971SDavid C Somayajulu  */
94088fc971SDavid C Somayajulu #define QLA_ERASE_FLASH			_IOWR('q', 5, qla_erase_flash_t)
95088fc971SDavid C Somayajulu 
96088fc971SDavid C Somayajulu /*
97088fc971SDavid C Somayajulu  * Read PCI IDs
98088fc971SDavid C Somayajulu  */
99088fc971SDavid C Somayajulu #define QLA_RD_PCI_IDS			_IOWR('q', 6, qla_rd_pci_ids_t)
100088fc971SDavid C Somayajulu 
1010bc7cf6fSBjoern A. Zeeb #endif /* #ifndef _QLA_IOCTL_H_ */
102