diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 14:30:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 14:30:37 -0400 |
commit | 609106b9ac968adbc76ce78c979fc3903a56e16c (patch) | |
tree | 4af8b305ab4095870a927ffdb9a5e14eb2107401 /arch/powerpc/platforms | |
parent | 69257cae20640a396f03aa0bf169b815ba66a58a (diff) | |
parent | 42e27bfc4bfa42bd905e53be93d862b8e3d80a00 (diff) |
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (38 commits)
ps3flash: Always read chunks of 256 KiB, and cache them
ps3flash: Cache the last accessed FLASH chunk
ps3: Replace direct file operations by callback
ps3: Switch ps3_os_area_[gs]et_rtc_diff to EXPORT_SYMBOL_GPL()
ps3: Correct debug message in dma_ioc0_map_pages()
drivers/ps3: Add missing annotations
ps3fb: Use ps3_system_bus_[gs]et_drvdata() instead of direct access
ps3flash: Use ps3_system_bus_[gs]et_drvdata() instead of direct access
ps3: shorten ps3_system_bus_[gs]et_driver_data to ps3_system_bus_[gs]et_drvdata
ps3: Use dev_[gs]et_drvdata() instead of direct access for system bus devices
block/ps3: remove driver_data direct access of struct device
ps3vram: Make ps3vram_priv.reports a void *
ps3vram: Remove no longer used ps3vram_priv.ddr_base
ps3vram: Replace mutex by spinlock + bio_list
block: Add bio_list_peek()
powerpc: Use generic atomic64_t implementation on 32-bit processors
lib: Provide generic atomic64_t implementation
powerpc: Add compiler memory barrier to mtmsr macro
powerpc/iseries: Mark signal_vsp_instruction() as maybe unused
powerpc/iseries: Fix unused function warning in iSeries DT code
...
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/cell/axon_msi.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 37 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/dt.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/mf.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/mm.c | 12 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/os-area.c | 142 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/platform.h | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/setup.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/system-bus.c | 15 |
9 files changed, 115 insertions, 112 deletions
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index 0ce45c2b42f8..c71498dbf211 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c | |||
@@ -329,7 +329,7 @@ static struct irq_host_ops msic_host_ops = { | |||
329 | 329 | ||
330 | static int axon_msi_shutdown(struct of_device *device) | 330 | static int axon_msi_shutdown(struct of_device *device) |
331 | { | 331 | { |
332 | struct axon_msic *msic = device->dev.platform_data; | 332 | struct axon_msic *msic = dev_get_drvdata(&device->dev); |
333 | u32 tmp; | 333 | u32 tmp; |
334 | 334 | ||
335 | pr_debug("axon_msi: disabling %s\n", | 335 | pr_debug("axon_msi: disabling %s\n", |
@@ -416,7 +416,7 @@ static int axon_msi_probe(struct of_device *device, | |||
416 | msic->read_offset = dcr_read(msic->dcr_host, MSIC_WRITE_OFFSET_REG) | 416 | msic->read_offset = dcr_read(msic->dcr_host, MSIC_WRITE_OFFSET_REG) |
417 | & MSIC_FIFO_SIZE_MASK; | 417 | & MSIC_FIFO_SIZE_MASK; |
418 | 418 | ||
419 | device->dev.platform_data = msic; | 419 | dev_set_drvdata(&device->dev, msic); |
420 | 420 | ||
421 | ppc_md.setup_msi_irqs = axon_msi_setup_msi_irqs; | 421 | ppc_md.setup_msi_irqs = axon_msi_setup_msi_irqs; |
422 | ppc_md.teardown_msi_irqs = axon_msi_teardown_msi_irqs; | 422 | ppc_md.teardown_msi_irqs = axon_msi_teardown_msi_irqs; |
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index bed4690de394..5b34fc211f35 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -100,16 +100,6 @@ | |||
100 | #define IOSTE_PS_1M 0x0000000000000005ul /* - 1MB */ | 100 | #define IOSTE_PS_1M 0x0000000000000005ul /* - 1MB */ |
101 | #define IOSTE_PS_16M 0x0000000000000007ul /* - 16MB */ | 101 | #define IOSTE_PS_16M 0x0000000000000007ul /* - 16MB */ |
102 | 102 | ||
103 | /* Page table entries */ | ||
104 | #define IOPTE_PP_W 0x8000000000000000ul /* protection: write */ | ||
105 | #define IOPTE_PP_R 0x4000000000000000ul /* protection: read */ | ||
106 | #define IOPTE_M 0x2000000000000000ul /* coherency required */ | ||
107 | #define IOPTE_SO_R 0x1000000000000000ul /* ordering: writes */ | ||
108 | #define IOPTE_SO_RW 0x1800000000000000ul /* ordering: r & w */ | ||
109 | #define IOPTE_RPN_Mask 0x07fffffffffff000ul /* RPN */ | ||
110 | #define IOPTE_H 0x0000000000000800ul /* cache hint */ | ||
111 | #define IOPTE_IOID_Mask 0x00000000000007fful /* ioid */ | ||
112 | |||
113 | 103 | ||
114 | /* IOMMU sizing */ | 104 | /* IOMMU sizing */ |
115 | #define IO_SEGMENT_SHIFT 28 | 105 | #define IO_SEGMENT_SHIFT 28 |
@@ -193,19 +183,21 @@ static int tce_build_cell(struct iommu_table *tbl, long index, long npages, | |||
193 | */ | 183 | */ |
194 | const unsigned long prot = 0xc48; | 184 | const unsigned long prot = 0xc48; |
195 | base_pte = | 185 | base_pte = |
196 | ((prot << (52 + 4 * direction)) & (IOPTE_PP_W | IOPTE_PP_R)) | 186 | ((prot << (52 + 4 * direction)) & |
197 | | IOPTE_M | IOPTE_SO_RW | (window->ioid & IOPTE_IOID_Mask); | 187 | (CBE_IOPTE_PP_W | CBE_IOPTE_PP_R)) | |
188 | CBE_IOPTE_M | CBE_IOPTE_SO_RW | | ||
189 | (window->ioid & CBE_IOPTE_IOID_Mask); | ||
198 | #else | 190 | #else |
199 | base_pte = IOPTE_PP_W | IOPTE_PP_R | IOPTE_M | IOPTE_SO_RW | | 191 | base_pte = CBE_IOPTE_PP_W | CBE_IOPTE_PP_R | CBE_IOPTE_M | |
200 | (window->ioid & IOPTE_IOID_Mask); | 192 | CBE_IOPTE_SO_RW | (window->ioid & CBE_IOPTE_IOID_Mask); |
201 | #endif | 193 | #endif |
202 | if (unlikely(dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs))) | 194 | if (unlikely(dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs))) |
203 | base_pte &= ~IOPTE_SO_RW; | 195 | base_pte &= ~CBE_IOPTE_SO_RW; |
204 | 196 | ||
205 | io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset); | 197 | io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset); |
206 | 198 | ||
207 | for (i = 0; i < npages; i++, uaddr += IOMMU_PAGE_SIZE) | 199 | for (i = 0; i < npages; i++, uaddr += IOMMU_PAGE_SIZE) |
208 | io_pte[i] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask); | 200 | io_pte[i] = base_pte | (__pa(uaddr) & CBE_IOPTE_RPN_Mask); |
209 | 201 | ||
210 | mb(); | 202 | mb(); |
211 | 203 | ||
@@ -231,8 +223,9 @@ static void tce_free_cell(struct iommu_table *tbl, long index, long npages) | |||
231 | #else | 223 | #else |
232 | /* spider bridge does PCI reads after freeing - insert a mapping | 224 | /* spider bridge does PCI reads after freeing - insert a mapping |
233 | * to a scratch page instead of an invalid entry */ | 225 | * to a scratch page instead of an invalid entry */ |
234 | pte = IOPTE_PP_R | IOPTE_M | IOPTE_SO_RW | __pa(window->iommu->pad_page) | 226 | pte = CBE_IOPTE_PP_R | CBE_IOPTE_M | CBE_IOPTE_SO_RW | |
235 | | (window->ioid & IOPTE_IOID_Mask); | 227 | __pa(window->iommu->pad_page) | |
228 | (window->ioid & CBE_IOPTE_IOID_Mask); | ||
236 | #endif | 229 | #endif |
237 | 230 | ||
238 | io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset); | 231 | io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset); |
@@ -1001,7 +994,7 @@ static void insert_16M_pte(unsigned long addr, unsigned long *ptab, | |||
1001 | pr_debug("iommu: addr %lx ptab %p segment %lx offset %lx\n", | 994 | pr_debug("iommu: addr %lx ptab %p segment %lx offset %lx\n", |
1002 | addr, ptab, segment, offset); | 995 | addr, ptab, segment, offset); |
1003 | 996 | ||
1004 | ptab[offset] = base_pte | (__pa(addr) & IOPTE_RPN_Mask); | 997 | ptab[offset] = base_pte | (__pa(addr) & CBE_IOPTE_RPN_Mask); |
1005 | } | 998 | } |
1006 | 999 | ||
1007 | static void cell_iommu_setup_fixed_ptab(struct cbe_iommu *iommu, | 1000 | static void cell_iommu_setup_fixed_ptab(struct cbe_iommu *iommu, |
@@ -1016,14 +1009,14 @@ static void cell_iommu_setup_fixed_ptab(struct cbe_iommu *iommu, | |||
1016 | 1009 | ||
1017 | pr_debug("iommu: mapping 0x%lx pages from 0x%lx\n", fsize, fbase); | 1010 | pr_debug("iommu: mapping 0x%lx pages from 0x%lx\n", fsize, fbase); |
1018 | 1011 | ||
1019 | base_pte = IOPTE_PP_W | IOPTE_PP_R | IOPTE_M | 1012 | base_pte = CBE_IOPTE_PP_W | CBE_IOPTE_PP_R | CBE_IOPTE_M | |
1020 | | (cell_iommu_get_ioid(np) & IOPTE_IOID_Mask); | 1013 | (cell_iommu_get_ioid(np) & CBE_IOPTE_IOID_Mask); |
1021 | 1014 | ||
1022 | if (iommu_fixed_is_weak) | 1015 | if (iommu_fixed_is_weak) |
1023 | pr_info("IOMMU: Using weak ordering for fixed mapping\n"); | 1016 | pr_info("IOMMU: Using weak ordering for fixed mapping\n"); |
1024 | else { | 1017 | else { |
1025 | pr_info("IOMMU: Using strong ordering for fixed mapping\n"); | 1018 | pr_info("IOMMU: Using strong ordering for fixed mapping\n"); |
1026 | base_pte |= IOPTE_SO_RW; | 1019 | base_pte |= CBE_IOPTE_SO_RW; |
1027 | } | 1020 | } |
1028 | 1021 | ||
1029 | for (uaddr = 0; uaddr < fsize; uaddr += (1 << 24)) { | 1022 | for (uaddr = 0; uaddr < fsize; uaddr += (1 << 24)) { |
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c index 4543c4bc3a56..c5a87a72057b 100644 --- a/arch/powerpc/platforms/iseries/dt.c +++ b/arch/powerpc/platforms/iseries/dt.c | |||
@@ -204,7 +204,8 @@ static void __init dt_prop_u32(struct iseries_flat_dt *dt, const char *name, | |||
204 | dt_prop(dt, name, &data, sizeof(u32)); | 204 | dt_prop(dt, name, &data, sizeof(u32)); |
205 | } | 205 | } |
206 | 206 | ||
207 | static void __init dt_prop_u64(struct iseries_flat_dt *dt, const char *name, | 207 | static void __init __maybe_unused dt_prop_u64(struct iseries_flat_dt *dt, |
208 | const char *name, | ||
208 | u64 data) | 209 | u64 data) |
209 | { | 210 | { |
210 | dt_prop(dt, name, &data, sizeof(u64)); | 211 | dt_prop(dt, name, &data, sizeof(u64)); |
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c index 3689c2413d24..fef4d5150517 100644 --- a/arch/powerpc/platforms/iseries/mf.c +++ b/arch/powerpc/platforms/iseries/mf.c | |||
@@ -267,7 +267,8 @@ static struct pending_event *new_pending_event(void) | |||
267 | return ev; | 267 | return ev; |
268 | } | 268 | } |
269 | 269 | ||
270 | static int signal_vsp_instruction(struct vsp_cmd_data *vsp_cmd) | 270 | static int __maybe_unused |
271 | signal_vsp_instruction(struct vsp_cmd_data *vsp_cmd) | ||
271 | { | 272 | { |
272 | struct pending_event *ev = new_pending_event(); | 273 | struct pending_event *ev = new_pending_event(); |
273 | int rc; | 274 | int rc; |
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 9a2b6d948610..846eb8b57fd1 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/lmb.h> | 24 | #include <linux/lmb.h> |
25 | 25 | ||
26 | #include <asm/firmware.h> | 26 | #include <asm/firmware.h> |
27 | #include <asm/iommu.h> | ||
27 | #include <asm/prom.h> | 28 | #include <asm/prom.h> |
28 | #include <asm/udbg.h> | 29 | #include <asm/udbg.h> |
29 | #include <asm/lv1call.h> | 30 | #include <asm/lv1call.h> |
@@ -605,9 +606,8 @@ static int dma_ioc0_map_pages(struct ps3_dma_region *r, unsigned long phys_addr, | |||
605 | r->ioid, | 606 | r->ioid, |
606 | iopte_flag); | 607 | iopte_flag); |
607 | if (result) { | 608 | if (result) { |
608 | printk(KERN_WARNING "%s:%d: lv1_map_device_dma_region " | 609 | pr_warning("%s:%d: lv1_put_iopte failed: %s\n", |
609 | "failed: %s\n", __func__, __LINE__, | 610 | __func__, __LINE__, ps3_result(result)); |
610 | ps3_result(result)); | ||
611 | goto fail_map; | 611 | goto fail_map; |
612 | } | 612 | } |
613 | DBG("%s: pg=%d bus=%#lx, lpar=%#lx, ioid=%#x\n", __func__, | 613 | DBG("%s: pg=%d bus=%#lx, lpar=%#lx, ioid=%#x\n", __func__, |
@@ -1001,7 +1001,8 @@ static int dma_sb_region_create_linear(struct ps3_dma_region *r) | |||
1001 | if (len > r->len) | 1001 | if (len > r->len) |
1002 | len = r->len; | 1002 | len = r->len; |
1003 | result = dma_sb_map_area(r, virt_addr, len, &tmp, | 1003 | result = dma_sb_map_area(r, virt_addr, len, &tmp, |
1004 | IOPTE_PP_W | IOPTE_PP_R | IOPTE_SO_RW | IOPTE_M); | 1004 | CBE_IOPTE_PP_W | CBE_IOPTE_PP_R | CBE_IOPTE_SO_RW | |
1005 | CBE_IOPTE_M); | ||
1005 | BUG_ON(result); | 1006 | BUG_ON(result); |
1006 | } | 1007 | } |
1007 | 1008 | ||
@@ -1014,7 +1015,8 @@ static int dma_sb_region_create_linear(struct ps3_dma_region *r) | |||
1014 | else | 1015 | else |
1015 | len -= map.rm.size - r->offset; | 1016 | len -= map.rm.size - r->offset; |
1016 | result = dma_sb_map_area(r, virt_addr, len, &tmp, | 1017 | result = dma_sb_map_area(r, virt_addr, len, &tmp, |
1017 | IOPTE_PP_W | IOPTE_PP_R | IOPTE_SO_RW | IOPTE_M); | 1018 | CBE_IOPTE_PP_W | CBE_IOPTE_PP_R | CBE_IOPTE_SO_RW | |
1019 | CBE_IOPTE_M); | ||
1018 | BUG_ON(result); | 1020 | BUG_ON(result); |
1019 | } | 1021 | } |
1020 | 1022 | ||
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c index cf1cd0f8c18f..d6487a9c8019 100644 --- a/arch/powerpc/platforms/ps3/os-area.c +++ b/arch/powerpc/platforms/ps3/os-area.c | |||
@@ -226,6 +226,44 @@ static struct property property_av_multi_out = { | |||
226 | .value = &saved_params.av_multi_out, | 226 | .value = &saved_params.av_multi_out, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | |||
230 | static DEFINE_MUTEX(os_area_flash_mutex); | ||
231 | |||
232 | static const struct ps3_os_area_flash_ops *os_area_flash_ops; | ||
233 | |||
234 | void ps3_os_area_flash_register(const struct ps3_os_area_flash_ops *ops) | ||
235 | { | ||
236 | mutex_lock(&os_area_flash_mutex); | ||
237 | os_area_flash_ops = ops; | ||
238 | mutex_unlock(&os_area_flash_mutex); | ||
239 | } | ||
240 | EXPORT_SYMBOL_GPL(ps3_os_area_flash_register); | ||
241 | |||
242 | static ssize_t os_area_flash_read(void *buf, size_t count, loff_t pos) | ||
243 | { | ||
244 | ssize_t res = -ENODEV; | ||
245 | |||
246 | mutex_lock(&os_area_flash_mutex); | ||
247 | if (os_area_flash_ops) | ||
248 | res = os_area_flash_ops->read(buf, count, pos); | ||
249 | mutex_unlock(&os_area_flash_mutex); | ||
250 | |||
251 | return res; | ||
252 | } | ||
253 | |||
254 | static ssize_t os_area_flash_write(const void *buf, size_t count, loff_t pos) | ||
255 | { | ||
256 | ssize_t res = -ENODEV; | ||
257 | |||
258 | mutex_lock(&os_area_flash_mutex); | ||
259 | if (os_area_flash_ops) | ||
260 | res = os_area_flash_ops->write(buf, count, pos); | ||
261 | mutex_unlock(&os_area_flash_mutex); | ||
262 | |||
263 | return res; | ||
264 | } | ||
265 | |||
266 | |||
229 | /** | 267 | /** |
230 | * os_area_set_property - Add or overwrite a saved_params value to the device tree. | 268 | * os_area_set_property - Add or overwrite a saved_params value to the device tree. |
231 | * | 269 | * |
@@ -352,12 +390,12 @@ static int db_verify(const struct os_area_db *db) | |||
352 | if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM, | 390 | if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM, |
353 | sizeof(db->magic_num))) { | 391 | sizeof(db->magic_num))) { |
354 | pr_debug("%s:%d magic_num failed\n", __func__, __LINE__); | 392 | pr_debug("%s:%d magic_num failed\n", __func__, __LINE__); |
355 | return -1; | 393 | return -EINVAL; |
356 | } | 394 | } |
357 | 395 | ||
358 | if (db->version != 1) { | 396 | if (db->version != 1) { |
359 | pr_debug("%s:%d version failed\n", __func__, __LINE__); | 397 | pr_debug("%s:%d version failed\n", __func__, __LINE__); |
360 | return -1; | 398 | return -EINVAL; |
361 | } | 399 | } |
362 | 400 | ||
363 | return 0; | 401 | return 0; |
@@ -578,59 +616,48 @@ static void os_area_db_init(struct os_area_db *db) | |||
578 | * | 616 | * |
579 | */ | 617 | */ |
580 | 618 | ||
581 | static void __maybe_unused update_flash_db(void) | 619 | static int update_flash_db(void) |
582 | { | 620 | { |
583 | int result; | 621 | const unsigned int buf_len = 8 * OS_AREA_SEGMENT_SIZE; |
584 | int file; | 622 | struct os_area_header *header; |
585 | off_t offset; | ||
586 | ssize_t count; | 623 | ssize_t count; |
587 | static const unsigned int buf_len = 8 * OS_AREA_SEGMENT_SIZE; | 624 | int error; |
588 | const struct os_area_header *header; | 625 | loff_t pos; |
589 | struct os_area_db* db; | 626 | struct os_area_db* db; |
590 | 627 | ||
591 | /* Read in header and db from flash. */ | 628 | /* Read in header and db from flash. */ |
592 | 629 | ||
593 | file = sys_open("/dev/ps3flash", O_RDWR, 0); | ||
594 | |||
595 | if (file < 0) { | ||
596 | pr_debug("%s:%d sys_open failed\n", __func__, __LINE__); | ||
597 | goto fail_open; | ||
598 | } | ||
599 | |||
600 | header = kmalloc(buf_len, GFP_KERNEL); | 630 | header = kmalloc(buf_len, GFP_KERNEL); |
601 | |||
602 | if (!header) { | 631 | if (!header) { |
603 | pr_debug("%s:%d kmalloc failed\n", __func__, __LINE__); | 632 | pr_debug("%s: kmalloc failed\n", __func__); |
604 | goto fail_malloc; | 633 | return -ENOMEM; |
605 | } | 634 | } |
606 | 635 | ||
607 | offset = sys_lseek(file, 0, SEEK_SET); | 636 | count = os_area_flash_read(header, buf_len, 0); |
608 | 637 | if (count < 0) { | |
609 | if (offset != 0) { | 638 | pr_debug("%s: os_area_flash_read failed %zd\n", __func__, |
610 | pr_debug("%s:%d sys_lseek failed\n", __func__, __LINE__); | 639 | count); |
611 | goto fail_header_seek; | 640 | error = count; |
641 | goto fail; | ||
612 | } | 642 | } |
613 | 643 | ||
614 | count = sys_read(file, (char __user *)header, buf_len); | 644 | pos = header->db_area_offset * OS_AREA_SEGMENT_SIZE; |
615 | 645 | if (count < OS_AREA_SEGMENT_SIZE || verify_header(header) || | |
616 | result = count < OS_AREA_SEGMENT_SIZE || verify_header(header) | 646 | count < pos) { |
617 | || count < header->db_area_offset * OS_AREA_SEGMENT_SIZE; | 647 | pr_debug("%s: verify_header failed\n", __func__); |
618 | |||
619 | if (result) { | ||
620 | pr_debug("%s:%d verify_header failed\n", __func__, __LINE__); | ||
621 | dump_header(header); | 648 | dump_header(header); |
622 | goto fail_header; | 649 | error = -EINVAL; |
650 | goto fail; | ||
623 | } | 651 | } |
624 | 652 | ||
625 | /* Now got a good db offset and some maybe good db data. */ | 653 | /* Now got a good db offset and some maybe good db data. */ |
626 | 654 | ||
627 | db = (void*)header + header->db_area_offset * OS_AREA_SEGMENT_SIZE; | 655 | db = (void *)header + pos; |
628 | 656 | ||
629 | result = db_verify(db); | 657 | error = db_verify(db); |
630 | 658 | if (error) { | |
631 | if (result) { | 659 | pr_notice("%s: Verify of flash database failed, formatting.\n", |
632 | printk(KERN_NOTICE "%s:%d: Verify of flash database failed, " | 660 | __func__); |
633 | "formatting.\n", __func__, __LINE__); | ||
634 | dump_db(db); | 661 | dump_db(db); |
635 | os_area_db_init(db); | 662 | os_area_db_init(db); |
636 | } | 663 | } |
@@ -639,29 +666,16 @@ static void __maybe_unused update_flash_db(void) | |||
639 | 666 | ||
640 | db_set_64(db, &os_area_db_id_rtc_diff, saved_params.rtc_diff); | 667 | db_set_64(db, &os_area_db_id_rtc_diff, saved_params.rtc_diff); |
641 | 668 | ||
642 | offset = sys_lseek(file, header->db_area_offset * OS_AREA_SEGMENT_SIZE, | 669 | count = os_area_flash_write(db, sizeof(struct os_area_db), pos); |
643 | SEEK_SET); | ||
644 | |||
645 | if (offset != header->db_area_offset * OS_AREA_SEGMENT_SIZE) { | ||
646 | pr_debug("%s:%d sys_lseek failed\n", __func__, __LINE__); | ||
647 | goto fail_db_seek; | ||
648 | } | ||
649 | |||
650 | count = sys_write(file, (const char __user *)db, | ||
651 | sizeof(struct os_area_db)); | ||
652 | |||
653 | if (count < sizeof(struct os_area_db)) { | 670 | if (count < sizeof(struct os_area_db)) { |
654 | pr_debug("%s:%d sys_write failed\n", __func__, __LINE__); | 671 | pr_debug("%s: os_area_flash_write failed %zd\n", __func__, |
672 | count); | ||
673 | error = count < 0 ? count : -EIO; | ||
655 | } | 674 | } |
656 | 675 | ||
657 | fail_db_seek: | 676 | fail: |
658 | fail_header: | ||
659 | fail_header_seek: | ||
660 | kfree(header); | 677 | kfree(header); |
661 | fail_malloc: | 678 | return error; |
662 | sys_close(file); | ||
663 | fail_open: | ||
664 | return; | ||
665 | } | 679 | } |
666 | 680 | ||
667 | /** | 681 | /** |
@@ -674,11 +688,11 @@ fail_open: | |||
674 | static void os_area_queue_work_handler(struct work_struct *work) | 688 | static void os_area_queue_work_handler(struct work_struct *work) |
675 | { | 689 | { |
676 | struct device_node *node; | 690 | struct device_node *node; |
691 | int error; | ||
677 | 692 | ||
678 | pr_debug(" -> %s:%d\n", __func__, __LINE__); | 693 | pr_debug(" -> %s:%d\n", __func__, __LINE__); |
679 | 694 | ||
680 | node = of_find_node_by_path("/"); | 695 | node = of_find_node_by_path("/"); |
681 | |||
682 | if (node) { | 696 | if (node) { |
683 | os_area_set_property(node, &property_rtc_diff); | 697 | os_area_set_property(node, &property_rtc_diff); |
684 | of_node_put(node); | 698 | of_node_put(node); |
@@ -686,12 +700,10 @@ static void os_area_queue_work_handler(struct work_struct *work) | |||
686 | pr_debug("%s:%d of_find_node_by_path failed\n", | 700 | pr_debug("%s:%d of_find_node_by_path failed\n", |
687 | __func__, __LINE__); | 701 | __func__, __LINE__); |
688 | 702 | ||
689 | #if defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE) | 703 | error = update_flash_db(); |
690 | update_flash_db(); | 704 | if (error) |
691 | #else | 705 | pr_warning("%s: Could not update FLASH ROM\n", __func__); |
692 | printk(KERN_WARNING "%s:%d: No flash rom driver configured.\n", | 706 | |
693 | __func__, __LINE__); | ||
694 | #endif | ||
695 | pr_debug(" <- %s:%d\n", __func__, __LINE__); | 707 | pr_debug(" <- %s:%d\n", __func__, __LINE__); |
696 | } | 708 | } |
697 | 709 | ||
@@ -808,7 +820,7 @@ u64 ps3_os_area_get_rtc_diff(void) | |||
808 | { | 820 | { |
809 | return saved_params.rtc_diff; | 821 | return saved_params.rtc_diff; |
810 | } | 822 | } |
811 | EXPORT_SYMBOL(ps3_os_area_get_rtc_diff); | 823 | EXPORT_SYMBOL_GPL(ps3_os_area_get_rtc_diff); |
812 | 824 | ||
813 | /** | 825 | /** |
814 | * ps3_os_area_set_rtc_diff - Set the rtc diff value. | 826 | * ps3_os_area_set_rtc_diff - Set the rtc diff value. |
@@ -824,7 +836,7 @@ void ps3_os_area_set_rtc_diff(u64 rtc_diff) | |||
824 | os_area_queue_work(); | 836 | os_area_queue_work(); |
825 | } | 837 | } |
826 | } | 838 | } |
827 | EXPORT_SYMBOL(ps3_os_area_set_rtc_diff); | 839 | EXPORT_SYMBOL_GPL(ps3_os_area_set_rtc_diff); |
828 | 840 | ||
829 | /** | 841 | /** |
830 | * ps3_os_area_get_av_multi_out - Returns the default video mode. | 842 | * ps3_os_area_get_av_multi_out - Returns the default video mode. |
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h index 136aa0637d9c..9a196a88eda7 100644 --- a/arch/powerpc/platforms/ps3/platform.h +++ b/arch/powerpc/platforms/ps3/platform.h | |||
@@ -232,14 +232,4 @@ int ps3_repository_read_spu_resource_id(unsigned int res_index, | |||
232 | int ps3_repository_read_vuart_av_port(unsigned int *port); | 232 | int ps3_repository_read_vuart_av_port(unsigned int *port); |
233 | int ps3_repository_read_vuart_sysmgr_port(unsigned int *port); | 233 | int ps3_repository_read_vuart_sysmgr_port(unsigned int *port); |
234 | 234 | ||
235 | /* Page table entries */ | ||
236 | #define IOPTE_PP_W 0x8000000000000000ul /* protection: write */ | ||
237 | #define IOPTE_PP_R 0x4000000000000000ul /* protection: read */ | ||
238 | #define IOPTE_M 0x2000000000000000ul /* coherency required */ | ||
239 | #define IOPTE_SO_R 0x1000000000000000ul /* ordering: writes */ | ||
240 | #define IOPTE_SO_RW 0x1800000000000000ul /* ordering: r & w */ | ||
241 | #define IOPTE_RPN_Mask 0x07fffffffffff000ul /* RPN */ | ||
242 | #define IOPTE_H 0x0000000000000800ul /* cache hint */ | ||
243 | #define IOPTE_IOID_Mask 0x00000000000007fful /* ioid */ | ||
244 | |||
245 | #endif | 235 | #endif |
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c index 1a7b5ae0c83e..149bea2ce583 100644 --- a/arch/powerpc/platforms/ps3/setup.c +++ b/arch/powerpc/platforms/ps3/setup.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/udbg.h> | 32 | #include <asm/udbg.h> |
33 | #include <asm/prom.h> | 33 | #include <asm/prom.h> |
34 | #include <asm/lv1call.h> | 34 | #include <asm/lv1call.h> |
35 | #include <asm/ps3gpu.h> | ||
35 | 36 | ||
36 | #include "platform.h" | 37 | #include "platform.h" |
37 | 38 | ||
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index 9a73d0238639..9fead0faf38b 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/udbg.h> | 27 | #include <asm/udbg.h> |
28 | #include <asm/lv1call.h> | 28 | #include <asm/lv1call.h> |
29 | #include <asm/firmware.h> | 29 | #include <asm/firmware.h> |
30 | #include <asm/iommu.h> | ||
30 | 31 | ||
31 | #include "platform.h" | 32 | #include "platform.h" |
32 | 33 | ||
@@ -531,7 +532,8 @@ static void * ps3_alloc_coherent(struct device *_dev, size_t size, | |||
531 | } | 532 | } |
532 | 533 | ||
533 | result = ps3_dma_map(dev->d_region, virt_addr, size, dma_handle, | 534 | result = ps3_dma_map(dev->d_region, virt_addr, size, dma_handle, |
534 | IOPTE_PP_W | IOPTE_PP_R | IOPTE_SO_RW | IOPTE_M); | 535 | CBE_IOPTE_PP_W | CBE_IOPTE_PP_R | |
536 | CBE_IOPTE_SO_RW | CBE_IOPTE_M); | ||
535 | 537 | ||
536 | if (result) { | 538 | if (result) { |
537 | pr_debug("%s:%d: ps3_dma_map failed (%d)\n", | 539 | pr_debug("%s:%d: ps3_dma_map failed (%d)\n", |
@@ -575,7 +577,8 @@ static dma_addr_t ps3_sb_map_page(struct device *_dev, struct page *page, | |||
575 | 577 | ||
576 | result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, | 578 | result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, |
577 | &bus_addr, | 579 | &bus_addr, |
578 | IOPTE_PP_R | IOPTE_PP_W | IOPTE_SO_RW | IOPTE_M); | 580 | CBE_IOPTE_PP_R | CBE_IOPTE_PP_W | |
581 | CBE_IOPTE_SO_RW | CBE_IOPTE_M); | ||
579 | 582 | ||
580 | if (result) { | 583 | if (result) { |
581 | pr_debug("%s:%d: ps3_dma_map failed (%d)\n", | 584 | pr_debug("%s:%d: ps3_dma_map failed (%d)\n", |
@@ -596,16 +599,16 @@ static dma_addr_t ps3_ioc0_map_page(struct device *_dev, struct page *page, | |||
596 | u64 iopte_flag; | 599 | u64 iopte_flag; |
597 | void *ptr = page_address(page) + offset; | 600 | void *ptr = page_address(page) + offset; |
598 | 601 | ||
599 | iopte_flag = IOPTE_M; | 602 | iopte_flag = CBE_IOPTE_M; |
600 | switch (direction) { | 603 | switch (direction) { |
601 | case DMA_BIDIRECTIONAL: | 604 | case DMA_BIDIRECTIONAL: |
602 | iopte_flag |= IOPTE_PP_R | IOPTE_PP_W | IOPTE_SO_RW; | 605 | iopte_flag |= CBE_IOPTE_PP_R | CBE_IOPTE_PP_W | CBE_IOPTE_SO_RW; |
603 | break; | 606 | break; |
604 | case DMA_TO_DEVICE: | 607 | case DMA_TO_DEVICE: |
605 | iopte_flag |= IOPTE_PP_R | IOPTE_SO_R; | 608 | iopte_flag |= CBE_IOPTE_PP_R | CBE_IOPTE_SO_R; |
606 | break; | 609 | break; |
607 | case DMA_FROM_DEVICE: | 610 | case DMA_FROM_DEVICE: |
608 | iopte_flag |= IOPTE_PP_W | IOPTE_SO_RW; | 611 | iopte_flag |= CBE_IOPTE_PP_W | CBE_IOPTE_SO_RW; |
609 | break; | 612 | break; |
610 | default: | 613 | default: |
611 | /* not happned */ | 614 | /* not happned */ |