xref: /freebsd/sys/dev/liquidio/base/lio_image.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1*f173c2b7SSean Bruno /*
2*f173c2b7SSean Bruno  *   BSD LICENSE
3*f173c2b7SSean Bruno  *
4*f173c2b7SSean Bruno  *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.
5*f173c2b7SSean Bruno  *   All rights reserved.
6*f173c2b7SSean Bruno  *
7*f173c2b7SSean Bruno  *   Redistribution and use in source and binary forms, with or without
8*f173c2b7SSean Bruno  *   modification, are permitted provided that the following conditions
9*f173c2b7SSean Bruno  *   are met:
10*f173c2b7SSean Bruno  *
11*f173c2b7SSean Bruno  *     * Redistributions of source code must retain the above copyright
12*f173c2b7SSean Bruno  *       notice, this list of conditions and the following disclaimer.
13*f173c2b7SSean Bruno  *     * Redistributions in binary form must reproduce the above copyright
14*f173c2b7SSean Bruno  *       notice, this list of conditions and the following disclaimer in
15*f173c2b7SSean Bruno  *       the documentation and/or other materials provided with the
16*f173c2b7SSean Bruno  *       distribution.
17*f173c2b7SSean Bruno  *     * Neither the name of Cavium, Inc. nor the names of its
18*f173c2b7SSean Bruno  *       contributors may be used to endorse or promote products derived
19*f173c2b7SSean Bruno  *       from this software without specific prior written permission.
20*f173c2b7SSean Bruno  *
21*f173c2b7SSean Bruno  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*f173c2b7SSean Bruno  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*f173c2b7SSean Bruno  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24*f173c2b7SSean Bruno  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25*f173c2b7SSean Bruno  *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26*f173c2b7SSean Bruno  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27*f173c2b7SSean Bruno  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28*f173c2b7SSean Bruno  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29*f173c2b7SSean Bruno  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30*f173c2b7SSean Bruno  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31*f173c2b7SSean Bruno  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*f173c2b7SSean Bruno  */
33*f173c2b7SSean Bruno 
34*f173c2b7SSean Bruno #ifndef _LIO_IMAGE_H_
35*f173c2b7SSean Bruno #define _LIO_IMAGE_H_
36*f173c2b7SSean Bruno 
37*f173c2b7SSean Bruno #define LIO_MAX_FW_FILENAME_LEN		256
38*f173c2b7SSean Bruno #define LIO_FW_BASE_NAME		"lio_"
39*f173c2b7SSean Bruno #define LIO_FW_NAME_SUFFIX		".bin"
40*f173c2b7SSean Bruno #define LIO_FW_NAME_TYPE_NIC		"nic"
41*f173c2b7SSean Bruno #define LIO_FW_NAME_TYPE_NONE		"none"
42*f173c2b7SSean Bruno #define LIO_MAX_FIRMWARE_VERSION_LEN	16
43*f173c2b7SSean Bruno 
44*f173c2b7SSean Bruno #define LIO_MAX_BOOTCMD_LEN		1024
45*f173c2b7SSean Bruno #define LIO_MAX_IMAGES			16
46*f173c2b7SSean Bruno #define LIO_NIC_MAGIC			0x434E4943	/* "CNIC" */
47*f173c2b7SSean Bruno struct lio_firmware_desc {
48*f173c2b7SSean Bruno 	__be64	addr;
49*f173c2b7SSean Bruno 	__be32	len;
50*f173c2b7SSean Bruno 	__be32	crc32;	/* crc32 of image */
51*f173c2b7SSean Bruno };
52*f173c2b7SSean Bruno 
53*f173c2b7SSean Bruno /*
54*f173c2b7SSean Bruno  * Following the header is a list of 64-bit aligned binary images,
55*f173c2b7SSean Bruno  * as described by the desc field.
56*f173c2b7SSean Bruno  * Numeric fields are in network byte order.
57*f173c2b7SSean Bruno  */
58*f173c2b7SSean Bruno struct lio_firmware_file_header {
59*f173c2b7SSean Bruno 	__be32				magic;
60*f173c2b7SSean Bruno 	char				version[LIO_MAX_FIRMWARE_VERSION_LEN];
61*f173c2b7SSean Bruno 	char				bootcmd[LIO_MAX_BOOTCMD_LEN];
62*f173c2b7SSean Bruno 	__be32				num_images;
63*f173c2b7SSean Bruno 	struct lio_firmware_desc	desc[LIO_MAX_IMAGES];
64*f173c2b7SSean Bruno 	__be32				pad;
65*f173c2b7SSean Bruno 	__be32				crc32;	/* header checksum */
66*f173c2b7SSean Bruno };
67*f173c2b7SSean Bruno 
68*f173c2b7SSean Bruno #endif	/* _LIO_IMAGE_H_ */
69