2021-02-26 01:25:45 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-26 01:25:45 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <AK/StringView.h>
|
|
|
|
|
#include <Kernel/FileSystem/FileDescription.h>
|
|
|
|
|
#include <Kernel/Storage/AHCIController.h>
|
|
|
|
|
#include <Kernel/Storage/IDEChannel.h>
|
|
|
|
|
#include <Kernel/Storage/SATADiskDevice.h>
|
|
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
|
2021-03-16 16:23:16 -03:00
|
|
|
NonnullRefPtr<SATADiskDevice> SATADiskDevice::create(const AHCIController& controller, const AHCIPort& port, size_t sector_size, u64 max_addressable_block)
|
2021-02-26 01:25:45 -03:00
|
|
|
{
|
2021-04-23 11:46:57 -03:00
|
|
|
return adopt_ref(*new SATADiskDevice(controller, port, sector_size, max_addressable_block));
|
2021-02-26 01:25:45 -03:00
|
|
|
}
|
|
|
|
|
|
2021-03-16 16:23:16 -03:00
|
|
|
SATADiskDevice::SATADiskDevice(const AHCIController& controller, const AHCIPort& port, size_t sector_size, u64 max_addressable_block)
|
2021-02-26 01:25:45 -03:00
|
|
|
: StorageDevice(controller, sector_size, max_addressable_block)
|
|
|
|
|
, m_port(port)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SATADiskDevice::~SATADiskDevice()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-10 20:46:09 -03:00
|
|
|
StringView SATADiskDevice::class_name() const
|
2021-02-26 01:25:45 -03:00
|
|
|
{
|
|
|
|
|
return "SATADiskDevice";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SATADiskDevice::start_request(AsyncBlockDeviceRequest& request)
|
|
|
|
|
{
|
|
|
|
|
m_port->start_request(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String SATADiskDevice::device_name() const
|
|
|
|
|
{
|
|
|
|
|
return String::formatted("hd{:c}", 'a' + minor());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|