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