From 7719ef3a61e92effc341980b85ea4e363a61a820 Mon Sep 17 00:00:00 2001 From: Liav A Date: Sat, 20 Nov 2021 17:28:59 +0200 Subject: Kernel/Storage: Move ATA device signature definitions to a general file --- Kernel/Storage/ATA/AHCI/Definitions.h | 8 -------- Kernel/Storage/ATA/AHCI/Port.cpp | 2 +- Kernel/Storage/ATA/AHCI/Port.h | 3 ++- Kernel/Storage/ATA/Definitions.h | 11 +++++++++++ 4 files changed, 14 insertions(+), 10 deletions(-) (limited to 'Kernel') diff --git a/Kernel/Storage/ATA/AHCI/Definitions.h b/Kernel/Storage/ATA/AHCI/Definitions.h index 988994ea2a..ffab5a4912 100644 --- a/Kernel/Storage/ATA/AHCI/Definitions.h +++ b/Kernel/Storage/ATA/AHCI/Definitions.h @@ -264,14 +264,6 @@ struct [[gnu::packed]] HBADefinedCapabilities { bool devsleep_entrance_from_slumber_only : 1 { false }; }; -enum DeviceSignature : u32 { - ATA = 0x00000101, - ATAPI = 0xEB140101, - EnclosureManagementBridge = 0xC33C0101, - PortMultiplier = 0x96690101, - Unconnected = 0xFFFFFFFF -}; - enum class DeviceDetectionInitialization { NoActionRequested, PerformInterfaceInitializationSequence, diff --git a/Kernel/Storage/ATA/AHCI/Port.cpp b/Kernel/Storage/ATA/AHCI/Port.cpp index 33059435ec..97a77b0cdb 100644 --- a/Kernel/Storage/ATA/AHCI/Port.cpp +++ b/Kernel/Storage/ATA/AHCI/Port.cpp @@ -686,7 +686,7 @@ bool AHCIPort::identify_device() command_table.descriptors[0].byte_count = 512 - 1; auto& fis = *(volatile FIS::HostToDevice::Register*)command_table.command_fis; fis.header.fis_type = (u8)FIS::Type::RegisterHostToDevice; - fis.command = m_port_registers.sig == AHCI::DeviceSignature::ATAPI ? ATA_CMD_IDENTIFY_PACKET : ATA_CMD_IDENTIFY; + fis.command = m_port_registers.sig == ATA::DeviceSignature::ATAPI ? ATA_CMD_IDENTIFY_PACKET : ATA_CMD_IDENTIFY; fis.device = 0; fis.header.port_muliplier = fis.header.port_muliplier | (u8)FIS::HeaderAttributes::C; diff --git a/Kernel/Storage/ATA/AHCI/Port.h b/Kernel/Storage/ATA/AHCI/Port.h index db06200579..b2a38dd1f4 100644 --- a/Kernel/Storage/ATA/AHCI/Port.h +++ b/Kernel/Storage/ATA/AHCI/Port.h @@ -23,6 +23,7 @@ #include #include #include +#include #include namespace Kernel { @@ -41,7 +42,7 @@ public: u32 port_index() const { return m_port_index; } u32 representative_port_index() const { return port_index() + 1; } bool is_operable() const; - bool is_atapi_attached() const { return m_port_registers.sig == (u32)AHCI::DeviceSignature::ATAPI; }; + bool is_atapi_attached() const { return m_port_registers.sig == (u32)ATA::DeviceSignature::ATAPI; }; RefPtr connected_device() const { return m_connected_device; } diff --git a/Kernel/Storage/ATA/Definitions.h b/Kernel/Storage/ATA/Definitions.h index 92ac91f9f1..67499e6f40 100644 --- a/Kernel/Storage/ATA/Definitions.h +++ b/Kernel/Storage/ATA/Definitions.h @@ -6,6 +6,17 @@ #pragma once +namespace Kernel::ATA { + +enum DeviceSignature : u32 { + ATA = 0x00000101, + ATAPI = 0xEB140101, + EnclosureManagementBridge = 0xC33C0101, + PortMultiplier = 0x96690101, + Unconnected = 0xFFFFFFFF +}; +} + #define ATA_SR_BSY 0x80 #define ATA_SR_DRDY 0x40 #define ATA_SR_DF 0x20 -- cgit v1.2.3