src/dev/arm/ufs_device.cc
/**
 * Constructor and destructor functions of UFSHCM device
 */
Constructor and destructor functions of UFSHCM device
Constructor and destructor functions of UFSHCM device
UFSHostDevice::UFSSCSIDevice::UFSSCSIDevice(const UFSHostDeviceParams &p,
                             uint32_t lun_id, const Callback &transfer_cb,
                             const Callback &read_cb):
    SimObject(p),
    flashDisk(p.image[lun_id]),
    flashDevice(p.internalflash[lun_id]),
    blkSize(p.img_blk_size),
    lunAvail(p.image.size()),
    diskSize(flashDisk->size()),
    capacityLower((diskSize - 1) & 0xffffffff),
    capacityUpper((diskSize - SectorSize) >> 32),
    lunID(lun_id),
    transferCompleted(false),
    readCompleted(false),
    totalRead(0),
    totalWrite(0),
    amountOfWriteTransfers(0),
    amountOfReadTransfers(0)
{
    signalDone = transfer_cb;
    memReadCallback = [this]() { readCallback(); };
    deviceReadCallback = read_cb;
    memWriteCallback = [this]() { SSDWriteDone(); };
    uint32_t temp_id = ((lun_id | 0x30) << 24) | 0x3A4449;
    lunInfo.dWord0 = 0x02060000;   
    lunInfo.dWord1 = 0x0200001F;
    lunInfo.vendor0 = 0x484D5241;  
    lunInfo.vendor1 = 0x424D4143;  
    lunInfo.product0 = 0x356D6567; 
    lunInfo.product1 = 0x4D534655; 
    lunInfo.product2 = 0x4C45444F; 
    lunInfo.product3 = temp_id;    
    lunInfo.productRevision = 0x01000000; 
    DPRINTF(UFSHostDevice, "Logic unit %d assumes that %d logic units are"
            " present in the system\n", lunID, lunAvail);
    DPRINTF(UFSHostDevice,"The disksize of lun: %d should be %d blocks\n",
            lunID, diskSize);
    flashDevice->initializeMemory(diskSize, SectorSize);
}
UFSHostDevice :: UFSSCSIDevice :: UFSSCSIDevice ( const UFSHostDeviceParams & p , uint32_t lun_id , const Callback & transfer_cb , const Callback & read_cb ) : SimObject ( p ) , flashDisk ( p . image [ lun_id ] ) , flashDevice ( p . internalflash [ lun_id ] ) , blkSize ( p . img_blk_size ) , lunAvail ( p . image . size ( ) ) , diskSize ( flashDisk -> size ( ) ) , capacityLower ( ( diskSize - 1 ) & 0xffffffff ) , capacityUpper ( ( diskSize - SectorSize ) >> 32 ) , lunID ( lun_id ) , transferCompleted ( false ) , readCompleted ( false ) , totalRead ( 0 ) , totalWrite ( 0 ) , amountOfWriteTransfers ( 0 ) , amountOfReadTransfers ( 0 ) { signalDone = transfer_cb ; memReadCallback = [ this ] ( ) { readCallback ( ) ; } ; deviceReadCallback = read_cb ; memWriteCallback = [ this ] ( ) { SSDWriteDone ( ) ; } ; uint32_t temp_id = ( ( lun_id | 0x30 ) << 24 ) | 0x3A4449 ; lunInfo . dWord0 = 0x02060000 ; lunInfo . dWord1 = 0x0200001F ; lunInfo . vendor0 = 0x484D5241 ; lunInfo . vendor1 = 0x424D4143 ; lunInfo . product0 = 0x356D6567 ; lunInfo . product1 = 0x4D534655 ; lunInfo . product2 = 0x4C45444F ; lunInfo . product3 = temp_id ; lunInfo . productRevision = 0x01000000 ; DPRINTF ( UFSHostDevice , " " " \n " , lunID , lunAvail ) ; DPRINTF ( UFSHostDevice , " \n " , lunID , diskSize ) ; flashDevice -> initializeMemory ( diskSize , SectorSize ) ; }
Constructor and destructor functions of UFSHCM device
Constructor and destructor functions of UFSHCM device
/**
     * These callbacks are used to communicate the events that are
     * triggered upstream; e.g. from the Memory Device to the UFS SCSI Device
     * or from the UFS SCSI device to the UFS host.
     */ /**
     * make ascii out of lun_id (and add more characters)
     * UFS allows up to 8 logic units, so the numbering should work out
     */ //data //ARMH (HMRA) //CAMB (BMAC) //gem5  (5meg) //UFSM (MSFU) //ODEL (LEDO) // ID:"lun_id" ("lun_id":DI) //0x01