1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3 * cycx_cfm.h	Cyclom 2X WAN Link Driver.
4 *		Definitions for the Cyclom 2X Firmware Module (CFM).
5 *
6 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 *
8 * Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
9 *
10 * Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com>
11 *
12 *		This program is free software; you can redistribute it and/or
13 *		modify it under the terms of the GNU General Public License
14 *		as published by the Free Software Foundation; either version
15 *		2 of the License, or (at your option) any later version.
16 * ============================================================================
17 * 1998/08/08	acme		Initial version.
18 */
19 #ifndef	_CYCX_CFM_H
20 #define	_CYCX_CFM_H
21 
22 /* Defines */
23 
24 #define	CFM_VERSION	2
25 #define	CFM_SIGNATURE	"CFM - Cyclades CYCX Firmware Module"
26 
27 /* min/max */
28 #define	CFM_IMAGE_SIZE	0x20000	/* max size of CYCX code image file */
29 #define	CFM_DESCR_LEN	256	/* max length of description string */
30 #define	CFM_MAX_CYCX	1	/* max number of compatible adapters */
31 #define	CFM_LOAD_BUFSZ	0x400	/* buffer size for reset code (buffer_load) */
32 
33 /* Firmware Commands */
34 #define GEN_POWER_ON	0x1280
35 
36 #define GEN_SET_SEG	0x1401	/* boot segment setting. */
37 #define GEN_BOOT_DAT	0x1402	/* boot data. */
38 #define GEN_START	0x1403	/* board start. */
39 #define GEN_DEFPAR	0x1404	/* buffer length for boot. */
40 
41 /* Adapter Types */
42 #define CYCX_2X		2
43 /* for now only the 2X is supported, no plans to support 8X or 16X */
44 #define CYCX_8X		8
45 #define CYCX_16X	16
46 
47 #define	CFID_X25_2X	5200
48 
49 /**
50  *	struct cycx_fw_info - firmware module information.
51  *	@codeid - firmware ID
52  *	@version - firmware version number
53  *	@adapter - compatible adapter types
54  *	@memsize - minimum memory size
55  *	@reserved - reserved
56  *	@startoffs - entry point offset
57  *	@winoffs - dual-port memory window offset
58  *	@codeoffs - code load offset
59  *	@codesize - code size
60  *	@dataoffs - configuration data load offset
61  *	@datasize - configuration data size
62  */
63 struct cycx_fw_info {
64 	unsigned short	codeid;
65 	unsigned short	version;
66 	unsigned short	adapter[CFM_MAX_CYCX];
67 	unsigned long	memsize;
68 	unsigned short	reserved[2];
69 	unsigned short	startoffs;
70 	unsigned short	winoffs;
71 	unsigned short	codeoffs;
72 	unsigned long	codesize;
73 	unsigned short	dataoffs;
74 	unsigned long	datasize;
75 };
76 
77 /**
78  *	struct cycx_firmware - CYCX firmware file structure
79  *	@signature - CFM file signature
80  *	@version - file format version
81  *	@checksum - info + image
82  *	@reserved - reserved
83  *	@descr - description string
84  *	@info - firmware module info
85  *	@image - code image (variable size)
86  */
87 struct cycx_firmware {
88 	char		    signature[80];
89 	unsigned short	    version;
90 	unsigned short	    checksum;
91 	unsigned short	    reserved[6];
92 	char		    descr[CFM_DESCR_LEN];
93 	struct cycx_fw_info info;
94 	unsigned char	    image[0];
95 };
96 
97 struct cycx_fw_header {
98 	unsigned long  reset_size;
99 	unsigned long  data_size;
100 	unsigned long  code_size;
101 };
102 #endif	/* _CYCX_CFM_H */
103