aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/ieee1394_transactions.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/ieee1394_transactions.c')
-rw-r--r--drivers/ieee1394/ieee1394_transactions.c389
1 files changed, 196 insertions, 193 deletions
diff --git a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c
index 0aa876360f9b..3fe2f6c4a253 100644
--- a/drivers/ieee1394/ieee1394_transactions.c
+++ b/drivers/ieee1394/ieee1394_transactions.c
@@ -22,7 +22,7 @@
22#include "ieee1394_core.h" 22#include "ieee1394_core.h"
23#include "highlevel.h" 23#include "highlevel.h"
24#include "nodemgr.h" 24#include "nodemgr.h"
25 25#include "ieee1394_transactions.h"
26 26
27#define PREP_ASYNC_HEAD_ADDRESS(tc) \ 27#define PREP_ASYNC_HEAD_ADDRESS(tc) \
28 packet->tcode = tc; \ 28 packet->tcode = tc; \
@@ -31,80 +31,82 @@
31 packet->header[1] = (packet->host->node_id << 16) | (addr >> 32); \ 31 packet->header[1] = (packet->host->node_id << 16) | (addr >> 32); \
32 packet->header[2] = addr & 0xffffffff 32 packet->header[2] = addr & 0xffffffff
33 33
34
35static void fill_async_readquad(struct hpsb_packet *packet, u64 addr) 34static void fill_async_readquad(struct hpsb_packet *packet, u64 addr)
36{ 35{
37 PREP_ASYNC_HEAD_ADDRESS(TCODE_READQ); 36 PREP_ASYNC_HEAD_ADDRESS(TCODE_READQ);
38 packet->header_size = 12; 37 packet->header_size = 12;
39 packet->data_size = 0; 38 packet->data_size = 0;
40 packet->expect_response = 1; 39 packet->expect_response = 1;
41} 40}
42 41
43static void fill_async_readblock(struct hpsb_packet *packet, u64 addr, int length) 42static void fill_async_readblock(struct hpsb_packet *packet, u64 addr,
43 int length)
44{ 44{
45 PREP_ASYNC_HEAD_ADDRESS(TCODE_READB); 45 PREP_ASYNC_HEAD_ADDRESS(TCODE_READB);
46 packet->header[3] = length << 16; 46 packet->header[3] = length << 16;
47 packet->header_size = 16; 47 packet->header_size = 16;
48 packet->data_size = 0; 48 packet->data_size = 0;
49 packet->expect_response = 1; 49 packet->expect_response = 1;
50} 50}
51 51
52static void fill_async_writequad(struct hpsb_packet *packet, u64 addr, quadlet_t data) 52static void fill_async_writequad(struct hpsb_packet *packet, u64 addr,
53 quadlet_t data)
53{ 54{
54 PREP_ASYNC_HEAD_ADDRESS(TCODE_WRITEQ); 55 PREP_ASYNC_HEAD_ADDRESS(TCODE_WRITEQ);
55 packet->header[3] = data; 56 packet->header[3] = data;
56 packet->header_size = 16; 57 packet->header_size = 16;
57 packet->data_size = 0; 58 packet->data_size = 0;
58 packet->expect_response = 1; 59 packet->expect_response = 1;
59} 60}
60 61
61static void fill_async_writeblock(struct hpsb_packet *packet, u64 addr, int length) 62static void fill_async_writeblock(struct hpsb_packet *packet, u64 addr,
63 int length)
62{ 64{
63 PREP_ASYNC_HEAD_ADDRESS(TCODE_WRITEB); 65 PREP_ASYNC_HEAD_ADDRESS(TCODE_WRITEB);
64 packet->header[3] = length << 16; 66 packet->header[3] = length << 16;
65 packet->header_size = 16; 67 packet->header_size = 16;
66 packet->expect_response = 1; 68 packet->expect_response = 1;
67 packet->data_size = length + (length % 4 ? 4 - (length % 4) : 0); 69 packet->data_size = length + (length % 4 ? 4 - (length % 4) : 0);
68} 70}
69 71
70static void fill_async_lock(struct hpsb_packet *packet, u64 addr, int extcode, 72static void fill_async_lock(struct hpsb_packet *packet, u64 addr, int extcode,
71 int length) 73 int length)
72{ 74{
73 PREP_ASYNC_HEAD_ADDRESS(TCODE_LOCK_REQUEST); 75 PREP_ASYNC_HEAD_ADDRESS(TCODE_LOCK_REQUEST);
74 packet->header[3] = (length << 16) | extcode; 76 packet->header[3] = (length << 16) | extcode;
75 packet->header_size = 16; 77 packet->header_size = 16;
76 packet->data_size = length; 78 packet->data_size = length;
77 packet->expect_response = 1; 79 packet->expect_response = 1;
78} 80}
79 81
80static void fill_iso_packet(struct hpsb_packet *packet, int length, int channel, 82static void fill_iso_packet(struct hpsb_packet *packet, int length, int channel,
81 int tag, int sync) 83 int tag, int sync)
82{ 84{
83 packet->header[0] = (length << 16) | (tag << 14) | (channel << 8) 85 packet->header[0] = (length << 16) | (tag << 14) | (channel << 8)
84 | (TCODE_ISO_DATA << 4) | sync; 86 | (TCODE_ISO_DATA << 4) | sync;
85 87
86 packet->header_size = 4; 88 packet->header_size = 4;
87 packet->data_size = length; 89 packet->data_size = length;
88 packet->type = hpsb_iso; 90 packet->type = hpsb_iso;
89 packet->tcode = TCODE_ISO_DATA; 91 packet->tcode = TCODE_ISO_DATA;
90} 92}
91 93
92static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data) 94static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data)
93{ 95{
94 packet->header[0] = data; 96 packet->header[0] = data;
95 packet->header[1] = ~data; 97 packet->header[1] = ~data;
96 packet->header_size = 8; 98 packet->header_size = 8;
97 packet->data_size = 0; 99 packet->data_size = 0;
98 packet->expect_response = 0; 100 packet->expect_response = 0;
99 packet->type = hpsb_raw; /* No CRC added */ 101 packet->type = hpsb_raw; /* No CRC added */
100 packet->speed_code = IEEE1394_SPEED_100; /* Force speed to be 100Mbps */ 102 packet->speed_code = IEEE1394_SPEED_100; /* Force speed to be 100Mbps */
101} 103}
102 104
103static void fill_async_stream_packet(struct hpsb_packet *packet, int length, 105static void fill_async_stream_packet(struct hpsb_packet *packet, int length,
104 int channel, int tag, int sync) 106 int channel, int tag, int sync)
105{ 107{
106 packet->header[0] = (length << 16) | (tag << 14) | (channel << 8) 108 packet->header[0] = (length << 16) | (tag << 14) | (channel << 8)
107 | (TCODE_STREAM_DATA << 4) | sync; 109 | (TCODE_STREAM_DATA << 4) | sync;
108 110
109 packet->header_size = 4; 111 packet->header_size = 4;
110 packet->data_size = length; 112 packet->data_size = length;
@@ -171,99 +173,96 @@ int hpsb_get_tlabel(struct hpsb_packet *packet)
171 */ 173 */
172void hpsb_free_tlabel(struct hpsb_packet *packet) 174void hpsb_free_tlabel(struct hpsb_packet *packet)
173{ 175{
174 unsigned long flags; 176 unsigned long flags;
175 struct hpsb_tlabel_pool *tp; 177 struct hpsb_tlabel_pool *tp;
176 178
177 tp = &packet->host->tpool[packet->node_id & NODE_MASK]; 179 tp = &packet->host->tpool[packet->node_id & NODE_MASK];
178 180
179 BUG_ON(packet->tlabel > 63 || packet->tlabel < 0); 181 BUG_ON(packet->tlabel > 63 || packet->tlabel < 0);
180 182
181 spin_lock_irqsave(&tp->lock, flags); 183 spin_lock_irqsave(&tp->lock, flags);
182 BUG_ON(!test_and_clear_bit(packet->tlabel, tp->pool)); 184 BUG_ON(!test_and_clear_bit(packet->tlabel, tp->pool));
183 spin_unlock_irqrestore(&tp->lock, flags); 185 spin_unlock_irqrestore(&tp->lock, flags);
184 186
185 up(&tp->count); 187 up(&tp->count);
186} 188}
187 189
188
189
190int hpsb_packet_success(struct hpsb_packet *packet) 190int hpsb_packet_success(struct hpsb_packet *packet)
191{ 191{
192 switch (packet->ack_code) { 192 switch (packet->ack_code) {
193 case ACK_PENDING: 193 case ACK_PENDING:
194 switch ((packet->header[1] >> 12) & 0xf) { 194 switch ((packet->header[1] >> 12) & 0xf) {
195 case RCODE_COMPLETE: 195 case RCODE_COMPLETE:
196 return 0; 196 return 0;
197 case RCODE_CONFLICT_ERROR: 197 case RCODE_CONFLICT_ERROR:
198 return -EAGAIN; 198 return -EAGAIN;
199 case RCODE_DATA_ERROR: 199 case RCODE_DATA_ERROR:
200 return -EREMOTEIO; 200 return -EREMOTEIO;
201 case RCODE_TYPE_ERROR: 201 case RCODE_TYPE_ERROR:
202 return -EACCES; 202 return -EACCES;
203 case RCODE_ADDRESS_ERROR: 203 case RCODE_ADDRESS_ERROR:
204 return -EINVAL; 204 return -EINVAL;
205 default: 205 default:
206 HPSB_ERR("received reserved rcode %d from node %d", 206 HPSB_ERR("received reserved rcode %d from node %d",
207 (packet->header[1] >> 12) & 0xf, 207 (packet->header[1] >> 12) & 0xf,
208 packet->node_id); 208 packet->node_id);
209 return -EAGAIN; 209 return -EAGAIN;
210 } 210 }
211 HPSB_PANIC("reached unreachable code 1 in %s", __FUNCTION__); 211 HPSB_PANIC("reached unreachable code 1 in %s", __FUNCTION__);
212 212
213 case ACK_BUSY_X: 213 case ACK_BUSY_X:
214 case ACK_BUSY_A: 214 case ACK_BUSY_A:
215 case ACK_BUSY_B: 215 case ACK_BUSY_B:
216 return -EBUSY; 216 return -EBUSY;
217 217
218 case ACK_TYPE_ERROR: 218 case ACK_TYPE_ERROR:
219 return -EACCES; 219 return -EACCES;
220 220
221 case ACK_COMPLETE: 221 case ACK_COMPLETE:
222 if (packet->tcode == TCODE_WRITEQ 222 if (packet->tcode == TCODE_WRITEQ
223 || packet->tcode == TCODE_WRITEB) { 223 || packet->tcode == TCODE_WRITEB) {
224 return 0; 224 return 0;
225 } else { 225 } else {
226 HPSB_ERR("impossible ack_complete from node %d " 226 HPSB_ERR("impossible ack_complete from node %d "
227 "(tcode %d)", packet->node_id, packet->tcode); 227 "(tcode %d)", packet->node_id, packet->tcode);
228 return -EAGAIN; 228 return -EAGAIN;
229 } 229 }
230 230
231 231 case ACK_DATA_ERROR:
232 case ACK_DATA_ERROR: 232 if (packet->tcode == TCODE_WRITEB
233 if (packet->tcode == TCODE_WRITEB 233 || packet->tcode == TCODE_LOCK_REQUEST) {
234 || packet->tcode == TCODE_LOCK_REQUEST) { 234 return -EAGAIN;
235 return -EAGAIN; 235 } else {
236 } else { 236 HPSB_ERR("impossible ack_data_error from node %d "
237 HPSB_ERR("impossible ack_data_error from node %d " 237 "(tcode %d)", packet->node_id, packet->tcode);
238 "(tcode %d)", packet->node_id, packet->tcode); 238 return -EAGAIN;
239 return -EAGAIN; 239 }
240 } 240
241 241 case ACK_ADDRESS_ERROR:
242 case ACK_ADDRESS_ERROR: 242 return -EINVAL;
243 return -EINVAL; 243
244 244 case ACK_TARDY:
245 case ACK_TARDY: 245 case ACK_CONFLICT_ERROR:
246 case ACK_CONFLICT_ERROR: 246 case ACKX_NONE:
247 case ACKX_NONE: 247 case ACKX_SEND_ERROR:
248 case ACKX_SEND_ERROR: 248 case ACKX_ABORTED:
249 case ACKX_ABORTED: 249 case ACKX_TIMEOUT:
250 case ACKX_TIMEOUT: 250 /* error while sending */
251 /* error while sending */ 251 return -EAGAIN;
252 return -EAGAIN; 252
253 253 default:
254 default: 254 HPSB_ERR("got invalid ack %d from node %d (tcode %d)",
255 HPSB_ERR("got invalid ack %d from node %d (tcode %d)", 255 packet->ack_code, packet->node_id, packet->tcode);
256 packet->ack_code, packet->node_id, packet->tcode); 256 return -EAGAIN;
257 return -EAGAIN; 257 }
258 } 258
259 259 HPSB_PANIC("reached unreachable code 2 in %s", __FUNCTION__);
260 HPSB_PANIC("reached unreachable code 2 in %s", __FUNCTION__);
261} 260}
262 261
263struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, 262struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
264 u64 addr, size_t length) 263 u64 addr, size_t length)
265{ 264{
266 struct hpsb_packet *packet; 265 struct hpsb_packet *packet;
267 266
268 if (length == 0) 267 if (length == 0)
269 return NULL; 268 return NULL;
@@ -288,8 +287,9 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
288 return packet; 287 return packet;
289} 288}
290 289
291struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node, 290struct hpsb_packet *hpsb_make_writepacket(struct hpsb_host *host, nodeid_t node,
292 u64 addr, quadlet_t *buffer, size_t length) 291 u64 addr, quadlet_t * buffer,
292 size_t length)
293{ 293{
294 struct hpsb_packet *packet; 294 struct hpsb_packet *packet;
295 295
@@ -300,7 +300,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node
300 if (!packet) 300 if (!packet)
301 return NULL; 301 return NULL;
302 302
303 if (length % 4) { /* zero padding bytes */ 303 if (length % 4) { /* zero padding bytes */
304 packet->data[length >> 2] = 0; 304 packet->data[length >> 2] = 0;
305 } 305 }
306 packet->host = host; 306 packet->host = host;
@@ -322,8 +322,9 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node
322 return packet; 322 return packet;
323} 323}
324 324
325struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, int length, 325struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 * buffer,
326 int channel, int tag, int sync) 326 int length, int channel, int tag,
327 int sync)
327{ 328{
328 struct hpsb_packet *packet; 329 struct hpsb_packet *packet;
329 330
@@ -334,7 +335,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
334 if (!packet) 335 if (!packet)
335 return NULL; 336 return NULL;
336 337
337 if (length % 4) { /* zero padding bytes */ 338 if (length % 4) { /* zero padding bytes */
338 packet->data[length >> 2] = 0; 339 packet->data[length >> 2] = 0;
339 } 340 }
340 packet->host = host; 341 packet->host = host;
@@ -352,14 +353,15 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
352} 353}
353 354
354struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, 355struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
355 u64 addr, int extcode, quadlet_t *data, 356 u64 addr, int extcode,
356 quadlet_t arg) 357 quadlet_t * data, quadlet_t arg)
357{ 358{
358 struct hpsb_packet *p; 359 struct hpsb_packet *p;
359 u32 length; 360 u32 length;
360 361
361 p = hpsb_alloc_packet(8); 362 p = hpsb_alloc_packet(8);
362 if (!p) return NULL; 363 if (!p)
364 return NULL;
363 365
364 p->host = host; 366 p->host = host;
365 p->node_id = node; 367 p->node_id = node;
@@ -388,15 +390,16 @@ struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
388 return p; 390 return p;
389} 391}
390 392
391struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node, 393struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host,
392 u64 addr, int extcode, octlet_t *data, 394 nodeid_t node, u64 addr, int extcode,
393 octlet_t arg) 395 octlet_t * data, octlet_t arg)
394{ 396{
395 struct hpsb_packet *p; 397 struct hpsb_packet *p;
396 u32 length; 398 u32 length;
397 399
398 p = hpsb_alloc_packet(16); 400 p = hpsb_alloc_packet(16);
399 if (!p) return NULL; 401 if (!p)
402 return NULL;
400 403
401 p->host = host; 404 p->host = host;
402 p->node_id = node; 405 p->node_id = node;
@@ -429,18 +432,18 @@ struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node
429 return p; 432 return p;
430} 433}
431 434
432struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, 435struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data)
433 quadlet_t data)
434{ 436{
435 struct hpsb_packet *p; 437 struct hpsb_packet *p;
436 438
437 p = hpsb_alloc_packet(0); 439 p = hpsb_alloc_packet(0);
438 if (!p) return NULL; 440 if (!p)
441 return NULL;
439 442
440 p->host = host; 443 p->host = host;
441 fill_phy_packet(p, data); 444 fill_phy_packet(p, data);
442 445
443 return p; 446 return p;
444} 447}
445 448
446struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, 449struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host,
@@ -450,7 +453,8 @@ struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host,
450 struct hpsb_packet *p; 453 struct hpsb_packet *p;
451 454
452 p = hpsb_alloc_packet(length); 455 p = hpsb_alloc_packet(length);
453 if (!p) return NULL; 456 if (!p)
457 return NULL;
454 458
455 p->host = host; 459 p->host = host;
456 fill_iso_packet(p, length, channel, tag, sync); 460 fill_iso_packet(p, length, channel, tag, sync);
@@ -466,47 +470,46 @@ struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host,
466 */ 470 */
467 471
468int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, 472int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
469 u64 addr, quadlet_t *buffer, size_t length) 473 u64 addr, quadlet_t * buffer, size_t length)
470{ 474{
471 struct hpsb_packet *packet; 475 struct hpsb_packet *packet;
472 int retval = 0; 476 int retval = 0;
473 477
474 if (length == 0) 478 if (length == 0)
475 return -EINVAL; 479 return -EINVAL;
476 480
477 BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet 481 BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet
478 482
479 packet = hpsb_make_readpacket(host, node, addr, length); 483 packet = hpsb_make_readpacket(host, node, addr, length);
480 484
481 if (!packet) { 485 if (!packet) {
482 return -ENOMEM; 486 return -ENOMEM;
483 } 487 }
484 488
485 packet->generation = generation; 489 packet->generation = generation;
486 retval = hpsb_send_packet_and_wait(packet); 490 retval = hpsb_send_packet_and_wait(packet);
487 if (retval < 0) 491 if (retval < 0)
488 goto hpsb_read_fail; 492 goto hpsb_read_fail;
489 493
490 retval = hpsb_packet_success(packet); 494 retval = hpsb_packet_success(packet);
491 495
492 if (retval == 0) { 496 if (retval == 0) {
493 if (length == 4) { 497 if (length == 4) {
494 *buffer = packet->header[3]; 498 *buffer = packet->header[3];
495 } else { 499 } else {
496 memcpy(buffer, packet->data, length); 500 memcpy(buffer, packet->data, length);
497 } 501 }
498 } 502 }
499 503
500hpsb_read_fail: 504 hpsb_read_fail:
501 hpsb_free_tlabel(packet); 505 hpsb_free_tlabel(packet);
502 hpsb_free_packet(packet); 506 hpsb_free_packet(packet);
503 507
504 return retval; 508 return retval;
505} 509}
506 510
507
508int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, 511int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
509 u64 addr, quadlet_t *buffer, size_t length) 512 u64 addr, quadlet_t * buffer, size_t length)
510{ 513{
511 struct hpsb_packet *packet; 514 struct hpsb_packet *packet;
512 int retval; 515 int retval;
@@ -514,62 +517,61 @@ int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
514 if (length == 0) 517 if (length == 0)
515 return -EINVAL; 518 return -EINVAL;
516 519
517 BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet 520 BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet
518 521
519 packet = hpsb_make_writepacket (host, node, addr, buffer, length); 522 packet = hpsb_make_writepacket(host, node, addr, buffer, length);
520 523
521 if (!packet) 524 if (!packet)
522 return -ENOMEM; 525 return -ENOMEM;
523 526
524 packet->generation = generation; 527 packet->generation = generation;
525 retval = hpsb_send_packet_and_wait(packet); 528 retval = hpsb_send_packet_and_wait(packet);
526 if (retval < 0) 529 if (retval < 0)
527 goto hpsb_write_fail; 530 goto hpsb_write_fail;
528 531
529 retval = hpsb_packet_success(packet); 532 retval = hpsb_packet_success(packet);
530 533
531hpsb_write_fail: 534 hpsb_write_fail:
532 hpsb_free_tlabel(packet); 535 hpsb_free_tlabel(packet);
533 hpsb_free_packet(packet); 536 hpsb_free_packet(packet);
534 537
535 return retval; 538 return retval;
536} 539}
537 540
538#if 0 541#if 0
539 542
540int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation, 543int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
541 u64 addr, int extcode, quadlet_t *data, quadlet_t arg) 544 u64 addr, int extcode, quadlet_t * data, quadlet_t arg)
542{ 545{
543 struct hpsb_packet *packet; 546 struct hpsb_packet *packet;
544 int retval = 0; 547 int retval = 0;
545 548
546 BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet 549 BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet
547 550
548 packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg); 551 packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg);
549 if (!packet) 552 if (!packet)
550 return -ENOMEM; 553 return -ENOMEM;
551 554
552 packet->generation = generation; 555 packet->generation = generation;
553 retval = hpsb_send_packet_and_wait(packet); 556 retval = hpsb_send_packet_and_wait(packet);
554 if (retval < 0) 557 if (retval < 0)
555 goto hpsb_lock_fail; 558 goto hpsb_lock_fail;
556 559
557 retval = hpsb_packet_success(packet); 560 retval = hpsb_packet_success(packet);
558 561
559 if (retval == 0) { 562 if (retval == 0) {
560 *data = packet->data[0]; 563 *data = packet->data[0];
561 } 564 }
562 565
563hpsb_lock_fail: 566 hpsb_lock_fail:
564 hpsb_free_tlabel(packet); 567 hpsb_free_tlabel(packet);
565 hpsb_free_packet(packet); 568 hpsb_free_packet(packet);
566 569
567 return retval; 570 return retval;
568} 571}
569 572
570
571int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation, 573int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation,
572 quadlet_t *buffer, size_t length, u32 specifier_id, 574 quadlet_t * buffer, size_t length, u32 specifier_id,
573 unsigned int version) 575 unsigned int version)
574{ 576{
575 struct hpsb_packet *packet; 577 struct hpsb_packet *packet;
@@ -586,7 +588,8 @@ int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation,
586 return -ENOMEM; 588 return -ENOMEM;
587 589
588 packet->data[0] = cpu_to_be32((host->node_id << 16) | specifier_id_hi); 590 packet->data[0] = cpu_to_be32((host->node_id << 16) | specifier_id_hi);
589 packet->data[1] = cpu_to_be32((specifier_id_lo << 24) | (version & 0x00ffffff)); 591 packet->data[1] =
592 cpu_to_be32((specifier_id_lo << 24) | (version & 0x00ffffff));
590 593
591 memcpy(&(packet->data[2]), buffer, length - 8); 594 memcpy(&(packet->data[2]), buffer, length - 8);
592 595
@@ -601,4 +604,4 @@ int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation,
601 return retval; 604 return retval;
602} 605}
603 606
604#endif /* 0 */ 607#endif /* 0 */