card_dev.c (d276b6c54d47a427e4cffd7c84f3b631a1edf98e) | card_dev.c (3c1547e774b7d8485b7a1b15bb5e558d595ffc03) |
---|---|
1/** 2 * IBM Accelerator Family 'GenWQE' 3 * 4 * (C) Copyright IBM Corp. 2013 5 * 6 * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> 7 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> 8 * Author: Michael Jung <mijung@de.ibm.com> --- 200 unchanged lines hidden (view full) --- 209 * This is really a bug, because those things should 210 * have been already tidied up. 211 * 212 * GENWQE_MAPPING_RAW should have been removed via mmunmap(). 213 * GENWQE_MAPPING_SGL_TEMP should be removed by tidy up code. 214 */ 215 dev_err(&pci_dev->dev, 216 "[%s] %d. cleanup mapping: u_vaddr=%p " | 1/** 2 * IBM Accelerator Family 'GenWQE' 3 * 4 * (C) Copyright IBM Corp. 2013 5 * 6 * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> 7 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> 8 * Author: Michael Jung <mijung@de.ibm.com> --- 200 unchanged lines hidden (view full) --- 209 * This is really a bug, because those things should 210 * have been already tidied up. 211 * 212 * GENWQE_MAPPING_RAW should have been removed via mmunmap(). 213 * GENWQE_MAPPING_SGL_TEMP should be removed by tidy up code. 214 */ 215 dev_err(&pci_dev->dev, 216 "[%s] %d. cleanup mapping: u_vaddr=%p " |
217 "u_kaddr=%016lx dma_addr=%llx\n", __func__, i++, | 217 "u_kaddr=%016lx dma_addr=%lx\n", __func__, i++, |
218 dma_map->u_vaddr, (unsigned long)dma_map->k_vaddr, | 218 dma_map->u_vaddr, (unsigned long)dma_map->k_vaddr, |
219 dma_map->dma_addr); | 219 (unsigned long)dma_map->dma_addr); |
220 221 if (dma_map->type == GENWQE_MAPPING_RAW) { 222 /* we allocated this dynamically */ 223 __genwqe_free_consistent(cd, dma_map->size, 224 dma_map->k_vaddr, 225 dma_map->dma_addr); 226 kfree(dma_map); 227 } else if (dma_map->type == GENWQE_MAPPING_SGL_TEMP) { --- 274 unchanged lines hidden (view full) --- 502 503#define FLASH_BLOCK 0x40000 /* we use 256k blocks */ 504 505static int do_flash_update(struct genwqe_file *cfile, 506 struct genwqe_bitstream *load) 507{ 508 int rc = 0; 509 int blocks_to_flash; | 220 221 if (dma_map->type == GENWQE_MAPPING_RAW) { 222 /* we allocated this dynamically */ 223 __genwqe_free_consistent(cd, dma_map->size, 224 dma_map->k_vaddr, 225 dma_map->dma_addr); 226 kfree(dma_map); 227 } else if (dma_map->type == GENWQE_MAPPING_SGL_TEMP) { --- 274 unchanged lines hidden (view full) --- 502 503#define FLASH_BLOCK 0x40000 /* we use 256k blocks */ 504 505static int do_flash_update(struct genwqe_file *cfile, 506 struct genwqe_bitstream *load) 507{ 508 int rc = 0; 509 int blocks_to_flash; |
510 u64 dma_addr, flash = 0; | 510 dma_addr_t dma_addr; 511 u64 flash = 0; |
511 size_t tocopy = 0; 512 u8 __user *buf; 513 u8 *xbuf; 514 u32 crc; 515 u8 cmdopts; 516 struct genwqe_dev *cd = cfile->cd; 517 struct pci_dev *pci_dev = cd->pci_dev; 518 --- 34 unchanged lines hidden (view full) --- 553 rc = copy_from_user(xbuf, buf, tocopy); 554 if (rc) { 555 rc = -EFAULT; 556 goto free_buffer; 557 } 558 crc = genwqe_crc32(xbuf, tocopy, 0xffffffff); 559 560 dev_dbg(&pci_dev->dev, | 512 size_t tocopy = 0; 513 u8 __user *buf; 514 u8 *xbuf; 515 u32 crc; 516 u8 cmdopts; 517 struct genwqe_dev *cd = cfile->cd; 518 struct pci_dev *pci_dev = cd->pci_dev; 519 --- 34 unchanged lines hidden (view full) --- 554 rc = copy_from_user(xbuf, buf, tocopy); 555 if (rc) { 556 rc = -EFAULT; 557 goto free_buffer; 558 } 559 crc = genwqe_crc32(xbuf, tocopy, 0xffffffff); 560 561 dev_dbg(&pci_dev->dev, |
561 "[%s] DMA: 0x%llx CRC: %08x SZ: %ld %d\n", 562 __func__, dma_addr, crc, tocopy, blocks_to_flash); | 562 "[%s] DMA: %lx CRC: %08x SZ: %ld %d\n", 563 __func__, (unsigned long)dma_addr, crc, tocopy, 564 blocks_to_flash); |
563 564 /* prepare DDCB for SLU process */ 565 req = ddcb_requ_alloc(); 566 if (req == NULL) { 567 rc = -ENOMEM; 568 goto free_buffer; 569 } 570 --- 62 unchanged lines hidden (view full) --- 633 __genwqe_free_consistent(cd, FLASH_BLOCK, xbuf, dma_addr); 634 return rc; 635} 636 637static int do_flash_read(struct genwqe_file *cfile, 638 struct genwqe_bitstream *load) 639{ 640 int rc, blocks_to_flash; | 565 566 /* prepare DDCB for SLU process */ 567 req = ddcb_requ_alloc(); 568 if (req == NULL) { 569 rc = -ENOMEM; 570 goto free_buffer; 571 } 572 --- 62 unchanged lines hidden (view full) --- 635 __genwqe_free_consistent(cd, FLASH_BLOCK, xbuf, dma_addr); 636 return rc; 637} 638 639static int do_flash_read(struct genwqe_file *cfile, 640 struct genwqe_bitstream *load) 641{ 642 int rc, blocks_to_flash; |
641 u64 dma_addr, flash = 0; | 643 dma_addr_t dma_addr; 644 u64 flash = 0; |
642 size_t tocopy = 0; 643 u8 __user *buf; 644 u8 *xbuf; 645 u8 cmdopts; 646 struct genwqe_dev *cd = cfile->cd; 647 struct pci_dev *pci_dev = cd->pci_dev; 648 struct genwqe_ddcb_cmd *cmd; 649 --- 25 unchanged lines hidden (view full) --- 675 while (load->size) { 676 /* 677 * We must be 4 byte aligned. Buffer must be 0 appened 678 * to have defined values when calculating CRC. 679 */ 680 tocopy = min_t(size_t, load->size, FLASH_BLOCK); 681 682 dev_dbg(&pci_dev->dev, | 645 size_t tocopy = 0; 646 u8 __user *buf; 647 u8 *xbuf; 648 u8 cmdopts; 649 struct genwqe_dev *cd = cfile->cd; 650 struct pci_dev *pci_dev = cd->pci_dev; 651 struct genwqe_ddcb_cmd *cmd; 652 --- 25 unchanged lines hidden (view full) --- 678 while (load->size) { 679 /* 680 * We must be 4 byte aligned. Buffer must be 0 appened 681 * to have defined values when calculating CRC. 682 */ 683 tocopy = min_t(size_t, load->size, FLASH_BLOCK); 684 685 dev_dbg(&pci_dev->dev, |
683 "[%s] DMA: 0x%llx SZ: %ld %d\n", 684 __func__, dma_addr, tocopy, blocks_to_flash); | 686 "[%s] DMA: %lx SZ: %ld %d\n", 687 __func__, (unsigned long)dma_addr, tocopy, 688 blocks_to_flash); |
685 686 /* prepare DDCB for SLU process */ 687 cmd = ddcb_requ_alloc(); 688 if (cmd == NULL) { 689 rc = -ENOMEM; 690 goto free_buffer; 691 } 692 cmd->cmd = SLCMD_MOVE_FLASH; --- 166 unchanged lines hidden (view full) --- 859 struct genwqe_dev *cd = cfile->cd; 860 struct genwqe_ddcb_cmd *cmd = &req->cmd; 861 struct dma_mapping *m; 862 const char *type = "UNKNOWN"; 863 864 for (i = 0, asiv_offs = 0x00; asiv_offs <= 0x58; 865 i++, asiv_offs += 0x08) { 866 | 689 690 /* prepare DDCB for SLU process */ 691 cmd = ddcb_requ_alloc(); 692 if (cmd == NULL) { 693 rc = -ENOMEM; 694 goto free_buffer; 695 } 696 cmd->cmd = SLCMD_MOVE_FLASH; --- 166 unchanged lines hidden (view full) --- 863 struct genwqe_dev *cd = cfile->cd; 864 struct genwqe_ddcb_cmd *cmd = &req->cmd; 865 struct dma_mapping *m; 866 const char *type = "UNKNOWN"; 867 868 for (i = 0, asiv_offs = 0x00; asiv_offs <= 0x58; 869 i++, asiv_offs += 0x08) { 870 |
867 u64 u_addr, d_addr; | 871 u64 u_addr; 872 dma_addr_t d_addr; |
868 u32 u_size = 0; 869 u64 ats_flags; 870 871 ats_flags = ATS_GET_FLAGS(cmd->ats, asiv_offs); 872 873 switch (ats_flags) { 874 875 case ATS_TYPE_DATA: --- 534 unchanged lines hidden --- | 873 u32 u_size = 0; 874 u64 ats_flags; 875 876 ats_flags = ATS_GET_FLAGS(cmd->ats, asiv_offs); 877 878 switch (ats_flags) { 879 880 case ATS_TYPE_DATA: --- 534 unchanged lines hidden --- |