diff options
author | Markus Lidel <Markus.Lidel@shadowconnect.com> | 2006-01-06 03:19:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:53 -0500 |
commit | 793fd15d9fafe5b1c71e50d3c041f1463895dbde (patch) | |
tree | a19f3f17b435a3600d19f5a5ee2136b2d3646987 /drivers/message/i2o | |
parent | a1a5ea70a6e9db6332b27fe2d96666e17aa1436b (diff) |
[PATCH] I2O: SPARC fixes
Fix lot of BE <-> LE bugs which prevent it from working on SPARC.
Signed-off-by: Markus Lidel <Markus.Lidel@shadowconnect.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/message/i2o')
-rw-r--r-- | drivers/message/i2o/Kconfig | 12 | ||||
-rw-r--r-- | drivers/message/i2o/device.c | 130 | ||||
-rw-r--r-- | drivers/message/i2o/exec-osm.c | 15 | ||||
-rw-r--r-- | drivers/message/i2o/i2o_block.c | 20 | ||||
-rw-r--r-- | drivers/message/i2o/i2o_scsi.c | 35 |
5 files changed, 111 insertions, 101 deletions
diff --git a/drivers/message/i2o/Kconfig b/drivers/message/i2o/Kconfig index 43a942a29c2e..fef677103880 100644 --- a/drivers/message/i2o/Kconfig +++ b/drivers/message/i2o/Kconfig | |||
@@ -24,6 +24,18 @@ config I2O | |||
24 | 24 | ||
25 | If unsure, say N. | 25 | If unsure, say N. |
26 | 26 | ||
27 | config I2O_LCT_NOTIFY_ON_CHANGES | ||
28 | bool "Enable LCT notification" | ||
29 | depends on I2O | ||
30 | default y | ||
31 | ---help--- | ||
32 | Only say N here if you have a I2O controller from SUN. The SUN | ||
33 | firmware doesn't support LCT notification on changes. If this option | ||
34 | is enabled on such a controller the driver will hang up in a endless | ||
35 | loop. On all other controllers say Y. | ||
36 | |||
37 | If unsure, say Y. | ||
38 | |||
27 | config I2O_EXT_ADAPTEC | 39 | config I2O_EXT_ADAPTEC |
28 | bool "Enable Adaptec extensions" | 40 | bool "Enable Adaptec extensions" |
29 | depends on I2O | 41 | depends on I2O |
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c index 002ae0ed8966..1db26215937f 100644 --- a/drivers/message/i2o/device.c +++ b/drivers/message/i2o/device.c | |||
@@ -341,56 +341,83 @@ int i2o_device_parse_lct(struct i2o_controller *c) | |||
341 | { | 341 | { |
342 | struct i2o_device *dev, *tmp; | 342 | struct i2o_device *dev, *tmp; |
343 | i2o_lct *lct; | 343 | i2o_lct *lct; |
344 | int i; | 344 | u32 *dlct = c->dlct.virt; |
345 | int max; | 345 | int max = 0, i = 0; |
346 | u16 table_size; | ||
347 | u32 buf; | ||
346 | 348 | ||
347 | down(&c->lct_lock); | 349 | down(&c->lct_lock); |
348 | 350 | ||
349 | kfree(c->lct); | 351 | kfree(c->lct); |
350 | 352 | ||
351 | lct = c->dlct.virt; | 353 | buf = le32_to_cpu(*dlct++); |
354 | table_size = buf & 0xffff; | ||
352 | 355 | ||
353 | c->lct = kmalloc(lct->table_size * 4, GFP_KERNEL); | 356 | lct = c->lct = kmalloc(table_size * 4, GFP_KERNEL); |
354 | if (!c->lct) { | 357 | if (!lct) { |
355 | up(&c->lct_lock); | 358 | up(&c->lct_lock); |
356 | return -ENOMEM; | 359 | return -ENOMEM; |
357 | } | 360 | } |
358 | 361 | ||
359 | if (lct->table_size * 4 > c->dlct.len) { | 362 | lct->lct_ver = buf >> 28; |
360 | memcpy(c->lct, c->dlct.virt, c->dlct.len); | 363 | lct->boot_tid = buf >> 16 & 0xfff; |
361 | up(&c->lct_lock); | 364 | lct->table_size = table_size; |
362 | return -EAGAIN; | 365 | lct->change_ind = le32_to_cpu(*dlct++); |
363 | } | 366 | lct->iop_flags = le32_to_cpu(*dlct++); |
364 | |||
365 | memcpy(c->lct, c->dlct.virt, lct->table_size * 4); | ||
366 | 367 | ||
367 | lct = c->lct; | 368 | table_size -= 3; |
368 | |||
369 | max = (lct->table_size - 3) / 9; | ||
370 | 369 | ||
371 | pr_debug("%s: LCT has %d entries (LCT size: %d)\n", c->name, max, | 370 | pr_debug("%s: LCT has %d entries (LCT size: %d)\n", c->name, max, |
372 | lct->table_size); | 371 | lct->table_size); |
373 | 372 | ||
374 | /* remove devices, which are not in the LCT anymore */ | 373 | while (table_size > 0) { |
375 | list_for_each_entry_safe(dev, tmp, &c->devices, list) { | 374 | i2o_lct_entry *entry = &lct->lct_entry[max]; |
376 | int found = 0; | 375 | int found = 0; |
377 | 376 | ||
378 | for (i = 0; i < max; i++) { | 377 | buf = le32_to_cpu(*dlct++); |
379 | if (lct->lct_entry[i].tid == dev->lct_data.tid) { | 378 | entry->entry_size = buf & 0xffff; |
379 | entry->tid = buf >> 16 & 0xfff; | ||
380 | |||
381 | entry->change_ind = le32_to_cpu(*dlct++); | ||
382 | entry->device_flags = le32_to_cpu(*dlct++); | ||
383 | |||
384 | buf = le32_to_cpu(*dlct++); | ||
385 | entry->class_id = buf & 0xfff; | ||
386 | entry->version = buf >> 12 & 0xf; | ||
387 | entry->vendor_id = buf >> 16; | ||
388 | |||
389 | entry->sub_class = le32_to_cpu(*dlct++); | ||
390 | |||
391 | buf = le32_to_cpu(*dlct++); | ||
392 | entry->user_tid = buf & 0xfff; | ||
393 | entry->parent_tid = buf >> 12 & 0xfff; | ||
394 | entry->bios_info = buf >> 24; | ||
395 | |||
396 | memcpy(&entry->identity_tag, dlct, 8); | ||
397 | dlct += 2; | ||
398 | |||
399 | entry->event_capabilities = le32_to_cpu(*dlct++); | ||
400 | |||
401 | /* add new devices, which are new in the LCT */ | ||
402 | list_for_each_entry_safe(dev, tmp, &c->devices, list) { | ||
403 | if (entry->tid == dev->lct_data.tid) { | ||
380 | found = 1; | 404 | found = 1; |
381 | break; | 405 | break; |
382 | } | 406 | } |
383 | } | 407 | } |
384 | 408 | ||
385 | if (!found) | 409 | if (!found) |
386 | i2o_device_remove(dev); | 410 | i2o_device_add(c, entry); |
411 | |||
412 | table_size -= 9; | ||
413 | max++; | ||
387 | } | 414 | } |
388 | 415 | ||
389 | /* add new devices, which are new in the LCT */ | 416 | /* remove devices, which are not in the LCT anymore */ |
390 | for (i = 0; i < max; i++) { | 417 | list_for_each_entry_safe(dev, tmp, &c->devices, list) { |
391 | int found = 0; | 418 | int found = 0; |
392 | 419 | ||
393 | list_for_each_entry_safe(dev, tmp, &c->devices, list) { | 420 | for (i = 0; i < max; i++) { |
394 | if (lct->lct_entry[i].tid == dev->lct_data.tid) { | 421 | if (lct->lct_entry[i].tid == dev->lct_data.tid) { |
395 | found = 1; | 422 | found = 1; |
396 | break; | 423 | break; |
@@ -398,8 +425,9 @@ int i2o_device_parse_lct(struct i2o_controller *c) | |||
398 | } | 425 | } |
399 | 426 | ||
400 | if (!found) | 427 | if (!found) |
401 | i2o_device_add(c, &lct->lct_entry[i]); | 428 | i2o_device_remove(dev); |
402 | } | 429 | } |
430 | |||
403 | up(&c->lct_lock); | 431 | up(&c->lct_lock); |
404 | 432 | ||
405 | return 0; | 433 | return 0; |
@@ -422,9 +450,6 @@ int i2o_parm_issue(struct i2o_device *i2o_dev, int cmd, void *oplist, | |||
422 | int oplen, void *reslist, int reslen) | 450 | int oplen, void *reslist, int reslen) |
423 | { | 451 | { |
424 | struct i2o_message *msg; | 452 | struct i2o_message *msg; |
425 | u32 *res32 = (u32 *) reslist; | ||
426 | u32 *restmp = (u32 *) reslist; | ||
427 | int len = 0; | ||
428 | int i = 0; | 453 | int i = 0; |
429 | int rc; | 454 | int rc; |
430 | struct i2o_dma res; | 455 | struct i2o_dma res; |
@@ -448,7 +473,6 @@ int i2o_parm_issue(struct i2o_device *i2o_dev, int cmd, void *oplist, | |||
448 | msg->body[i++] = cpu_to_le32(0x00000000); | 473 | msg->body[i++] = cpu_to_le32(0x00000000); |
449 | msg->body[i++] = cpu_to_le32(0x4C000000 | oplen); /* OperationList */ | 474 | msg->body[i++] = cpu_to_le32(0x4C000000 | oplen); /* OperationList */ |
450 | memcpy(&msg->body[i], oplist, oplen); | 475 | memcpy(&msg->body[i], oplist, oplen); |
451 | |||
452 | i += (oplen / 4 + (oplen % 4 ? 1 : 0)); | 476 | i += (oplen / 4 + (oplen % 4 ? 1 : 0)); |
453 | msg->body[i++] = cpu_to_le32(0xD0000000 | res.len); /* ResultList */ | 477 | msg->body[i++] = cpu_to_le32(0xD0000000 | res.len); /* ResultList */ |
454 | msg->body[i++] = cpu_to_le32(res.phys); | 478 | msg->body[i++] = cpu_to_le32(res.phys); |
@@ -466,36 +490,7 @@ int i2o_parm_issue(struct i2o_device *i2o_dev, int cmd, void *oplist, | |||
466 | memcpy(reslist, res.virt, res.len); | 490 | memcpy(reslist, res.virt, res.len); |
467 | i2o_dma_free(dev, &res); | 491 | i2o_dma_free(dev, &res); |
468 | 492 | ||
469 | /* Query failed */ | 493 | return rc; |
470 | if (rc) | ||
471 | return rc; | ||
472 | /* | ||
473 | * Calculate number of bytes of Result LIST | ||
474 | * We need to loop through each Result BLOCK and grab the length | ||
475 | */ | ||
476 | restmp = res32 + 1; | ||
477 | len = 1; | ||
478 | for (i = 0; i < (res32[0] & 0X0000FFFF); i++) { | ||
479 | if (restmp[0] & 0x00FF0000) { /* BlockStatus != SUCCESS */ | ||
480 | printk(KERN_WARNING | ||
481 | "%s - Error:\n ErrorInfoSize = 0x%02x, " | ||
482 | "BlockStatus = 0x%02x, BlockSize = 0x%04x\n", | ||
483 | (cmd == | ||
484 | I2O_CMD_UTIL_PARAMS_SET) ? "PARAMS_SET" : | ||
485 | "PARAMS_GET", res32[1] >> 24, | ||
486 | (res32[1] >> 16) & 0xFF, res32[1] & 0xFFFF); | ||
487 | |||
488 | /* | ||
489 | * If this is the only request,than we return an error | ||
490 | */ | ||
491 | if ((res32[0] & 0x0000FFFF) == 1) { | ||
492 | return -((res32[1] >> 16) & 0xFF); /* -BlockStatus */ | ||
493 | } | ||
494 | } | ||
495 | len += restmp[0] & 0x0000FFFF; /* Length of res BLOCK */ | ||
496 | restmp += restmp[0] & 0x0000FFFF; /* Skip to next BLOCK */ | ||
497 | } | ||
498 | return (len << 2); /* bytes used by result list */ | ||
499 | } | 494 | } |
500 | 495 | ||
501 | /* | 496 | /* |
@@ -504,28 +499,25 @@ int i2o_parm_issue(struct i2o_device *i2o_dev, int cmd, void *oplist, | |||
504 | int i2o_parm_field_get(struct i2o_device *i2o_dev, int group, int field, | 499 | int i2o_parm_field_get(struct i2o_device *i2o_dev, int group, int field, |
505 | void *buf, int buflen) | 500 | void *buf, int buflen) |
506 | { | 501 | { |
507 | u16 opblk[] = { 1, 0, I2O_PARAMS_FIELD_GET, group, 1, field }; | 502 | u32 opblk[] = { cpu_to_le32(0x00000001), |
503 | cpu_to_le32((u16) group << 16 | I2O_PARAMS_FIELD_GET), | ||
504 | cpu_to_le32((s16) field << 16 | 0x00000001) | ||
505 | }; | ||
508 | u8 *resblk; /* 8 bytes for header */ | 506 | u8 *resblk; /* 8 bytes for header */ |
509 | int size; | 507 | int rc; |
510 | |||
511 | if (field == -1) /* whole group */ | ||
512 | opblk[4] = -1; | ||
513 | 508 | ||
514 | resblk = kmalloc(buflen + 8, GFP_KERNEL | GFP_ATOMIC); | 509 | resblk = kmalloc(buflen + 8, GFP_KERNEL | GFP_ATOMIC); |
515 | if (!resblk) | 510 | if (!resblk) |
516 | return -ENOMEM; | 511 | return -ENOMEM; |
517 | 512 | ||
518 | size = i2o_parm_issue(i2o_dev, I2O_CMD_UTIL_PARAMS_GET, opblk, | 513 | rc = i2o_parm_issue(i2o_dev, I2O_CMD_UTIL_PARAMS_GET, opblk, |
519 | sizeof(opblk), resblk, buflen + 8); | 514 | sizeof(opblk), resblk, buflen + 8); |
520 | 515 | ||
521 | memcpy(buf, resblk + 8, buflen); /* cut off header */ | 516 | memcpy(buf, resblk + 8, buflen); /* cut off header */ |
522 | 517 | ||
523 | kfree(resblk); | 518 | kfree(resblk); |
524 | 519 | ||
525 | if (size > buflen) | 520 | return rc; |
526 | return buflen; | ||
527 | |||
528 | return size; | ||
529 | } | 521 | } |
530 | 522 | ||
531 | /* | 523 | /* |
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c index 71a09332e7c0..d24548f4c033 100644 --- a/drivers/message/i2o/exec-osm.c +++ b/drivers/message/i2o/exec-osm.c | |||
@@ -77,7 +77,7 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void) | |||
77 | 77 | ||
78 | wait = kmalloc(sizeof(*wait), GFP_KERNEL); | 78 | wait = kmalloc(sizeof(*wait), GFP_KERNEL); |
79 | if (!wait) | 79 | if (!wait) |
80 | return ERR_PTR(-ENOMEM); | 80 | return NULL; |
81 | 81 | ||
82 | memset(wait, 0, sizeof(*wait)); | 82 | memset(wait, 0, sizeof(*wait)); |
83 | 83 | ||
@@ -271,8 +271,8 @@ static ssize_t i2o_exec_show_vendor_id(struct device *d, | |||
271 | struct i2o_device *dev = to_i2o_device(d); | 271 | struct i2o_device *dev = to_i2o_device(d); |
272 | u16 id; | 272 | u16 id; |
273 | 273 | ||
274 | if (i2o_parm_field_get(dev, 0x0000, 0, &id, 2)) { | 274 | if (!i2o_parm_field_get(dev, 0x0000, 0, &id, 2)) { |
275 | sprintf(buf, "0x%04x", id); | 275 | sprintf(buf, "0x%04x", le16_to_cpu(id)); |
276 | return strlen(buf) + 1; | 276 | return strlen(buf) + 1; |
277 | } | 277 | } |
278 | 278 | ||
@@ -293,8 +293,8 @@ static ssize_t i2o_exec_show_product_id(struct device *d, | |||
293 | struct i2o_device *dev = to_i2o_device(d); | 293 | struct i2o_device *dev = to_i2o_device(d); |
294 | u16 id; | 294 | u16 id; |
295 | 295 | ||
296 | if (i2o_parm_field_get(dev, 0x0000, 1, &id, 2)) { | 296 | if (!i2o_parm_field_get(dev, 0x0000, 1, &id, 2)) { |
297 | sprintf(buf, "0x%04x", id); | 297 | sprintf(buf, "0x%04x", le16_to_cpu(id)); |
298 | return strlen(buf) + 1; | 298 | return strlen(buf) + 1; |
299 | } | 299 | } |
300 | 300 | ||
@@ -364,7 +364,9 @@ static void i2o_exec_lct_modified(struct i2o_controller *c) | |||
364 | if (i2o_device_parse_lct(c) != -EAGAIN) | 364 | if (i2o_device_parse_lct(c) != -EAGAIN) |
365 | change_ind = c->lct->change_ind + 1; | 365 | change_ind = c->lct->change_ind + 1; |
366 | 366 | ||
367 | #ifdef CONFIG_I2O_LCT_NOTIFY_ON_CHANGES | ||
367 | i2o_exec_lct_notify(c, change_ind); | 368 | i2o_exec_lct_notify(c, change_ind); |
369 | #endif | ||
368 | }; | 370 | }; |
369 | 371 | ||
370 | /** | 372 | /** |
@@ -512,7 +514,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) | |||
512 | 514 | ||
513 | dev = &c->pdev->dev; | 515 | dev = &c->pdev->dev; |
514 | 516 | ||
515 | if (i2o_dma_realloc(dev, &c->dlct, sb->expected_lct_size, GFP_KERNEL)) | 517 | if (i2o_dma_realloc |
518 | (dev, &c->dlct, le32_to_cpu(sb->expected_lct_size), GFP_KERNEL)) | ||
516 | return -ENOMEM; | 519 | return -ENOMEM; |
517 | 520 | ||
518 | msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET); | 521 | msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET); |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 2bd15c70773b..ed2df54bf464 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -1050,8 +1050,8 @@ static int i2o_block_probe(struct device *dev) | |||
1050 | int rc; | 1050 | int rc; |
1051 | u64 size; | 1051 | u64 size; |
1052 | u32 blocksize; | 1052 | u32 blocksize; |
1053 | u32 flags, status; | ||
1054 | u16 body_size = 4; | 1053 | u16 body_size = 4; |
1054 | u16 power; | ||
1055 | unsigned short max_sectors; | 1055 | unsigned short max_sectors; |
1056 | 1056 | ||
1057 | #ifdef CONFIG_I2O_EXT_ADAPTEC | 1057 | #ifdef CONFIG_I2O_EXT_ADAPTEC |
@@ -1109,22 +1109,20 @@ static int i2o_block_probe(struct device *dev) | |||
1109 | * Ask for the current media data. If that isn't supported | 1109 | * Ask for the current media data. If that isn't supported |
1110 | * then we ask for the device capacity data | 1110 | * then we ask for the device capacity data |
1111 | */ | 1111 | */ |
1112 | if (i2o_parm_field_get(i2o_dev, 0x0004, 1, &blocksize, 4) || | 1112 | if (!i2o_parm_field_get(i2o_dev, 0x0004, 1, &blocksize, 4) || |
1113 | i2o_parm_field_get(i2o_dev, 0x0000, 3, &blocksize, 4)) { | 1113 | !i2o_parm_field_get(i2o_dev, 0x0000, 3, &blocksize, 4)) { |
1114 | blk_queue_hardsect_size(queue, blocksize); | 1114 | blk_queue_hardsect_size(queue, le32_to_cpu(blocksize)); |
1115 | } else | 1115 | } else |
1116 | osm_warn("unable to get blocksize of %s\n", gd->disk_name); | 1116 | osm_warn("unable to get blocksize of %s\n", gd->disk_name); |
1117 | 1117 | ||
1118 | if (i2o_parm_field_get(i2o_dev, 0x0004, 0, &size, 8) || | 1118 | if (!i2o_parm_field_get(i2o_dev, 0x0004, 0, &size, 8) || |
1119 | i2o_parm_field_get(i2o_dev, 0x0000, 4, &size, 8)) { | 1119 | !i2o_parm_field_get(i2o_dev, 0x0000, 4, &size, 8)) { |
1120 | set_capacity(gd, size >> KERNEL_SECTOR_SHIFT); | 1120 | set_capacity(gd, le64_to_cpu(size) >> KERNEL_SECTOR_SHIFT); |
1121 | } else | 1121 | } else |
1122 | osm_warn("could not get size of %s\n", gd->disk_name); | 1122 | osm_warn("could not get size of %s\n", gd->disk_name); |
1123 | 1123 | ||
1124 | if (!i2o_parm_field_get(i2o_dev, 0x0000, 2, &i2o_blk_dev->power, 2)) | 1124 | if (!i2o_parm_field_get(i2o_dev, 0x0000, 2, &power, 2)) |
1125 | i2o_blk_dev->power = 0; | 1125 | i2o_blk_dev->power = power; |
1126 | i2o_parm_field_get(i2o_dev, 0x0000, 5, &flags, 4); | ||
1127 | i2o_parm_field_get(i2o_dev, 0x0000, 6, &status, 4); | ||
1128 | 1126 | ||
1129 | i2o_event_register(i2o_dev, &i2o_block_driver, 0, 0xffffffff); | 1127 | i2o_event_register(i2o_dev, &i2o_block_driver, 0, 0xffffffff); |
1130 | 1128 | ||
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index 7a784fd60804..24061dfd46e4 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c | |||
@@ -113,7 +113,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c) | |||
113 | 113 | ||
114 | list_for_each_entry(i2o_dev, &c->devices, list) | 114 | list_for_each_entry(i2o_dev, &c->devices, list) |
115 | if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER) { | 115 | if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER) { |
116 | if (i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) | 116 | if (!i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) |
117 | && (type == 0x01)) /* SCSI bus */ | 117 | && (type == 0x01)) /* SCSI bus */ |
118 | max_channel++; | 118 | max_channel++; |
119 | } | 119 | } |
@@ -146,7 +146,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c) | |||
146 | i = 0; | 146 | i = 0; |
147 | list_for_each_entry(i2o_dev, &c->devices, list) | 147 | list_for_each_entry(i2o_dev, &c->devices, list) |
148 | if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER) { | 148 | if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER) { |
149 | if (i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) | 149 | if (!i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) |
150 | && (type == 0x01)) /* only SCSI bus */ | 150 | && (type == 0x01)) /* only SCSI bus */ |
151 | i2o_shost->channel[i++] = i2o_dev; | 151 | i2o_shost->channel[i++] = i2o_dev; |
152 | 152 | ||
@@ -238,13 +238,15 @@ static int i2o_scsi_probe(struct device *dev) | |||
238 | u8 type; | 238 | u8 type; |
239 | struct i2o_device *d = i2o_shost->channel[0]; | 239 | struct i2o_device *d = i2o_shost->channel[0]; |
240 | 240 | ||
241 | if (i2o_parm_field_get(d, 0x0000, 0, &type, 1) | 241 | if (!i2o_parm_field_get(d, 0x0000, 0, &type, 1) |
242 | && (type == 0x01)) /* SCSI bus */ | 242 | && (type == 0x01)) /* SCSI bus */ |
243 | if (i2o_parm_field_get(d, 0x0200, 4, &id, 4)) { | 243 | if (!i2o_parm_field_get(d, 0x0200, 4, &id, 4)) { |
244 | channel = 0; | 244 | channel = 0; |
245 | if (i2o_dev->lct_data.class_id == | 245 | if (i2o_dev->lct_data.class_id == |
246 | I2O_CLASS_RANDOM_BLOCK_STORAGE) | 246 | I2O_CLASS_RANDOM_BLOCK_STORAGE) |
247 | lun = i2o_shost->lun++; | 247 | lun = |
248 | cpu_to_le64(i2o_shost-> | ||
249 | lun++); | ||
248 | else | 250 | else |
249 | lun = 0; | 251 | lun = 0; |
250 | } | 252 | } |
@@ -253,10 +255,10 @@ static int i2o_scsi_probe(struct device *dev) | |||
253 | break; | 255 | break; |
254 | 256 | ||
255 | case I2O_CLASS_SCSI_PERIPHERAL: | 257 | case I2O_CLASS_SCSI_PERIPHERAL: |
256 | if (i2o_parm_field_get(i2o_dev, 0x0000, 3, &id, 4) < 0) | 258 | if (i2o_parm_field_get(i2o_dev, 0x0000, 3, &id, 4)) |
257 | return -EFAULT; | 259 | return -EFAULT; |
258 | 260 | ||
259 | if (i2o_parm_field_get(i2o_dev, 0x0000, 4, &lun, 8) < 0) | 261 | if (i2o_parm_field_get(i2o_dev, 0x0000, 4, &lun, 8)) |
260 | return -EFAULT; | 262 | return -EFAULT; |
261 | 263 | ||
262 | parent = i2o_iop_find_device(c, i2o_dev->lct_data.parent_tid); | 264 | parent = i2o_iop_find_device(c, i2o_dev->lct_data.parent_tid); |
@@ -281,20 +283,22 @@ static int i2o_scsi_probe(struct device *dev) | |||
281 | return -EFAULT; | 283 | return -EFAULT; |
282 | } | 284 | } |
283 | 285 | ||
284 | if (id >= scsi_host->max_id) { | 286 | if (le32_to_cpu(id) >= scsi_host->max_id) { |
285 | osm_warn("SCSI device id (%d) >= max_id of I2O host (%d)", id, | 287 | osm_warn("SCSI device id (%d) >= max_id of I2O host (%d)", |
286 | scsi_host->max_id); | 288 | le32_to_cpu(id), scsi_host->max_id); |
287 | return -EFAULT; | 289 | return -EFAULT; |
288 | } | 290 | } |
289 | 291 | ||
290 | if (lun >= scsi_host->max_lun) { | 292 | if (le64_to_cpu(lun) >= scsi_host->max_lun) { |
291 | osm_warn("SCSI device id (%d) >= max_lun of I2O host (%d)", | 293 | osm_warn("SCSI device lun (%lu) >= max_lun of I2O host (%d)", |
292 | (unsigned int)lun, scsi_host->max_lun); | 294 | (long unsigned int)le64_to_cpu(lun), |
295 | scsi_host->max_lun); | ||
293 | return -EFAULT; | 296 | return -EFAULT; |
294 | } | 297 | } |
295 | 298 | ||
296 | scsi_dev = | 299 | scsi_dev = |
297 | __scsi_add_device(i2o_shost->scsi_host, channel, id, lun, i2o_dev); | 300 | __scsi_add_device(i2o_shost->scsi_host, channel, le32_to_cpu(id), |
301 | le64_to_cpu(lun), i2o_dev); | ||
298 | 302 | ||
299 | if (IS_ERR(scsi_dev)) { | 303 | if (IS_ERR(scsi_dev)) { |
300 | osm_warn("can not add SCSI device %03x\n", | 304 | osm_warn("can not add SCSI device %03x\n", |
@@ -306,7 +310,8 @@ static int i2o_scsi_probe(struct device *dev) | |||
306 | "scsi"); | 310 | "scsi"); |
307 | 311 | ||
308 | osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %d\n", | 312 | osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %d\n", |
309 | i2o_dev->lct_data.tid, channel, id, (unsigned int)lun); | 313 | i2o_dev->lct_data.tid, channel, le32_to_cpu(id), |
314 | (unsigned int)le64_to_cpu(lun)); | ||
310 | 315 | ||
311 | return 0; | 316 | return 0; |
312 | }; | 317 | }; |