* updated kollision (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / architecture / powerpc64 / package / linux / 0080-ps3rom-vendor-specific-command.patch
blob685f6c654b879d5afb0de85d3686e1ca1c5866f0
1 --- a/drivers/scsi/ps3rom.c 2012-02-13 18:45:43.735156562 +0100
2 +++ b/drivers/scsi/ps3rom.c 2012-02-13 18:45:54.835348606 +0100
3 @@ -40,6 +40,8 @@
5 #define PS3ROM_MAX_SECTORS (BOUNCE_SIZE >> 9)
7 +#define PS3ROM_VENDOR_SPECIFIC_OPCODE 0xfd
10 struct ps3rom_private {
11 struct ps3_storage_device *dev;
12 @@ -165,6 +167,40 @@
13 return 0;
16 +static int ps3rom_vendor_specific_request(struct ps3_storage_device *dev,
17 + struct scsi_cmnd *cmd)
19 + unsigned char opcode = cmd->cmnd[1];
20 + int res;
22 + dev_dbg(&dev->sbd.core, "%s:%u: send vendor-specific command 0x%02x\n", __func__,
23 + __LINE__, opcode);
25 + if (cmd->sc_data_direction == DMA_TO_DEVICE)
26 + scsi_sg_copy_to_buffer(cmd, dev->bounce_buf, dev->bounce_size);
28 + res = lv1_storage_send_device_command(dev->sbd.dev_id,
29 + opcode,
30 + dev->bounce_lpar, scsi_bufflen(cmd),
31 + dev->bounce_lpar, dev->bounce_size,
32 + &dev->tag);
33 + if (res == LV1_DENIED_BY_POLICY) {
34 + dev_dbg(&dev->sbd.core,
35 + "%s:%u: vendor-specific command 0x%02x denied by policy\n",
36 + __func__, __LINE__, opcode);
37 + return DID_ERROR << 16;
38 + }
40 + if (res) {
41 + dev_err(&dev->sbd.core,
42 + "%s:%u: vendor-specific command 0x%02x failed %d\n", __func__,
43 + __LINE__, opcode, res);
44 + return DID_ERROR << 16;
45 + }
47 + return 0;
50 static inline unsigned int srb10_lba(const struct scsi_cmnd *cmd)
52 return cmd->cmnd[2] << 24 | cmd->cmnd[3] << 16 | cmd->cmnd[4] << 8 |
53 @@ -254,6 +290,10 @@
54 srb10_len(cmd));
55 break;
57 + case PS3ROM_VENDOR_SPECIFIC_OPCODE:
58 + res = ps3rom_vendor_specific_request(dev, cmd);
59 + break;
61 default:
62 res = ps3rom_atapi_request(dev, cmd);
63 break;