mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
Kernel: Rename ScopedSpinlock => SpinlockLocker
This matches MutexLocker, and doesn't sound like it's a lock itself.
This commit is contained in:
parent
55adace359
commit
c922a7da09
78 changed files with 365 additions and 366 deletions
|
@ -117,7 +117,7 @@ VirtualAddress MMIOAccess::get_device_configuration_space(Address address)
|
|||
|
||||
u8 MMIOAccess::read8_field(Address address, u32 field)
|
||||
{
|
||||
ScopedSpinlock lock(m_access_lock);
|
||||
SpinlockLocker lock(m_access_lock);
|
||||
VERIFY(field <= 0xfff);
|
||||
dbgln_if(PCI_DEBUG, "PCI: MMIO Reading 8-bit field {:#08x} for {}", field, address);
|
||||
return *((volatile u8*)(get_device_configuration_space(address).get() + (field & 0xfff)));
|
||||
|
@ -125,7 +125,7 @@ u8 MMIOAccess::read8_field(Address address, u32 field)
|
|||
|
||||
u16 MMIOAccess::read16_field(Address address, u32 field)
|
||||
{
|
||||
ScopedSpinlock lock(m_access_lock);
|
||||
SpinlockLocker lock(m_access_lock);
|
||||
VERIFY(field < 0xfff);
|
||||
dbgln_if(PCI_DEBUG, "PCI: MMIO Reading 16-bit field {:#08x} for {}", field, address);
|
||||
u16 data = 0;
|
||||
|
@ -135,7 +135,7 @@ u16 MMIOAccess::read16_field(Address address, u32 field)
|
|||
|
||||
u32 MMIOAccess::read32_field(Address address, u32 field)
|
||||
{
|
||||
ScopedSpinlock lock(m_access_lock);
|
||||
SpinlockLocker lock(m_access_lock);
|
||||
VERIFY(field <= 0xffc);
|
||||
dbgln_if(PCI_DEBUG, "PCI: MMIO Reading 32-bit field {:#08x} for {}", field, address);
|
||||
u32 data = 0;
|
||||
|
@ -145,21 +145,21 @@ u32 MMIOAccess::read32_field(Address address, u32 field)
|
|||
|
||||
void MMIOAccess::write8_field(Address address, u32 field, u8 value)
|
||||
{
|
||||
ScopedSpinlock lock(m_access_lock);
|
||||
SpinlockLocker lock(m_access_lock);
|
||||
VERIFY(field <= 0xfff);
|
||||
dbgln_if(PCI_DEBUG, "PCI: MMIO Writing 8-bit field {:#08x}, value={:#02x} for {}", field, value, address);
|
||||
*((volatile u8*)(get_device_configuration_space(address).get() + (field & 0xfff))) = value;
|
||||
}
|
||||
void MMIOAccess::write16_field(Address address, u32 field, u16 value)
|
||||
{
|
||||
ScopedSpinlock lock(m_access_lock);
|
||||
SpinlockLocker lock(m_access_lock);
|
||||
VERIFY(field < 0xfff);
|
||||
dbgln_if(PCI_DEBUG, "PCI: MMIO Writing 16-bit field {:#08x}, value={:#02x} for {}", field, value, address);
|
||||
ByteReader::store<u16>(get_device_configuration_space(address).offset(field & 0xfff).as_ptr(), value);
|
||||
}
|
||||
void MMIOAccess::write32_field(Address address, u32 field, u32 value)
|
||||
{
|
||||
ScopedSpinlock lock(m_access_lock);
|
||||
SpinlockLocker lock(m_access_lock);
|
||||
VERIFY(field <= 0xffc);
|
||||
dbgln_if(PCI_DEBUG, "PCI: MMIO Writing 32-bit field {:#08x}, value={:#02x} for {}", field, value, address);
|
||||
ByteReader::store<u32>(get_device_configuration_space(address).offset(field & 0xfff).as_ptr(), value);
|
||||
|
|
|
@ -57,7 +57,7 @@ KResultOr<size_t> SysFSUSBDeviceInformation::read_bytes(off_t offset, size_t cou
|
|||
|
||||
KResult SysFSUSBBusDirectory::traverse_as_directory(unsigned fsid, Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
|
||||
{
|
||||
ScopedSpinlock lock(m_lock);
|
||||
SpinlockLocker lock(m_lock);
|
||||
// Note: if the parent directory is null, it means something bad happened as this should not happen for the USB directory.
|
||||
VERIFY(m_parent_directory);
|
||||
callback({ ".", { fsid, component_index() }, 0 });
|
||||
|
@ -72,7 +72,7 @@ KResult SysFSUSBBusDirectory::traverse_as_directory(unsigned fsid, Function<bool
|
|||
|
||||
RefPtr<SysFSComponent> SysFSUSBBusDirectory::lookup(StringView name)
|
||||
{
|
||||
ScopedSpinlock lock(m_lock);
|
||||
SpinlockLocker lock(m_lock);
|
||||
for (auto& device_node : m_device_nodes) {
|
||||
if (device_node.name() == name) {
|
||||
return device_node;
|
||||
|
@ -93,7 +93,7 @@ RefPtr<SysFSUSBDeviceInformation> SysFSUSBBusDirectory::device_node_for(USB::Dev
|
|||
|
||||
void SysFSUSBBusDirectory::plug(USB::Device& new_device)
|
||||
{
|
||||
ScopedSpinlock lock(m_lock);
|
||||
SpinlockLocker lock(m_lock);
|
||||
auto device_node = device_node_for(new_device);
|
||||
VERIFY(!device_node);
|
||||
m_device_nodes.append(SysFSUSBDeviceInformation::create(new_device));
|
||||
|
@ -101,7 +101,7 @@ void SysFSUSBBusDirectory::plug(USB::Device& new_device)
|
|||
|
||||
void SysFSUSBBusDirectory::unplug(USB::Device& deleted_device)
|
||||
{
|
||||
ScopedSpinlock lock(m_lock);
|
||||
SpinlockLocker lock(m_lock);
|
||||
auto device_node = device_node_for(deleted_device);
|
||||
VERIFY(device_node);
|
||||
device_node->m_list_node.remove();
|
||||
|
|
|
@ -64,9 +64,9 @@ void VirtIOConsole::handle_queue_update(u16 queue_index)
|
|||
dbgln_if(VIRTIO_DEBUG, "VirtIOConsole: Handle queue update {}", queue_index);
|
||||
|
||||
if (queue_index == CONTROL_RECEIVEQ) {
|
||||
ScopedSpinlock ringbuffer_lock(m_control_receive_buffer->lock());
|
||||
SpinlockLocker ringbuffer_lock(m_control_receive_buffer->lock());
|
||||
auto& queue = get_queue(CONTROL_RECEIVEQ);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
size_t used;
|
||||
VirtIOQueueChain popped_chain = queue.pop_used_buffer_chain(used);
|
||||
|
||||
|
@ -81,9 +81,9 @@ void VirtIOConsole::handle_queue_update(u16 queue_index)
|
|||
popped_chain = queue.pop_used_buffer_chain(used);
|
||||
}
|
||||
} else if (queue_index == CONTROL_TRANSMITQ) {
|
||||
ScopedSpinlock ringbuffer_lock(m_control_transmit_buffer->lock());
|
||||
SpinlockLocker ringbuffer_lock(m_control_transmit_buffer->lock());
|
||||
auto& queue = get_queue(CONTROL_TRANSMITQ);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
size_t used;
|
||||
VirtIOQueueChain popped_chain = queue.pop_used_buffer_chain(used);
|
||||
auto number_of_messages = 0;
|
||||
|
@ -112,7 +112,7 @@ void VirtIOConsole::setup_multiport()
|
|||
m_control_transmit_buffer = make<Memory::RingBuffer>("VirtIOConsole control transmit queue", CONTROL_BUFFER_SIZE);
|
||||
|
||||
auto& queue = get_queue(CONTROL_RECEIVEQ);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
VirtIOQueueChain chain(queue);
|
||||
auto offset = 0ul;
|
||||
|
||||
|
@ -184,7 +184,7 @@ void VirtIOConsole::process_control_message(ControlMessage message)
|
|||
}
|
||||
void VirtIOConsole::write_control_message(ControlMessage message)
|
||||
{
|
||||
ScopedSpinlock ringbuffer_lock(m_control_transmit_buffer->lock());
|
||||
SpinlockLocker ringbuffer_lock(m_control_transmit_buffer->lock());
|
||||
|
||||
PhysicalAddress start_of_chunk;
|
||||
size_t length_of_chunk;
|
||||
|
@ -197,7 +197,7 @@ void VirtIOConsole::write_control_message(ControlMessage message)
|
|||
}
|
||||
|
||||
auto& queue = get_queue(CONTROL_TRANSMITQ);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
VirtIOQueueChain chain(queue);
|
||||
|
||||
bool did_add_buffer = chain.add_buffer_to_chain(start_of_chunk, length_of_chunk, BufferType::DeviceReadable);
|
||||
|
|
|
@ -27,7 +27,7 @@ VirtIOConsolePort::VirtIOConsolePort(unsigned port, VirtIOConsole& console)
|
|||
void VirtIOConsolePort::init_receive_buffer()
|
||||
{
|
||||
auto& queue = m_console.get_queue(m_receive_queue);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
VirtIOQueueChain chain(queue);
|
||||
|
||||
auto buffer_start = m_receive_buffer->start_of_region();
|
||||
|
@ -42,11 +42,11 @@ void VirtIOConsolePort::handle_queue_update(Badge<VirtIOConsole>, u16 queue_inde
|
|||
VERIFY(queue_index == m_transmit_queue || queue_index == m_receive_queue);
|
||||
if (queue_index == m_receive_queue) {
|
||||
auto& queue = m_console.get_queue(m_receive_queue);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
size_t used;
|
||||
VirtIOQueueChain popped_chain = queue.pop_used_buffer_chain(used);
|
||||
|
||||
ScopedSpinlock ringbuffer_lock(m_receive_buffer->lock());
|
||||
SpinlockLocker ringbuffer_lock(m_receive_buffer->lock());
|
||||
auto used_space = m_receive_buffer->reserve_space(used).value();
|
||||
auto remaining_space = m_receive_buffer->bytes_till_end();
|
||||
|
||||
|
@ -65,9 +65,9 @@ void VirtIOConsolePort::handle_queue_update(Badge<VirtIOConsole>, u16 queue_inde
|
|||
|
||||
evaluate_block_conditions();
|
||||
} else {
|
||||
ScopedSpinlock ringbuffer_lock(m_transmit_buffer->lock());
|
||||
SpinlockLocker ringbuffer_lock(m_transmit_buffer->lock());
|
||||
auto& queue = m_console.get_queue(m_transmit_queue);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
size_t used;
|
||||
VirtIOQueueChain popped_chain = queue.pop_used_buffer_chain(used);
|
||||
do {
|
||||
|
@ -92,7 +92,7 @@ KResultOr<size_t> VirtIOConsolePort::read(FileDescription& desc, u64, UserOrKern
|
|||
if (!size)
|
||||
return 0;
|
||||
|
||||
ScopedSpinlock ringbuffer_lock(m_receive_buffer->lock());
|
||||
SpinlockLocker ringbuffer_lock(m_receive_buffer->lock());
|
||||
|
||||
if (!can_read(desc, size))
|
||||
return EAGAIN;
|
||||
|
@ -102,7 +102,7 @@ KResultOr<size_t> VirtIOConsolePort::read(FileDescription& desc, u64, UserOrKern
|
|||
|
||||
if (m_receive_buffer_exhausted && m_receive_buffer->used_bytes() == 0) {
|
||||
auto& queue = m_console.get_queue(m_receive_queue);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
VirtIOQueueChain new_chain(queue);
|
||||
new_chain.add_buffer_to_chain(m_receive_buffer->start_of_region(), RINGBUFFER_SIZE, BufferType::DeviceWritable);
|
||||
m_console.supply_chain_and_notify(m_receive_queue, new_chain);
|
||||
|
@ -122,9 +122,9 @@ KResultOr<size_t> VirtIOConsolePort::write(FileDescription& desc, u64, const Use
|
|||
if (!size)
|
||||
return 0;
|
||||
|
||||
ScopedSpinlock ringbuffer_lock(m_transmit_buffer->lock());
|
||||
SpinlockLocker ringbuffer_lock(m_transmit_buffer->lock());
|
||||
auto& queue = m_console.get_queue(m_transmit_queue);
|
||||
ScopedSpinlock queue_lock(queue.lock());
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
|
||||
if (!can_write(desc, size))
|
||||
return EAGAIN;
|
||||
|
|
|
@ -43,13 +43,13 @@ VirtIOQueue::~VirtIOQueue()
|
|||
|
||||
void VirtIOQueue::enable_interrupts()
|
||||
{
|
||||
ScopedSpinlock lock(m_lock);
|
||||
SpinlockLocker lock(m_lock);
|
||||
m_driver->flags = 0;
|
||||
}
|
||||
|
||||
void VirtIOQueue::disable_interrupts()
|
||||
{
|
||||
ScopedSpinlock lock(m_lock);
|
||||
SpinlockLocker lock(m_lock);
|
||||
m_driver->flags = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void VirtIORNG::handle_queue_update(u16 queue_index)
|
|||
size_t available_entropy = 0, used;
|
||||
auto& queue = get_queue(REQUESTQ);
|
||||
{
|
||||
ScopedSpinlock lock(queue.lock());
|
||||
SpinlockLocker lock(queue.lock());
|
||||
auto chain = queue.pop_used_buffer_chain(used);
|
||||
if (chain.is_empty())
|
||||
return;
|
||||
|
@ -64,7 +64,7 @@ void VirtIORNG::handle_queue_update(u16 queue_index)
|
|||
void VirtIORNG::request_entropy_from_host()
|
||||
{
|
||||
auto& queue = get_queue(REQUESTQ);
|
||||
ScopedSpinlock lock(queue.lock());
|
||||
SpinlockLocker lock(queue.lock());
|
||||
VirtIOQueueChain chain(queue);
|
||||
chain.add_buffer_to_chain(m_entropy_buffer->physical_page(0)->paddr(), PAGE_SIZE, BufferType::DeviceWritable);
|
||||
supply_chain_and_notify(REQUESTQ, chain);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue