forked from Bananymous/banan-os
All: Cleanup all files
Add newline to end of files and remove whitespace from end of lines
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Kernel
|
||||
|
||||
if (!(pi & 1))
|
||||
continue;
|
||||
|
||||
|
||||
auto type = check_port_type(abar_mem.ports[i]);
|
||||
if (!type.has_value())
|
||||
continue;
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Kernel
|
||||
while (port->cmd & HBA_PxCMD_CR)
|
||||
continue;
|
||||
port->cmd = port->cmd | HBA_PxCMD_FRE;
|
||||
port->cmd = port->cmd | HBA_PxCMD_ST;
|
||||
port->cmd = port->cmd | HBA_PxCMD_ST;
|
||||
}
|
||||
|
||||
|
||||
static void stop_cmd(volatile HBAPortMemorySpace* port)
|
||||
{
|
||||
port->cmd = port->cmd & ~HBA_PxCMD_ST;
|
||||
@@ -58,7 +58,7 @@ namespace Kernel
|
||||
|
||||
m_data_dma_region = TRY(DMARegion::create(PAGE_SIZE));
|
||||
memset((void*)m_data_dma_region->vaddr(), 0x00, m_data_dma_region->size());
|
||||
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -211,14 +211,14 @@ namespace Kernel
|
||||
ASSERT(m_dma_region);
|
||||
ASSERT(m_data_dma_region);
|
||||
ASSERT(0 < sector_count && sector_count <= 0xFFFF + 1);
|
||||
|
||||
|
||||
ASSERT(sector_count * sector_size() <= m_data_dma_region->size());
|
||||
|
||||
m_port->is = ~(uint32_t)0;
|
||||
|
||||
auto slot = find_free_command_slot();
|
||||
ASSERT(slot.has_value());
|
||||
|
||||
|
||||
volatile auto& command_header = reinterpret_cast<volatile HBACommandHeader*>(m_dma_region->paddr_to_vaddr(m_port->clb))[slot.value()];
|
||||
command_header.cfl = sizeof(FISRegisterH2D) / sizeof(uint32_t);
|
||||
command_header.prdtl = 1;
|
||||
@@ -265,11 +265,11 @@ namespace Kernel
|
||||
fis_command.lba1 = (lba >> 8) & 0xFF;
|
||||
fis_command.lba2 = (lba >> 16) & 0xFF;
|
||||
fis_command.device = 1 << 6; // LBA mode
|
||||
|
||||
|
||||
fis_command.lba3 = (lba >> 24) & 0xFF;
|
||||
fis_command.lba4 = (lba >> 32) & 0xFF;
|
||||
fis_command.lba5 = (lba >> 40) & 0xFF;
|
||||
|
||||
|
||||
fis_command.count_lo = (sector_count >> 0) & 0xFF;
|
||||
fis_command.count_hi = (sector_count >> 8) & 0xFF;
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace Kernel
|
||||
return BAN::Error::from_error_code(ErrorCode::ATA_UNC);
|
||||
if (err & ATA_ERROR_BBK)
|
||||
return BAN::Error::from_error_code(ErrorCode::ATA_BBK);
|
||||
|
||||
|
||||
return BAN::Error::from_error_code(ErrorCode::None);
|
||||
}
|
||||
|
||||
@@ -331,4 +331,4 @@ namespace Kernel
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,4 +96,4 @@ namespace Kernel
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Kernel
|
||||
|
||||
if (!(m_capabilities & ATA_CAPABILITIES_LBA))
|
||||
return BAN::Error::from_error_code(ErrorCode::ATA_NoLBA);
|
||||
|
||||
|
||||
if ((identify_data[ATA_IDENTIFY_SECTOR_INFO] & (1 << 15)) == 0 &&
|
||||
(identify_data[ATA_IDENTIFY_SECTOR_INFO] & (1 << 14)) != 0 &&
|
||||
(identify_data[ATA_IDENTIFY_SECTOR_INFO] & (1 << 12)) != 0)
|
||||
@@ -132,4 +132,4 @@ namespace Kernel
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Kernel
|
||||
continue;
|
||||
if (cache.first_sector > page_cache_start)
|
||||
break;
|
||||
|
||||
|
||||
{
|
||||
CriticalScope _;
|
||||
PageTable::map_fast_page(cache.paddr);
|
||||
@@ -205,4 +205,4 @@ namespace Kernel
|
||||
release_pages(m_cache.size());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Kernel
|
||||
if (m_bar0->size() < 0x1000)
|
||||
{
|
||||
dwarnln("NVMe controller BAR0 is too small {} bytes", m_bar0->size());
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
}
|
||||
|
||||
m_controller_registers = reinterpret_cast<volatile NVMe::ControllerRegisters*>(m_bar0->vaddr());
|
||||
@@ -171,7 +171,7 @@ namespace Kernel
|
||||
BAN::ErrorOr<void> NVMeController::identify_namespaces()
|
||||
{
|
||||
auto dma_page = TRY(DMARegion::create(PAGE_SIZE));
|
||||
|
||||
|
||||
BAN::Vector<uint32_t> namespace_ids;
|
||||
TRY(namespace_ids.resize(PAGE_SIZE / sizeof(uint32_t)));
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Kernel
|
||||
m_done = false;
|
||||
return m_status;
|
||||
}
|
||||
|
||||
|
||||
while (SystemTimer::get().ms_since_boot() < start_time + s_nvme_command_timeout_ms)
|
||||
{
|
||||
if (!m_done)
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Kernel
|
||||
if (partition_ptr == nullptr)
|
||||
return BAN::Error::from_errno(ENOMEM);
|
||||
return BAN::RefPtr<Partition>::adopt(partition_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
Partition::Partition(BAN::RefPtr<BlockDevice> device, const BAN::GUID& type, const BAN::GUID& guid, uint64_t first_block, uint64_t last_block, uint64_t attr, const char* label, uint32_t index, BAN::StringView name_prefix)
|
||||
: BlockDevice(0660, 0, 0)
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Kernel
|
||||
BAN::UTF8::from_codepoints(entry.partition_name, 36, utf8_name);
|
||||
|
||||
auto partition = TRY(Partition::create(
|
||||
this,
|
||||
this,
|
||||
entry.partition_type_guid,
|
||||
entry.unique_partition_guid,
|
||||
entry.starting_lba,
|
||||
@@ -239,7 +239,7 @@ namespace Kernel
|
||||
TRY(read_sectors_impl(lba + offset, 1, sector_buffer));
|
||||
(void)m_disk_cache->write_to_cache(lba + offset, sector_buffer, false);
|
||||
}
|
||||
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user