ufs_device.cc (11179:8e240cd8132a) | ufs_device.cc (11321:02e930db812d) |
---|---|
1/* 2 * Copyright (c) 2013-2015 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 679 unchanged lines hidden (view full) --- 688 * read from the flashdisk 689 */ 690 691void 692UFSHostDevice::UFSSCSIDevice::readFlash(uint8_t* readaddr, uint64_t offset, 693 uint32_t size) 694{ 695 /** read from image, and get to memory */ | 1/* 2 * Copyright (c) 2013-2015 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 679 unchanged lines hidden (view full) --- 688 * read from the flashdisk 689 */ 690 691void 692UFSHostDevice::UFSSCSIDevice::readFlash(uint8_t* readaddr, uint64_t offset, 693 uint32_t size) 694{ 695 /** read from image, and get to memory */ |
696 for(int count = 0; count < (size / SectorSize); count++) | 696 for (int count = 0; count < (size / SectorSize); count++) |
697 flashDisk->read(&(readaddr[SectorSize*count]), (offset / 698 SectorSize) + count); 699} 700 701/** 702 * Write to the flashdisk 703 */ 704 705void 706UFSHostDevice::UFSSCSIDevice::writeFlash(uint8_t* writeaddr, uint64_t offset, 707 uint32_t size) 708{ 709 /** Get from fifo and write to image*/ | 697 flashDisk->read(&(readaddr[SectorSize*count]), (offset / 698 SectorSize) + count); 699} 700 701/** 702 * Write to the flashdisk 703 */ 704 705void 706UFSHostDevice::UFSSCSIDevice::writeFlash(uint8_t* writeaddr, uint64_t offset, 707 uint32_t size) 708{ 709 /** Get from fifo and write to image*/ |
710 for(int count = 0; count < (size / SectorSize); count++) | 710 for (int count = 0; count < (size / SectorSize); count++) |
711 flashDisk->write(&(writeaddr[SectorSize * count]), 712 (offset / SectorSize) + count); 713} 714 715/** 716 * Constructor for the UFS Host device 717 */ 718 --- 21 unchanged lines hidden (view full) --- 740 lunAvail); 741 UFSDevice.resize(lunAvail); 742 743 transferDoneCallback = new MakeCallback<UFSHostDevice, 744 &UFSHostDevice::LUNSignal>(this); 745 memReadCallback = new MakeCallback<UFSHostDevice, 746 &UFSHostDevice::readCallback>(this); 747 | 711 flashDisk->write(&(writeaddr[SectorSize * count]), 712 (offset / SectorSize) + count); 713} 714 715/** 716 * Constructor for the UFS Host device 717 */ 718 --- 21 unchanged lines hidden (view full) --- 740 lunAvail); 741 UFSDevice.resize(lunAvail); 742 743 transferDoneCallback = new MakeCallback<UFSHostDevice, 744 &UFSHostDevice::LUNSignal>(this); 745 memReadCallback = new MakeCallback<UFSHostDevice, 746 &UFSHostDevice::readCallback>(this); 747 |
748 for(int count = 0; count < lunAvail; count++) { | 748 for (int count = 0; count < lunAvail; count++) { |
749 UFSDevice[count] = new UFSSCSIDevice(p, count, transferDoneCallback, 750 memReadCallback); 751 } 752 753 if (UFSSlots > 31) 754 warn("UFSSlots = %d, this will results in %d command slots", 755 UFSSlots, (UFSSlots & 0x1F)); 756 --- 910 unchanged lines hidden (view full) --- 1667 * out who it was, and calls transferDone. 1668 */ 1669void 1670UFSHostDevice::LUNSignal() 1671{ 1672 uint8_t this_lun = 0; 1673 1674 //while we haven't found the right lun, keep searching | 749 UFSDevice[count] = new UFSSCSIDevice(p, count, transferDoneCallback, 750 memReadCallback); 751 } 752 753 if (UFSSlots > 31) 754 warn("UFSSlots = %d, this will results in %d command slots", 755 UFSSlots, (UFSSlots & 0x1F)); 756 --- 910 unchanged lines hidden (view full) --- 1667 * out who it was, and calls transferDone. 1668 */ 1669void 1670UFSHostDevice::LUNSignal() 1671{ 1672 uint8_t this_lun = 0; 1673 1674 //while we haven't found the right lun, keep searching |
1675 while((this_lun < lunAvail) && !UFSDevice[this_lun]->finishedCommand()) | 1675 while ((this_lun < lunAvail) && !UFSDevice[this_lun]->finishedCommand()) |
1676 ++this_lun; 1677 1678 if (this_lun < lunAvail) { 1679 //Clear signal. 1680 UFSDevice[this_lun]->clearSignal(); 1681 //found it; call transferDone 1682 transferDone(UFSDevice[this_lun]->transferInfo.responseStartAddr, 1683 UFSDevice[this_lun]->transferInfo.reqPos, --- 107 unchanged lines hidden (view full) --- 1791 1792 /**Garbage collection; sort out the allocated UTP descriptor*/ 1793 if (garbage.size() > 0) { 1794 delete garbage.front(); 1795 garbage.pop_front(); 1796 } 1797 1798 /**done, generate interrupt if we havent got one already*/ | 1676 ++this_lun; 1677 1678 if (this_lun < lunAvail) { 1679 //Clear signal. 1680 UFSDevice[this_lun]->clearSignal(); 1681 //found it; call transferDone 1682 transferDone(UFSDevice[this_lun]->transferInfo.responseStartAddr, 1683 UFSDevice[this_lun]->transferInfo.reqPos, --- 107 unchanged lines hidden (view full) --- 1791 1792 /**Garbage collection; sort out the allocated UTP descriptor*/ 1793 if (garbage.size() > 0) { 1794 delete garbage.front(); 1795 garbage.pop_front(); 1796 } 1797 1798 /**done, generate interrupt if we havent got one already*/ |
1799 if(!(UFSHCIMem.ORInterruptStatus & 0x01)) { | 1799 if (!(UFSHCIMem.ORInterruptStatus & 0x01)) { |
1800 UFSHCIMem.ORInterruptStatus |= UTPTransferREQCOMPL; 1801 generateInterrupt(); 1802 } 1803 1804 | 1800 UFSHCIMem.ORInterruptStatus |= UTPTransferREQCOMPL; 1801 generateInterrupt(); 1802 } 1803 1804 |
1805 if(!readDoneEvent.empty()) { | 1805 if (!readDoneEvent.empty()) { |
1806 readDoneEvent.pop_front(); 1807 } 1808} 1809 1810/** 1811 * set interrupt and sort out the doorbell register. 1812 */ 1813 --- 65 unchanged lines hidden (view full) --- 1879{ 1880 DPRINTF(UFSHostDevice, "Write transaction Start: 0x%8x; Size: %d\n", 1881 start, size); 1882 1883 /**check whether transfer is all the way to the flash*/ 1884 if (toDisk) { 1885 ++writePendingNum; 1886 | 1806 readDoneEvent.pop_front(); 1807 } 1808} 1809 1810/** 1811 * set interrupt and sort out the doorbell register. 1812 */ 1813 --- 65 unchanged lines hidden (view full) --- 1879{ 1880 DPRINTF(UFSHostDevice, "Write transaction Start: 0x%8x; Size: %d\n", 1881 start, size); 1882 1883 /**check whether transfer is all the way to the flash*/ 1884 if (toDisk) { 1885 ++writePendingNum; 1886 |
1887 while(!writeDoneEvent.empty() && (writeDoneEvent.front().when() | 1887 while (!writeDoneEvent.empty() && (writeDoneEvent.front().when() |
1888 < curTick())) 1889 writeDoneEvent.pop_front(); 1890 1891 writeDoneEvent.push_back(this); 1892 assert(!writeDoneEvent.back().scheduled()); 1893 1894 /**destination is an offset here since we are writing to a disk*/ 1895 struct transferInfo new_transfer; --- 342 unchanged lines hidden (view full) --- 2238 2239void 2240UFSHostDevice::readCallback() 2241{ 2242 DPRINTF(UFSHostDevice, "Read Callback\n"); 2243 uint8_t this_lun = 0; 2244 2245 //while we haven't found the right lun, keep searching | 1888 < curTick())) 1889 writeDoneEvent.pop_front(); 1890 1891 writeDoneEvent.push_back(this); 1892 assert(!writeDoneEvent.back().scheduled()); 1893 1894 /**destination is an offset here since we are writing to a disk*/ 1895 struct transferInfo new_transfer; --- 342 unchanged lines hidden (view full) --- 2238 2239void 2240UFSHostDevice::readCallback() 2241{ 2242 DPRINTF(UFSHostDevice, "Read Callback\n"); 2243 uint8_t this_lun = 0; 2244 2245 //while we haven't found the right lun, keep searching |
2246 while((this_lun < lunAvail) && !UFSDevice[this_lun]->finishedRead()) | 2246 while ((this_lun < lunAvail) && !UFSDevice[this_lun]->finishedRead()) |
2247 ++this_lun; 2248 2249 DPRINTF(UFSHostDevice, "Found LUN %d messages pending for clean: %d\n", 2250 this_lun, SSDReadPending.size()); 2251 2252 if (this_lun < lunAvail) { 2253 //Clear signal. 2254 UFSDevice[this_lun]->clearReadSignal(); --- 97 unchanged lines hidden --- | 2247 ++this_lun; 2248 2249 DPRINTF(UFSHostDevice, "Found LUN %d messages pending for clean: %d\n", 2250 this_lun, SSDReadPending.size()); 2251 2252 if (this_lun < lunAvail) { 2253 //Clear signal. 2254 UFSDevice[this_lun]->clearReadSignal(); --- 97 unchanged lines hidden --- |