Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 |
| 37 | static 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 Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 57 | struct BootSequence { |
Alan Cox | 74769ab | 2006-03-24 03:18:24 -0800 | [diff] [blame] | 58 | u16 NumPackets; |
| 59 | u16 LoadBase; |
| 60 | u16 CodeSize; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | #define BOOT_SEQUENCE_LEN 8 |
| 64 | |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 65 | struct SamTop { |
Alan Cox | 74769ab | 2006-03-24 03:18:24 -0800 | [diff] [blame] | 66 | u8 Unit; |
| 67 | u8 Link; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | }; |
| 69 | |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 70 | struct CmdHdr { |
Alan Cox | 74769ab | 2006-03-24 03:18:24 -0800 | [diff] [blame] | 71 | u8 PcCommand; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 72 | union { |
Alan Cox | 74769ab | 2006-03-24 03:18:24 -0800 | [diff] [blame] | 73 | u8 PcPhbNum; |
| 74 | u8 PcLinkNum; |
| 75 | u8 PcIDNum; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 76 | } U0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 80 | struct PktCmd { |
| 81 | union { |
| 82 | struct { |
| 83 | struct CmdHdr CmdHdr; |
| 84 | struct BootSequence PcBootSequence; |
| 85 | } S1; |
| 86 | struct { |
Alan Cox | 74769ab | 2006-03-24 03:18:24 -0800 | [diff] [blame] | 87 | u16 PcSequence; |
| 88 | u8 PcBootData[RTA_BOOT_DATA_SIZE]; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 89 | } S2; |
| 90 | struct { |
Alan Cox | 74769ab | 2006-03-24 03:18:24 -0800 | [diff] [blame] | 91 | u16 __crud__; |
| 92 | u8 PcUniqNum[4]; /* this is really a uint. */ |
| 93 | u8 PcModuleTypes; /* what modules are fitted */ |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 94 | } S3; |
| 95 | struct { |
| 96 | struct CmdHdr CmdHdr; |
Alan Cox | 74769ab | 2006-03-24 03:18:24 -0800 | [diff] [blame] | 97 | 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 Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 103 | } S4; |
| 104 | struct { |
| 105 | struct CmdHdr CmdHdr; |
Alan Cox | 74769ab | 2006-03-24 03:18:24 -0800 | [diff] [blame] | 106 | u8 PcCommandText[1]; |
| 107 | u8 __crud__[20]; |
| 108 | u8 PcIDNum2; /* It had to go somewhere! */ |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 109 | } S5; |
| 110 | struct { |
| 111 | struct CmdHdr CmdHdr; |
| 112 | struct SamTop Topology[LINKS_PER_UNIT]; |
| 113 | } S6; |
| 114 | } U1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | }; |
| 116 | |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 117 | struct PktCmd_M { |
| 118 | union { |
| 119 | struct { |
| 120 | struct { |
Alan Cox | 27c6e52 | 2006-03-24 03:18:26 -0800 | [diff] [blame] | 121 | u8 PcCommand; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 122 | union { |
Alan Cox | 27c6e52 | 2006-03-24 03:18:26 -0800 | [diff] [blame] | 123 | u8 PcPhbNum; |
| 124 | u8 PcLinkNum; |
| 125 | u8 PcIDNum; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 126 | } U0; |
| 127 | } CmdHdr; |
| 128 | struct { |
Alan Cox | 27c6e52 | 2006-03-24 03:18:26 -0800 | [diff] [blame] | 129 | u16 NumPackets; |
| 130 | u16 LoadBase; |
| 131 | u16 CodeSize; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 132 | } PcBootSequence; |
| 133 | } S1; |
| 134 | struct { |
Alan Cox | 27c6e52 | 2006-03-24 03:18:26 -0800 | [diff] [blame] | 135 | u16 PcSequence; |
| 136 | u8 PcBootData[RTA_BOOT_DATA_SIZE]; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 137 | } S2; |
| 138 | struct { |
Alan Cox | 27c6e52 | 2006-03-24 03:18:26 -0800 | [diff] [blame] | 139 | u16 __crud__; |
| 140 | u8 PcUniqNum[4]; /* this is really a uint. */ |
| 141 | u8 PcModuleTypes; /* what modules are fitted */ |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 142 | } S3; |
| 143 | struct { |
Alan Cox | 27c6e52 | 2006-03-24 03:18:26 -0800 | [diff] [blame] | 144 | u16 __cmd_hdr__; |
| 145 | u8 __undefined__; |
| 146 | u8 PcModemStatus; |
| 147 | u8 PcPortStatus; |
| 148 | u8 PcSubCommand; |
| 149 | u16 PcSubAddr; |
| 150 | u8 PcSubData[64]; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 151 | } S4; |
| 152 | struct { |
Alan Cox | 27c6e52 | 2006-03-24 03:18:26 -0800 | [diff] [blame] | 153 | u16 __cmd_hdr__; |
| 154 | u8 PcCommandText[1]; |
| 155 | u8 __crud__[20]; |
| 156 | u8 PcIDNum2; /* Tacked on end */ |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 157 | } S5; |
| 158 | struct { |
Alan Cox | 27c6e52 | 2006-03-24 03:18:26 -0800 | [diff] [blame] | 159 | u16 __cmd_hdr__; |
Andrew Morton | 8d8706e | 2006-01-11 12:17:49 -0800 | [diff] [blame] | 160 | struct Top Topology[LINKS_PER_UNIT]; |
| 161 | } S6; |
| 162 | } U1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | }; |
| 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 |