class RequestProcessor

Defined at line 21 of file ../../src/devices/block/drivers/ufs/request_processor.h

Protected Members

mutex slot_lock_
uint32_t allocated_slots_mask_
RequestList slots_
bool slot_allocation_blocked_
condition_variable_any slot_released_
Ufs & controller_
MmioView register_
duration timeout_
atomic disable_completion_

Public Methods

template <typename Processor, typename Descriptor>
zx::result<std::unique_ptr<Processor>> Create (Ufs & ufs, zx::unowned_bti bti, const fdf::MmioView mmio, uint8_t entry_count)

Defined at line 17 of file ../../src/devices/block/drivers/ufs/request_processor.cc

void RequestProcessor (RequestList request_list, Ufs & ufs, zx::unowned_bti bti, const fdf::MmioView mmio, uint32_t slot_count)

Defined at line 23 of file ../../src/devices/block/drivers/ufs/request_processor.h

void ~RequestProcessor ()

Defined at line 30 of file ../../src/devices/block/drivers/ufs/request_processor.h

uint8_t GetSlotCount ()

Defined at line 44 of file ../../src/devices/block/drivers/ufs/request_processor.h

RequestList & GetRequestListLocked ()

For testing

Defined at line 47 of file ../../src/devices/block/drivers/ufs/request_processor.h

const RequestList & GetRequestListLocked ()

Defined at line 48 of file ../../src/devices/block/drivers/ufs/request_processor.h

std::mutex & GetSlotLock ()

Defined at line 49 of file ../../src/devices/block/drivers/ufs/request_processor.h

void EnableCompletion ()

Defined at line 53 of file ../../src/devices/block/drivers/ufs/request_processor.h

zx::result<> Init ()

Write the address of the list to the list base address register and set the run-stop register.

uint32_t ProcessCompletionOfIoRequests ()

Check all slots to process completed requests. This function returns the number of completed

requests. This function is called by the ISR.

void SetTimeout (zx::duration timeout)

Defined at line 50 of file ../../src/devices/block/drivers/ufs/request_processor.h

zx::duration GetTimeout ()

Defined at line 51 of file ../../src/devices/block/drivers/ufs/request_processor.h

void DisableCompletion ()

Defined at line 52 of file ../../src/devices/block/drivers/ufs/request_processor.h

zx::result<> BlockSlotAllocation (zx::duration drain_timeout)

Stops ReserveSlot() from handing out any further slots and waits until the slots that are

already allocated have been released, i.e. their requests have completed. The flag and the

wait are both under slot_lock_, so once this returns ZX_OK no request can reach the hardware

through this processor until UnblockSlotAllocation() is called. The admin slot

(TransferRequestProcessor::ReserveAdminSlot()) is not gated: the power sequence itself needs

admin UPIUs. Returns ZX_ERR_TIMED_OUT if the allocated slots do not drain within

|drain_timeout|; allocation stays blocked in that case as well.

Defined at line 104 of file ../../src/devices/block/drivers/ufs/request_processor.cc

void UnblockSlotAllocation ()

Defined at line 136 of file ../../src/devices/block/drivers/ufs/request_processor.cc

Protected Methods

template <typename Callback>
void ForEachAllocatedSlotLocked (Callback && callback, uint32_t excluded_mask)

Defined at line 79 of file ../../src/devices/block/drivers/ufs/request_processor.h

zx::result<uint8_t> ReserveSlot ()

Get the number of the free slot and mark it as |SlotState::kReserved|.

Defined at line 56 of file ../../src/devices/block/drivers/ufs/request_processor.cc

zx::unowned_bti & GetBti ()

Defined at line 66 of file ../../src/devices/block/drivers/ufs/request_processor.h

void SetSlotStateLocked (uint8_t slot_num, SlotState state)

Defined at line 68 of file ../../src/devices/block/drivers/ufs/request_processor.h

zx::result<> ClearSlot (RequestSlot & request_slot)

Defined at line 99 of file ../../src/devices/block/drivers/ufs/request_processor.cc

zx::result<> ClearSlotLocked (RequestSlot & request_slot)

Defined at line 79 of file ../../src/devices/block/drivers/ufs/request_processor.cc

void ReclaimTimedOutSlotsLocked ()

Defined at line 44 of file ../../src/devices/block/drivers/ufs/request_processor.cc

void RingRequestDoorbell (uint8_t slot_num)

Ring the door bell.

Defined at line 153 of file ../../src/devices/block/drivers/ufs/request_processor.cc

void RingRequestDoorbellLocked (uint8_t slot_num)

Defined at line 141 of file ../../src/devices/block/drivers/ufs/request_processor.cc