diff options
Diffstat (limited to 'drivers/block/ps3vram.c')
-rw-r--r-- | drivers/block/ps3vram.c | 50 |
1 files changed, 24 insertions, 26 deletions
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 | ||
111 | static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev) | 111 | static 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) | |||
121 | static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev, | 121 | static 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 | ||
137 | static void ps3vram_init_ring(struct ps3_system_bus_device *dev) | 137 | static 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) | |||
145 | static int ps3vram_wait_ring(struct ps3_system_bus_device *dev, | 145 | static 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 | ||
175 | static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev) | 175 | static 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 | ||
193 | static void ps3vram_fire_ring(struct ps3_system_bus_device *dev) | 193 | static 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 | ||
219 | static void ps3vram_bind(struct ps3_system_bus_device *dev) | 219 | static 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 | ||
304 | static void ps3vram_cache_evict(struct ps3_system_bus_device *dev, int entry) | 304 | static 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) | |||
325 | static void ps3vram_cache_load(struct ps3_system_bus_device *dev, int entry, | 325 | static 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 | ||
346 | static void ps3vram_cache_flush(struct ps3_system_bus_device *dev) | 346 | static 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) | |||
359 | static unsigned int ps3vram_cache_match(struct ps3_system_bus_device *dev, | 359 | static 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 | ||
394 | static int ps3vram_cache_init(struct ps3_system_bus_device *dev) | 394 | static 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 | ||
413 | static void ps3vram_cache_cleanup(struct ps3_system_bus_device *dev) | 413 | static 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) | |||
421 | static int ps3vram_read(struct ps3_system_bus_device *dev, loff_t from, | 421 | static 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, | |||
465 | static int ps3vram_write(struct ps3_system_bus_device *dev, loff_t to, | 465 | static 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 | ||
529 | static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev) | 529 | static 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) | |||
540 | static struct bio *ps3vram_do_bio(struct ps3_system_bus_device *dev, | 540 | static 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: | |||
590 | static int ps3vram_make_request(struct request_queue *q, struct bio *bio) | 590 | static 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)); |
796 | fail_free_priv: | 794 | fail_free_priv: |
797 | kfree(priv); | 795 | kfree(priv); |
798 | dev->core.driver_data = NULL; | 796 | ps3_system_bus_set_driver_data(dev, NULL); |
799 | fail: | 797 | fail: |
800 | return error; | 798 | return error; |
801 | } | 799 | } |
802 | 800 | ||
803 | static int ps3vram_remove(struct ps3_system_bus_device *dev) | 801 | static 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 | ||