22 #include <linux/module.h>
33 static struct ps3_flash_workaround {
37 } ps3_flash_workaround;
47 ps3_flash_workaround.flash_open = 1;
50 ps3_flash_workaround.disk_open = 1;
60 && ps3_flash_workaround.disk_open
61 && ps3_flash_workaround.flash_open) {
62 ps3_flash_workaround.disk_sbd = sbd;
72 ps3_flash_workaround.disk_open = 0;
75 ps3_flash_workaround.flash_open = 0;
77 if (ps3_flash_workaround.disk_sbd) {
79 ps3_flash_workaround.disk_open = 0;
80 ps3_flash_workaround.disk_sbd =
NULL;
102 "%s:%u: checking accessibility of region %u\n",
103 __func__, __LINE__, i);
109 dev_dbg(&dev->
sbd.core,
"%s:%u: read failed, "
110 "region %u is not accessible\n", __func__,
115 dev_dbg(&dev->
sbd.core,
"%s:%u: region %u is accessible\n",
116 __func__, __LINE__, i);
128 "%s:%u: %lu accessible regions found. Only the first "
129 "one will be used\n",
130 __func__, __LINE__, n);
133 "First accessible region has index %u start %llu size %llu\n",
153 error = ps3stor_open_hv_device(&dev->
sbd);
156 "%s:%u: ps3_open_hv_device failed %d\n", __func__,
165 "%s:%u: ps3_sb_event_receive_port_setup failed %d\n",
166 __func__, __LINE__, error);
167 goto fail_close_device;
171 dev->
sbd.core.driver->name, dev);
173 dev_err(&dev->
sbd.core,
"%s:%u: request_irq failed %d\n",
174 __func__, __LINE__, error);
175 goto fail_sb_event_receive_port_destroy;
180 if (alignment < 12) {
182 "%s:%u: bounce buffer not aligned (%lx at 0x%p)\n",
186 }
else if (alignment < 16)
195 dev_err(&dev->
sbd.core,
"%s:%u: cannot create DMA region\n",
205 dev_err(&dev->
sbd.core,
"%s:%u: map DMA region failed\n",
211 error = ps3stor_probe_access(dev);
213 dev_err(&dev->
sbd.core,
"%s:%u: No accessible regions found\n",
226 fail_sb_event_receive_port_destroy:
229 ps3stor_close_hv_device(&dev->
sbd);
253 "%s:%u: destroy event receive port failed %d\n",
254 __func__, __LINE__, error);
256 error = ps3stor_close_hv_device(&dev->
sbd);
259 "%s:%u: ps3_close_hv_device failed %d\n", __func__,
280 const char *
op = write ?
"write" :
"read";
283 dev_dbg(&dev->
sbd.core,
"%s:%u: %s %llu sectors starting at %llu\n",
284 __func__, __LINE__, op, sectors, start_sector);
286 init_completion(&dev->
done);
287 res = write ? lv1_storage_write(dev->
sbd.dev_id, region_id,
288 start_sector, sectors, 0, lpar,
290 : lv1_storage_read(dev->
sbd.dev_id, region_id,
291 start_sector, sectors, 0, lpar,
294 dev_dbg(&dev->
sbd.core,
"%s:%u: %s failed %d\n", __func__,
301 dev_dbg(&dev->
sbd.core,
"%s:%u: %s failed 0x%llx\n", __func__,
306 dev_dbg(&dev->
sbd.core,
"%s:%u: %s completed\n", __func__, __LINE__,
331 dev_dbg(&dev->
sbd.core,
"%s:%u: send device command 0x%llx\n", __func__,
334 init_completion(&dev->
done);
336 res = lv1_storage_send_device_command(dev->
sbd.dev_id, cmd, arg1,
337 arg2, arg3, arg4, &dev->
tag);
340 "%s:%u: send_device_command 0x%llx failed %d\n",
341 __func__, __LINE__, cmd, res);
347 dev_dbg(&dev->
sbd.core,
"%s:%u: command 0x%llx failed 0x%llx\n",
352 dev_dbg(&dev->
sbd.core,
"%s:%u: command 0x%llx completed\n", __func__,