diff options
Diffstat (limited to 'drivers/scsi/scsi_error.c')
| -rw-r--r-- | drivers/scsi/scsi_error.c | 31 | 
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 4cdaffca17fc..c95a4e943fc6 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c  | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> | 
| 27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> | 
| 28 | #include <linux/jiffies.h> | 28 | #include <linux/jiffies.h> | 
| 29 | #include <asm/unaligned.h> | ||
| 29 | 30 | ||
| 30 | #include <scsi/scsi.h> | 31 | #include <scsi/scsi.h> | 
| 31 | #include <scsi/scsi_cmnd.h> | 32 | #include <scsi/scsi_cmnd.h> | 
| @@ -2586,3 +2587,33 @@ void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq) | |||
| 2586 | } | 2587 | } | 
| 2587 | } | 2588 | } | 
| 2588 | EXPORT_SYMBOL(scsi_build_sense_buffer); | 2589 | EXPORT_SYMBOL(scsi_build_sense_buffer); | 
| 2590 | |||
| 2591 | /** | ||
| 2592 | * scsi_set_sense_information - set the information field in a | ||
| 2593 | * formatted sense data buffer | ||
| 2594 | * @buf: Where to build sense data | ||
| 2595 | * @info: 64-bit information value to be set | ||
| 2596 | * | ||
| 2597 | **/ | ||
| 2598 | void scsi_set_sense_information(u8 *buf, u64 info) | ||
| 2599 | { | ||
| 2600 | if ((buf[0] & 0x7f) == 0x72) { | ||
| 2601 | u8 *ucp, len; | ||
| 2602 | |||
| 2603 | len = buf[7]; | ||
| 2604 | ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0); | ||
| 2605 | if (!ucp) { | ||
| 2606 | buf[7] = len + 0xa; | ||
| 2607 | ucp = buf + 8 + len; | ||
| 2608 | } | ||
| 2609 | ucp[0] = 0; | ||
| 2610 | ucp[1] = 0xa; | ||
| 2611 | ucp[2] = 0x80; /* Valid bit */ | ||
| 2612 | ucp[3] = 0; | ||
| 2613 | put_unaligned_be64(info, &ucp[4]); | ||
| 2614 | } else if ((buf[0] & 0x7f) == 0x70) { | ||
| 2615 | buf[0] |= 0x80; | ||
| 2616 | put_unaligned_be64(info, &buf[3]); | ||
| 2617 | } | ||
| 2618 | } | ||
| 2619 | EXPORT_SYMBOL(scsi_set_sense_information); | ||
