1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

Kernel: Move the Storage directory to be a new directory under Devices

The Storage subsystem, like the Audio and HID subsystems, exposes Unix
device files (for example, in the /dev directory). To ensure consistency
across the repository, we should make the Storage subsystem to reside in
the Kernel/Devices directory like the two other mentioned subsystems.
This commit is contained in:
Liav A 2023-03-18 13:32:12 +02:00 committed by Jelle Raaijmakers
parent f3a58f3a5a
commit 500b7b08d6
59 changed files with 133 additions and 133 deletions

View file

@ -1,52 +0,0 @@
/*
* Copyright (c) 2023, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Storage/SD/Commands.h>
#include <Kernel/Storage/SD/SDHostController.h>
#include <Kernel/Storage/SD/SDMemoryCard.h>
namespace Kernel {
SDMemoryCard::SDMemoryCard(SDHostController& sdhc, StorageDevice::LUNAddress lun_address, u32 hardware_relative_controller_id, u32 block_len, u64 capacity_in_blocks, u32 relative_card_address, SD::OperatingConditionRegister ocr, SD::CardIdentificationRegister cid, SD::SDConfigurationRegister scr)
: StorageDevice(lun_address, hardware_relative_controller_id, block_len,
capacity_in_blocks)
, m_sdhc(sdhc)
, m_relative_card_address(relative_card_address)
, m_ocr(ocr)
, m_cid(cid)
, m_scr(scr)
{
}
void SDMemoryCard::start_request(AsyncBlockDeviceRequest& request)
{
// FIXME: Make this asynchronous
MutexLocker locker(m_lock);
VERIFY(request.block_size() == block_size());
auto buffer = request.buffer();
u32 block_address = request.block_index();
if (card_addressing_mode() == CardAddressingMode::ByteAddressing) {
block_address *= block_size();
}
if (request.request_type() == AsyncBlockDeviceRequest::RequestType::Write) {
if (m_sdhc.write_block({}, block_address, request.block_count(), buffer).is_error()) {
request.complete(AsyncDeviceRequest::Failure);
return;
}
} else {
if (m_sdhc.read_block({}, block_address, request.block_count(), buffer).is_error()) {
request.complete(AsyncDeviceRequest::Failure);
return;
}
}
request.complete(AsyncDeviceRequest::Success);
}
}