blob: 357ae57224364be31c234fbb957626167d97f13c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : cmdpkt.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:09
26** Retrieved : 11/6/98 11:34:20
27**
28** ident @(#)cmdpkt.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32#ifndef __rio_cmdpkt_h__
33#define __rio_cmdpkt_h__
34
35#ifdef SCCS_LABELS
36#ifndef lint
37static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2";
38#endif
39#endif
40
41/*
42** overlays for the data area of a packet. Used in both directions
43** (to build a packet to send, and to interpret a packet that arrives)
44** and is very inconvenient for MIPS, so they appear as two separate
45** structures - those used for modifying/reading packets on the card
46** and those for modifying/reading packets in real memory, which have an _M
47** suffix.
48*/
49
50#define RTA_BOOT_DATA_SIZE (PKT_MAX_DATA_LEN-2)
51
52/*
53** The boot information packet looks like this:
54** This structure overlays a PktCmd->CmdData structure, and so starts
55** at Data[2] in the actual pkt!
56*/
Andrew Morton8d8706e2006-01-11 12:17:49 -080057struct BootSequence {
Alan Cox74769ab2006-03-24 03:18:24 -080058 u16 NumPackets;
59 u16 LoadBase;
60 u16 CodeSize;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061};
62
63#define BOOT_SEQUENCE_LEN 8
64
Andrew Morton8d8706e2006-01-11 12:17:49 -080065struct SamTop {
Alan Cox74769ab2006-03-24 03:18:24 -080066 u8 Unit;
67 u8 Link;
Linus Torvalds1da177e2005-04-16 15:20:36 -070068};
69
Andrew Morton8d8706e2006-01-11 12:17:49 -080070struct CmdHdr {
Alan Cox74769ab2006-03-24 03:18:24 -080071 u8 PcCommand;
Andrew Morton8d8706e2006-01-11 12:17:49 -080072 union {
Alan Cox74769ab2006-03-24 03:18:24 -080073 u8 PcPhbNum;
74 u8 PcLinkNum;
75 u8 PcIDNum;
Andrew Morton8d8706e2006-01-11 12:17:49 -080076 } U0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077};
78
79
Andrew Morton8d8706e2006-01-11 12:17:49 -080080struct PktCmd {
81 union {
82 struct {
83 struct CmdHdr CmdHdr;
84 struct BootSequence PcBootSequence;
85 } S1;
86 struct {
Alan Cox74769ab2006-03-24 03:18:24 -080087 u16 PcSequence;
88 u8 PcBootData[RTA_BOOT_DATA_SIZE];
Andrew Morton8d8706e2006-01-11 12:17:49 -080089 } S2;
90 struct {
Alan Cox74769ab2006-03-24 03:18:24 -080091 u16 __crud__;
92 u8 PcUniqNum[4]; /* this is really a uint. */
93 u8 PcModuleTypes; /* what modules are fitted */
Andrew Morton8d8706e2006-01-11 12:17:49 -080094 } S3;
95 struct {
96 struct CmdHdr CmdHdr;
Alan Cox74769ab2006-03-24 03:18:24 -080097 u8 __undefined__;
98 u8 PcModemStatus;
99 u8 PcPortStatus;
100 u8 PcSubCommand; /* commands like mem or register dump */
101 u16 PcSubAddr; /* Address for command */
102 u8 PcSubData[64]; /* Date area for command */
Andrew Morton8d8706e2006-01-11 12:17:49 -0800103 } S4;
104 struct {
105 struct CmdHdr CmdHdr;
Alan Cox74769ab2006-03-24 03:18:24 -0800106 u8 PcCommandText[1];
107 u8 __crud__[20];
108 u8 PcIDNum2; /* It had to go somewhere! */
Andrew Morton8d8706e2006-01-11 12:17:49 -0800109 } S5;
110 struct {
111 struct CmdHdr CmdHdr;
112 struct SamTop Topology[LINKS_PER_UNIT];
113 } S6;
114 } U1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115};
116
Andrew Morton8d8706e2006-01-11 12:17:49 -0800117struct PktCmd_M {
118 union {
119 struct {
120 struct {
Alan Cox27c6e522006-03-24 03:18:26 -0800121 u8 PcCommand;
Andrew Morton8d8706e2006-01-11 12:17:49 -0800122 union {
Alan Cox27c6e522006-03-24 03:18:26 -0800123 u8 PcPhbNum;
124 u8 PcLinkNum;
125 u8 PcIDNum;
Andrew Morton8d8706e2006-01-11 12:17:49 -0800126 } U0;
127 } CmdHdr;
128 struct {
Alan Cox27c6e522006-03-24 03:18:26 -0800129 u16 NumPackets;
130 u16 LoadBase;
131 u16 CodeSize;
Andrew Morton8d8706e2006-01-11 12:17:49 -0800132 } PcBootSequence;
133 } S1;
134 struct {
Alan Cox27c6e522006-03-24 03:18:26 -0800135 u16 PcSequence;
136 u8 PcBootData[RTA_BOOT_DATA_SIZE];
Andrew Morton8d8706e2006-01-11 12:17:49 -0800137 } S2;
138 struct {
Alan Cox27c6e522006-03-24 03:18:26 -0800139 u16 __crud__;
140 u8 PcUniqNum[4]; /* this is really a uint. */
141 u8 PcModuleTypes; /* what modules are fitted */
Andrew Morton8d8706e2006-01-11 12:17:49 -0800142 } S3;
143 struct {
Alan Cox27c6e522006-03-24 03:18:26 -0800144 u16 __cmd_hdr__;
145 u8 __undefined__;
146 u8 PcModemStatus;
147 u8 PcPortStatus;
148 u8 PcSubCommand;
149 u16 PcSubAddr;
150 u8 PcSubData[64];
Andrew Morton8d8706e2006-01-11 12:17:49 -0800151 } S4;
152 struct {
Alan Cox27c6e522006-03-24 03:18:26 -0800153 u16 __cmd_hdr__;
154 u8 PcCommandText[1];
155 u8 __crud__[20];
156 u8 PcIDNum2; /* Tacked on end */
Andrew Morton8d8706e2006-01-11 12:17:49 -0800157 } S5;
158 struct {
Alan Cox27c6e522006-03-24 03:18:26 -0800159 u16 __cmd_hdr__;
Andrew Morton8d8706e2006-01-11 12:17:49 -0800160 struct Top Topology[LINKS_PER_UNIT];
161 } S6;
162 } U1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163};
164
165#define Command U1.S1.CmdHdr.PcCommand
166#define PhbNum U1.S1.CmdHdr.U0.PcPhbNum
167#define IDNum U1.S1.CmdHdr.U0.PcIDNum
168#define IDNum2 U1.S5.PcIDNum2
169#define LinkNum U1.S1.CmdHdr.U0.PcLinkNum
170#define Sequence U1.S2.PcSequence
171#define BootData U1.S2.PcBootData
172#define BootSequence U1.S1.PcBootSequence
173#define UniqNum U1.S3.PcUniqNum
174#define ModemStatus U1.S4.PcModemStatus
175#define PortStatus U1.S4.PcPortStatus
176#define SubCommand U1.S4.PcSubCommand
177#define SubAddr U1.S4.PcSubAddr
178#define SubData U1.S4.PcSubData
179#define CommandText U1.S5.PcCommandText
180#define RouteTopology U1.S6.Topology
181#define ModuleTypes U1.S3.PcModuleTypes
182
183#endif