aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/ps3disk.c23
-rw-r--r--drivers/block/ps3vram.c50
2 files changed, 38 insertions, 35 deletions
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index aaeeb544228a..fdd2d7a00338 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -120,7 +120,8 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
120static int ps3disk_submit_request_sg(struct ps3_storage_device *dev, 120static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
121 struct request *req) 121 struct request *req)
122{ 122{
123 struct ps3disk_private *priv = dev->sbd.core.driver_data; 123 struct ps3disk_private *priv =
124 ps3_system_bus_get_driver_data(&dev->sbd);
124 int write = rq_data_dir(req), res; 125 int write = rq_data_dir(req), res;
125 const char *op = write ? "write" : "read"; 126 const char *op = write ? "write" : "read";
126 u64 start_sector, sectors; 127 u64 start_sector, sectors;
@@ -168,7 +169,8 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
168static int ps3disk_submit_flush_request(struct ps3_storage_device *dev, 169static int ps3disk_submit_flush_request(struct ps3_storage_device *dev,
169 struct request *req) 170 struct request *req)
170{ 171{
171 struct ps3disk_private *priv = dev->sbd.core.driver_data; 172 struct ps3disk_private *priv =
173 ps3_system_bus_get_driver_data(&dev->sbd);
172 u64 res; 174 u64 res;
173 175
174 dev_dbg(&dev->sbd.core, "%s:%u: flush request\n", __func__, __LINE__); 176 dev_dbg(&dev->sbd.core, "%s:%u: flush request\n", __func__, __LINE__);
@@ -213,7 +215,8 @@ static void ps3disk_do_request(struct ps3_storage_device *dev,
213static void ps3disk_request(struct request_queue *q) 215static void ps3disk_request(struct request_queue *q)
214{ 216{
215 struct ps3_storage_device *dev = q->queuedata; 217 struct ps3_storage_device *dev = q->queuedata;
216 struct ps3disk_private *priv = dev->sbd.core.driver_data; 218 struct ps3disk_private *priv =
219 ps3_system_bus_get_driver_data(&dev->sbd);
217 220
218 if (priv->req) { 221 if (priv->req) {
219 dev_dbg(&dev->sbd.core, "%s:%u busy\n", __func__, __LINE__); 222 dev_dbg(&dev->sbd.core, "%s:%u busy\n", __func__, __LINE__);
@@ -245,7 +248,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
245 return IRQ_HANDLED; 248 return IRQ_HANDLED;
246 } 249 }
247 250
248 priv = dev->sbd.core.driver_data; 251 priv = ps3_system_bus_get_driver_data(&dev->sbd);
249 req = priv->req; 252 req = priv->req;
250 if (!req) { 253 if (!req) {
251 dev_dbg(&dev->sbd.core, 254 dev_dbg(&dev->sbd.core,
@@ -364,7 +367,8 @@ static void ata_id_c_string(const u16 *id, unsigned char *s, unsigned int ofs,
364 367
365static int ps3disk_identify(struct ps3_storage_device *dev) 368static int ps3disk_identify(struct ps3_storage_device *dev)
366{ 369{
367 struct ps3disk_private *priv = dev->sbd.core.driver_data; 370 struct ps3disk_private *priv =
371 ps3_system_bus_get_driver_data(&dev->sbd);
368 struct lv1_ata_cmnd_block ata_cmnd; 372 struct lv1_ata_cmnd_block ata_cmnd;
369 u16 *id = dev->bounce_buf; 373 u16 *id = dev->bounce_buf;
370 u64 res; 374 u64 res;
@@ -445,7 +449,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
445 goto fail; 449 goto fail;
446 } 450 }
447 451
448 dev->sbd.core.driver_data = priv; 452 ps3_system_bus_set_driver_data(_dev, priv);
449 spin_lock_init(&priv->lock); 453 spin_lock_init(&priv->lock);
450 454
451 dev->bounce_size = BOUNCE_SIZE; 455 dev->bounce_size = BOUNCE_SIZE;
@@ -523,7 +527,7 @@ fail_free_bounce:
523 kfree(dev->bounce_buf); 527 kfree(dev->bounce_buf);
524fail_free_priv: 528fail_free_priv:
525 kfree(priv); 529 kfree(priv);
526 dev->sbd.core.driver_data = NULL; 530 ps3_system_bus_set_driver_data(_dev, NULL);
527fail: 531fail:
528 mutex_lock(&ps3disk_mask_mutex); 532 mutex_lock(&ps3disk_mask_mutex);
529 __clear_bit(devidx, &ps3disk_mask); 533 __clear_bit(devidx, &ps3disk_mask);
@@ -534,7 +538,8 @@ fail:
534static int ps3disk_remove(struct ps3_system_bus_device *_dev) 538static int ps3disk_remove(struct ps3_system_bus_device *_dev)
535{ 539{
536 struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core); 540 struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
537 struct ps3disk_private *priv = dev->sbd.core.driver_data; 541 struct ps3disk_private *priv =
542 ps3_system_bus_get_driver_data(&dev->sbd);
538 543
539 mutex_lock(&ps3disk_mask_mutex); 544 mutex_lock(&ps3disk_mask_mutex);
540 __clear_bit(MINOR(disk_devt(priv->gendisk)) / PS3DISK_MINORS, 545 __clear_bit(MINOR(disk_devt(priv->gendisk)) / PS3DISK_MINORS,
@@ -548,7 +553,7 @@ static int ps3disk_remove(struct ps3_system_bus_device *_dev)
548 ps3stor_teardown(dev); 553 ps3stor_teardown(dev);
549 kfree(dev->bounce_buf); 554 kfree(dev->bounce_buf);
550 kfree(priv); 555 kfree(priv);
551 dev->sbd.core.driver_data = NULL; 556 ps3_system_bus_set_driver_data(_dev, NULL);
552 return 0; 557 return 0;
553} 558}
554 559
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index fbbdd5ca5720..fcecc7f897e4 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -110,7 +110,7 @@ static u32 *ps3vram_get_notifier(void *reports, int notifier)
110 110
111static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev) 111static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev)
112{ 112{
113 struct ps3vram_priv *priv = dev->core.driver_data; 113 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
114 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER); 114 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
115 int i; 115 int i;
116 116
@@ -121,7 +121,7 @@ static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev)
121static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev, 121static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev,
122 unsigned int timeout_ms) 122 unsigned int timeout_ms)
123{ 123{
124 struct ps3vram_priv *priv = dev->core.driver_data; 124 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
125 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER); 125 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
126 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); 126 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
127 127
@@ -136,7 +136,7 @@ static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev,
136 136
137static void ps3vram_init_ring(struct ps3_system_bus_device *dev) 137static void ps3vram_init_ring(struct ps3_system_bus_device *dev)
138{ 138{
139 struct ps3vram_priv *priv = dev->core.driver_data; 139 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
140 140
141 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET; 141 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET;
142 priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET; 142 priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET;
@@ -145,7 +145,7 @@ static void ps3vram_init_ring(struct ps3_system_bus_device *dev)
145static int ps3vram_wait_ring(struct ps3_system_bus_device *dev, 145static int ps3vram_wait_ring(struct ps3_system_bus_device *dev,
146 unsigned int timeout_ms) 146 unsigned int timeout_ms)
147{ 147{
148 struct ps3vram_priv *priv = dev->core.driver_data; 148 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
149 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); 149 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
150 150
151 do { 151 do {
@@ -174,7 +174,7 @@ static void ps3vram_begin_ring(struct ps3vram_priv *priv, u32 chan, u32 tag,
174 174
175static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev) 175static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev)
176{ 176{
177 struct ps3vram_priv *priv = dev->core.driver_data; 177 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
178 int status; 178 int status;
179 179
180 ps3vram_out_ring(priv, 0x20000000 | (FIFO_BASE + FIFO_OFFSET)); 180 ps3vram_out_ring(priv, 0x20000000 | (FIFO_BASE + FIFO_OFFSET));
@@ -192,7 +192,7 @@ static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev)
192 192
193static void ps3vram_fire_ring(struct ps3_system_bus_device *dev) 193static void ps3vram_fire_ring(struct ps3_system_bus_device *dev)
194{ 194{
195 struct ps3vram_priv *priv = dev->core.driver_data; 195 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
196 int status; 196 int status;
197 197
198 mutex_lock(&ps3_gpu_mutex); 198 mutex_lock(&ps3_gpu_mutex);
@@ -218,7 +218,7 @@ static void ps3vram_fire_ring(struct ps3_system_bus_device *dev)
218 218
219static void ps3vram_bind(struct ps3_system_bus_device *dev) 219static void ps3vram_bind(struct ps3_system_bus_device *dev)
220{ 220{
221 struct ps3vram_priv *priv = dev->core.driver_data; 221 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
222 222
223 ps3vram_begin_ring(priv, UPLOAD_SUBCH, 0, 1); 223 ps3vram_begin_ring(priv, UPLOAD_SUBCH, 0, 1);
224 ps3vram_out_ring(priv, 0x31337303); 224 ps3vram_out_ring(priv, 0x31337303);
@@ -241,7 +241,7 @@ static int ps3vram_upload(struct ps3_system_bus_device *dev,
241 unsigned int src_offset, unsigned int dst_offset, 241 unsigned int src_offset, unsigned int dst_offset,
242 int len, int count) 242 int len, int count)
243{ 243{
244 struct ps3vram_priv *priv = dev->core.driver_data; 244 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
245 245
246 ps3vram_begin_ring(priv, UPLOAD_SUBCH, 246 ps3vram_begin_ring(priv, UPLOAD_SUBCH,
247 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); 247 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
@@ -273,7 +273,7 @@ static int ps3vram_download(struct ps3_system_bus_device *dev,
273 unsigned int src_offset, unsigned int dst_offset, 273 unsigned int src_offset, unsigned int dst_offset,
274 int len, int count) 274 int len, int count)
275{ 275{
276 struct ps3vram_priv *priv = dev->core.driver_data; 276 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
277 277
278 ps3vram_begin_ring(priv, DOWNLOAD_SUBCH, 278 ps3vram_begin_ring(priv, DOWNLOAD_SUBCH,
279 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); 279 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
@@ -303,7 +303,7 @@ static int ps3vram_download(struct ps3_system_bus_device *dev,
303 303
304static void ps3vram_cache_evict(struct ps3_system_bus_device *dev, int entry) 304static void ps3vram_cache_evict(struct ps3_system_bus_device *dev, int entry)
305{ 305{
306 struct ps3vram_priv *priv = dev->core.driver_data; 306 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
307 struct ps3vram_cache *cache = &priv->cache; 307 struct ps3vram_cache *cache = &priv->cache;
308 308
309 if (!(cache->tags[entry].flags & CACHE_PAGE_DIRTY)) 309 if (!(cache->tags[entry].flags & CACHE_PAGE_DIRTY))
@@ -325,7 +325,7 @@ static void ps3vram_cache_evict(struct ps3_system_bus_device *dev, int entry)
325static void ps3vram_cache_load(struct ps3_system_bus_device *dev, int entry, 325static void ps3vram_cache_load(struct ps3_system_bus_device *dev, int entry,
326 unsigned int address) 326 unsigned int address)
327{ 327{
328 struct ps3vram_priv *priv = dev->core.driver_data; 328 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
329 struct ps3vram_cache *cache = &priv->cache; 329 struct ps3vram_cache *cache = &priv->cache;
330 330
331 dev_dbg(&dev->core, "Fetching %d: 0x%08x\n", entry, address); 331 dev_dbg(&dev->core, "Fetching %d: 0x%08x\n", entry, address);
@@ -345,7 +345,7 @@ static void ps3vram_cache_load(struct ps3_system_bus_device *dev, int entry,
345 345
346static void ps3vram_cache_flush(struct ps3_system_bus_device *dev) 346static void ps3vram_cache_flush(struct ps3_system_bus_device *dev)
347{ 347{
348 struct ps3vram_priv *priv = dev->core.driver_data; 348 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
349 struct ps3vram_cache *cache = &priv->cache; 349 struct ps3vram_cache *cache = &priv->cache;
350 int i; 350 int i;
351 351
@@ -359,7 +359,7 @@ static void ps3vram_cache_flush(struct ps3_system_bus_device *dev)
359static unsigned int ps3vram_cache_match(struct ps3_system_bus_device *dev, 359static unsigned int ps3vram_cache_match(struct ps3_system_bus_device *dev,
360 loff_t address) 360 loff_t address)
361{ 361{
362 struct ps3vram_priv *priv = dev->core.driver_data; 362 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
363 struct ps3vram_cache *cache = &priv->cache; 363 struct ps3vram_cache *cache = &priv->cache;
364 unsigned int base; 364 unsigned int base;
365 unsigned int offset; 365 unsigned int offset;
@@ -393,7 +393,7 @@ static unsigned int ps3vram_cache_match(struct ps3_system_bus_device *dev,
393 393
394static int ps3vram_cache_init(struct ps3_system_bus_device *dev) 394static int ps3vram_cache_init(struct ps3_system_bus_device *dev)
395{ 395{
396 struct ps3vram_priv *priv = dev->core.driver_data; 396 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
397 397
398 priv->cache.page_count = CACHE_PAGE_COUNT; 398 priv->cache.page_count = CACHE_PAGE_COUNT;
399 priv->cache.page_size = CACHE_PAGE_SIZE; 399 priv->cache.page_size = CACHE_PAGE_SIZE;
@@ -412,7 +412,7 @@ static int ps3vram_cache_init(struct ps3_system_bus_device *dev)
412 412
413static void ps3vram_cache_cleanup(struct ps3_system_bus_device *dev) 413static void ps3vram_cache_cleanup(struct ps3_system_bus_device *dev)
414{ 414{
415 struct ps3vram_priv *priv = dev->core.driver_data; 415 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
416 416
417 ps3vram_cache_flush(dev); 417 ps3vram_cache_flush(dev);
418 kfree(priv->cache.tags); 418 kfree(priv->cache.tags);
@@ -421,7 +421,7 @@ static void ps3vram_cache_cleanup(struct ps3_system_bus_device *dev)
421static int ps3vram_read(struct ps3_system_bus_device *dev, loff_t from, 421static int ps3vram_read(struct ps3_system_bus_device *dev, loff_t from,
422 size_t len, size_t *retlen, u_char *buf) 422 size_t len, size_t *retlen, u_char *buf)
423{ 423{
424 struct ps3vram_priv *priv = dev->core.driver_data; 424 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
425 unsigned int cached, count; 425 unsigned int cached, count;
426 426
427 dev_dbg(&dev->core, "%s: from=0x%08x len=0x%zx\n", __func__, 427 dev_dbg(&dev->core, "%s: from=0x%08x len=0x%zx\n", __func__,
@@ -465,7 +465,7 @@ static int ps3vram_read(struct ps3_system_bus_device *dev, loff_t from,
465static int ps3vram_write(struct ps3_system_bus_device *dev, loff_t to, 465static int ps3vram_write(struct ps3_system_bus_device *dev, loff_t to,
466 size_t len, size_t *retlen, const u_char *buf) 466 size_t len, size_t *retlen, const u_char *buf)
467{ 467{
468 struct ps3vram_priv *priv = dev->core.driver_data; 468 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
469 unsigned int cached, count; 469 unsigned int cached, count;
470 470
471 if (to >= priv->size) 471 if (to >= priv->size)
@@ -528,7 +528,7 @@ static const struct file_operations ps3vram_proc_fops = {
528 528
529static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev) 529static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev)
530{ 530{
531 struct ps3vram_priv *priv = dev->core.driver_data; 531 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
532 struct proc_dir_entry *pde; 532 struct proc_dir_entry *pde;
533 533
534 pde = proc_create_data(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops, 534 pde = proc_create_data(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops,
@@ -540,7 +540,7 @@ static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev)
540static struct bio *ps3vram_do_bio(struct ps3_system_bus_device *dev, 540static struct bio *ps3vram_do_bio(struct ps3_system_bus_device *dev,
541 struct bio *bio) 541 struct bio *bio)
542{ 542{
543 struct ps3vram_priv *priv = dev->core.driver_data; 543 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
544 int write = bio_data_dir(bio) == WRITE; 544 int write = bio_data_dir(bio) == WRITE;
545 const char *op = write ? "write" : "read"; 545 const char *op = write ? "write" : "read";
546 loff_t offset = bio->bi_sector << 9; 546 loff_t offset = bio->bi_sector << 9;
@@ -590,7 +590,7 @@ out:
590static int ps3vram_make_request(struct request_queue *q, struct bio *bio) 590static int ps3vram_make_request(struct request_queue *q, struct bio *bio)
591{ 591{
592 struct ps3_system_bus_device *dev = q->queuedata; 592 struct ps3_system_bus_device *dev = q->queuedata;
593 struct ps3vram_priv *priv = dev->core.driver_data; 593 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
594 int busy; 594 int busy;
595 595
596 dev_dbg(&dev->core, "%s\n", __func__); 596 dev_dbg(&dev->core, "%s\n", __func__);
@@ -628,9 +628,7 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
628 628
629 spin_lock_init(&priv->lock); 629 spin_lock_init(&priv->lock);
630 bio_list_init(&priv->list); 630 bio_list_init(&priv->list);
631 dev->core.driver_data = priv; 631 ps3_system_bus_set_driver_data(dev, priv);
632
633 priv = dev->core.driver_data;
634 632
635 /* Allocate XDR buffer (1MiB aligned) */ 633 /* Allocate XDR buffer (1MiB aligned) */
636 priv->xdr_buf = (void *)__get_free_pages(GFP_KERNEL, 634 priv->xdr_buf = (void *)__get_free_pages(GFP_KERNEL,
@@ -795,14 +793,14 @@ out_free_xdr_buf:
795 free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE)); 793 free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE));
796fail_free_priv: 794fail_free_priv:
797 kfree(priv); 795 kfree(priv);
798 dev->core.driver_data = NULL; 796 ps3_system_bus_set_driver_data(dev, NULL);
799fail: 797fail:
800 return error; 798 return error;
801} 799}
802 800
803static int ps3vram_remove(struct ps3_system_bus_device *dev) 801static int ps3vram_remove(struct ps3_system_bus_device *dev)
804{ 802{
805 struct ps3vram_priv *priv = dev->core.driver_data; 803 struct ps3vram_priv *priv = ps3_system_bus_get_driver_data(dev);
806 804
807 del_gendisk(priv->gendisk); 805 del_gendisk(priv->gendisk);
808 put_disk(priv->gendisk); 806 put_disk(priv->gendisk);
@@ -819,7 +817,7 @@ static int ps3vram_remove(struct ps3_system_bus_device *dev)
819 ps3_close_hv_device(dev); 817 ps3_close_hv_device(dev);
820 free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE)); 818 free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE));
821 kfree(priv); 819 kfree(priv);
822 dev->core.driver_data = NULL; 820 ps3_system_bus_set_driver_data(dev, NULL);
823 return 0; 821 return 0;
824} 822}
825 823