1325618Ssbruno/*
2325618Ssbruno *   BSD LICENSE
3325618Ssbruno *
4325618Ssbruno *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.
5325618Ssbruno *   All rights reserved.
6325618Ssbruno *
7325618Ssbruno *   Redistribution and use in source and binary forms, with or without
8325618Ssbruno *   modification, are permitted provided that the following conditions
9325618Ssbruno *   are met:
10325618Ssbruno *
11325618Ssbruno *     * Redistributions of source code must retain the above copyright
12325618Ssbruno *       notice, this list of conditions and the following disclaimer.
13325618Ssbruno *     * Redistributions in binary form must reproduce the above copyright
14325618Ssbruno *       notice, this list of conditions and the following disclaimer in
15325618Ssbruno *       the documentation and/or other materials provided with the
16325618Ssbruno *       distribution.
17325618Ssbruno *     * Neither the name of Cavium, Inc. nor the names of its
18325618Ssbruno *       contributors may be used to endorse or promote products derived
19325618Ssbruno *       from this software without specific prior written permission.
20325618Ssbruno *
21325618Ssbruno *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22325618Ssbruno *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23325618Ssbruno *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24325618Ssbruno *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25325618Ssbruno *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26325618Ssbruno *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27325618Ssbruno *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28325618Ssbruno *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29325618Ssbruno *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30325618Ssbruno *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31325618Ssbruno *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32325618Ssbruno */
33325618Ssbruno/*$FreeBSD: stable/11/sys/dev/liquidio/base/lio_image.h 325618 2017-11-09 19:52:56Z sbruno $*/
34325618Ssbruno
35325618Ssbruno#ifndef _LIO_IMAGE_H_
36325618Ssbruno#define _LIO_IMAGE_H_
37325618Ssbruno
38325618Ssbruno#define LIO_MAX_FW_FILENAME_LEN		256
39325618Ssbruno#define LIO_FW_BASE_NAME		"lio_"
40325618Ssbruno#define LIO_FW_NAME_SUFFIX		".bin"
41325618Ssbruno#define LIO_FW_NAME_TYPE_NIC		"nic"
42325618Ssbruno#define LIO_FW_NAME_TYPE_NONE		"none"
43325618Ssbruno#define LIO_MAX_FIRMWARE_VERSION_LEN	16
44325618Ssbruno
45325618Ssbruno#define LIO_MAX_BOOTCMD_LEN		1024
46325618Ssbruno#define LIO_MAX_IMAGES			16
47325618Ssbruno#define LIO_NIC_MAGIC			0x434E4943	/* "CNIC" */
48325618Ssbrunostruct lio_firmware_desc {
49325618Ssbruno	__be64	addr;
50325618Ssbruno	__be32	len;
51325618Ssbruno	__be32	crc32;	/* crc32 of image */
52325618Ssbruno};
53325618Ssbruno
54325618Ssbruno/*
55325618Ssbruno * Following the header is a list of 64-bit aligned binary images,
56325618Ssbruno * as described by the desc field.
57325618Ssbruno * Numeric fields are in network byte order.
58325618Ssbruno */
59325618Ssbrunostruct lio_firmware_file_header {
60325618Ssbruno	__be32				magic;
61325618Ssbruno	char				version[LIO_MAX_FIRMWARE_VERSION_LEN];
62325618Ssbruno	char				bootcmd[LIO_MAX_BOOTCMD_LEN];
63325618Ssbruno	__be32				num_images;
64325618Ssbruno	struct lio_firmware_desc	desc[LIO_MAX_IMAGES];
65325618Ssbruno	__be32				pad;
66325618Ssbruno	__be32				crc32;	/* header checksum */
67325618Ssbruno};
68325618Ssbruno
69325618Ssbruno#endif	/* _LIO_IMAGE_H_ */
70