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:
@@ -37,68 +37,68 @@ namespace Kernel
|
||||
struct FISRegisterH2D
|
||||
{
|
||||
uint8_t fis_type; // FIS_TYPE_REGISTER_H2D
|
||||
|
||||
|
||||
uint8_t pm_port : 4; // Port multiplier
|
||||
uint8_t __reserved0 : 3;
|
||||
uint8_t c : 1; // 1: Command, 0: Control
|
||||
|
||||
|
||||
uint8_t command;
|
||||
uint8_t feature_lo; // Feature register, 7:0
|
||||
|
||||
|
||||
uint8_t lba0; // LBA low register, 7:0
|
||||
uint8_t lba1; // LBA mid register, 15:8
|
||||
uint8_t lba2; // LBA high register, 23:16
|
||||
uint8_t device;
|
||||
|
||||
|
||||
uint8_t lba3; // LBA register, 31:24
|
||||
uint8_t lba4; // LBA register, 39:32
|
||||
uint8_t lba5; // LBA register, 47:40
|
||||
uint8_t feature_hi; // Feature register, 15:8
|
||||
|
||||
|
||||
uint8_t count_lo; // Count register, 7:0
|
||||
uint8_t count_hi; // Count register, 15:8
|
||||
uint8_t icc; // Isochronous command completion
|
||||
uint8_t control;
|
||||
|
||||
|
||||
uint8_t __reserved1[4];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct FISRegisterD2H
|
||||
{
|
||||
uint8_t fis_type; // FIS_TYPE_REGISTER_D2H
|
||||
|
||||
|
||||
uint8_t pm_port : 4; // Port multiplier
|
||||
uint8_t __reserved0 : 2;
|
||||
uint8_t i : 1; // Interrupt bit
|
||||
uint8_t __reserved1 : 1;
|
||||
|
||||
|
||||
uint8_t status;
|
||||
uint8_t error;
|
||||
|
||||
|
||||
uint8_t lba0; // LBA low register, 7:0
|
||||
uint8_t lba1; // LBA mid register, 15:8
|
||||
uint8_t lba2; // LBA high register, 23:16
|
||||
uint8_t device;
|
||||
|
||||
|
||||
uint8_t lba3; // LBA register, 31:24
|
||||
uint8_t lba4; // LBA register, 39:32
|
||||
uint8_t lba5; // LBA register, 47:40
|
||||
uint8_t __reserved2;
|
||||
|
||||
|
||||
uint8_t count_lo; // Count register, 7:0
|
||||
uint8_t count_hi; // Count register, 15:8
|
||||
uint8_t __reserved3[2];
|
||||
|
||||
|
||||
uint8_t __reserved4[4];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct FISDataBI
|
||||
{
|
||||
uint8_t fis_type; // FIS_TYPE_DATA
|
||||
|
||||
|
||||
uint8_t pm_port : 4; // Port multiplier
|
||||
uint8_t __reserved0 : 4;
|
||||
|
||||
|
||||
uint8_t __reserved1[2];
|
||||
|
||||
uint32_t data[0]; // Payload (1 - 2048 dwords)
|
||||
@@ -122,31 +122,31 @@ namespace Kernel
|
||||
struct PIOSetupD2H
|
||||
{
|
||||
uint8_t fis_type; // FIS_TYPE_PIO_SETUP
|
||||
|
||||
|
||||
uint8_t pm_port : 4; // Port multiplier
|
||||
uint8_t __reserved0 : 1;
|
||||
uint8_t d : 1; // Data transfer direction, 1 - device to host
|
||||
uint8_t i : 1; // Interrupt bit
|
||||
uint8_t __reserved1 : 1;
|
||||
|
||||
|
||||
uint8_t status;
|
||||
uint8_t error;
|
||||
|
||||
|
||||
uint8_t lba0; // LBA low register, 7:0
|
||||
uint8_t lba1; // LBA mid register, 15:8
|
||||
uint8_t lba2; // LBA high register, 23:16
|
||||
uint8_t device;
|
||||
|
||||
|
||||
uint8_t lba3; // LBA register, 31:24
|
||||
uint8_t lba4; // LBA register, 39:32
|
||||
uint8_t lba5; // LBA register, 47:40
|
||||
uint8_t __reserved2;
|
||||
|
||||
|
||||
uint8_t count_lo; // Count register, 7:0
|
||||
uint8_t count_hi; // Count register, 15:8
|
||||
uint8_t __reserved3;
|
||||
uint8_t e_status; // New value of status register
|
||||
|
||||
|
||||
uint16_t tc; // Transfer count
|
||||
uint8_t __reserved4[2];
|
||||
} __attribute__((packed));
|
||||
@@ -154,13 +154,13 @@ namespace Kernel
|
||||
struct DMASetupBI
|
||||
{
|
||||
uint8_t fis_type; // FIS_TYPE_DMA_SETUP
|
||||
|
||||
|
||||
uint8_t pm_port : 4; // Port multiplier
|
||||
uint8_t __reserved0 : 1;
|
||||
uint8_t d : 1; // Data transfer direction, 1 - device to host
|
||||
uint8_t i : 1; // Interrupt bit
|
||||
uint8_t a : 1; // Auto-activate. Specifies if DMA Activate FIS is needed
|
||||
|
||||
|
||||
uint8_t __reserved1[2];
|
||||
|
||||
uint64_t dma_buffer_id; // DMA Buffer Identifier. Used to Identify DMA buffer in host memory.
|
||||
@@ -211,11 +211,11 @@ namespace Kernel
|
||||
uint32_t em_ctl; // 0x20, Enclosure management control
|
||||
uint32_t cap2; // 0x24, Host capabilities extended
|
||||
uint32_t bohc; // 0x28, BIOS/OS handoff control and status
|
||||
|
||||
|
||||
uint8_t __reserved0[0xA0-0x2C];
|
||||
|
||||
|
||||
uint8_t vendor[0x100-0xA0];
|
||||
|
||||
|
||||
HBAPortMemorySpace ports[0]; // 1 - 32 ports
|
||||
} __attribute__((packed));
|
||||
|
||||
@@ -223,17 +223,17 @@ namespace Kernel
|
||||
{
|
||||
DMASetupBI dsfis;
|
||||
uint8_t pad0[4];
|
||||
|
||||
|
||||
PIOSetupD2H psfis;
|
||||
uint8_t pad1[12];
|
||||
|
||||
|
||||
FISRegisterD2H rfis;
|
||||
uint8_t pad2[4];
|
||||
|
||||
|
||||
SetDeviceBitsD2H sdbfis;
|
||||
|
||||
|
||||
uint8_t ufis[64];
|
||||
|
||||
|
||||
uint8_t __reserved[0x100-0xA0];
|
||||
} __attribute__((packed));
|
||||
|
||||
@@ -243,20 +243,20 @@ namespace Kernel
|
||||
uint8_t a : 1; // ATAPI
|
||||
uint8_t w : 1; // Write, 1: H2D, 0: D2H
|
||||
uint8_t p : 1; // Prefetchable
|
||||
|
||||
|
||||
uint8_t r : 1; // Reset
|
||||
uint8_t b : 1; // BIST
|
||||
uint8_t c : 1; // Clear busy upon R_OK
|
||||
uint8_t __reserved0 : 1;
|
||||
uint8_t pmp : 4; // Port multiplier port
|
||||
|
||||
|
||||
uint16_t prdtl; // Physical region descriptor table length in entries
|
||||
|
||||
|
||||
volatile uint32_t prdbc; // Physical region descriptor byte count transferred
|
||||
|
||||
|
||||
uint32_t ctba; // Command table descriptor base address
|
||||
uint32_t ctbau; // Command table descriptor base address upper 32 bits
|
||||
|
||||
|
||||
uint32_t __reserved1[4];
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@ namespace Kernel
|
||||
BAN::Optional<uint32_t> find_free_command_slot();
|
||||
|
||||
void handle_irq();
|
||||
|
||||
|
||||
BAN::ErrorOr<void> block_until_command_completed(uint32_t command_slot);
|
||||
|
||||
private:
|
||||
BAN::RefPtr<AHCIController> m_controller;
|
||||
volatile HBAPortMemorySpace* const m_port;
|
||||
|
||||
|
||||
BAN::UniqPtr<DMARegion> m_dma_region;
|
||||
// Intermediate read/write buffer
|
||||
// TODO: can we read straight to user buffer?
|
||||
@@ -45,4 +45,4 @@ namespace Kernel
|
||||
friend class AHCIController;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,4 +61,4 @@ namespace Kernel
|
||||
friend class ATAController;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@ namespace Kernel
|
||||
PCI::Device& m_pci_device;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,4 @@
|
||||
#define ATA_COMMANDSET_LBA48_SUPPORTED (1 << 26)
|
||||
|
||||
#define ATA_CAPABILITIES_LBA (1 << 9)
|
||||
#define ATA_CAPABILITIES_DMA (1 << 8)
|
||||
#define ATA_CAPABILITIES_DMA (1 << 8)
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Kernel
|
||||
ATABaseDevice();
|
||||
BAN::ErrorOr<void> initialize(BAN::Span<const uint16_t> identify_data);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
uint16_t m_signature;
|
||||
uint16_t m_capabilities;
|
||||
uint32_t m_command_set;
|
||||
@@ -62,7 +62,7 @@ namespace Kernel
|
||||
|
||||
private:
|
||||
ATADevice(BAN::RefPtr<ATABus>, ATABus::DeviceType, bool is_secodary);
|
||||
|
||||
|
||||
virtual BAN::ErrorOr<void> read_sectors_impl(uint64_t, uint64_t, BAN::ByteSpan) override;
|
||||
virtual BAN::ErrorOr<void> write_sectors_impl(uint64_t, uint64_t, BAN::ConstByteSpan) override;
|
||||
|
||||
|
||||
@@ -40,4 +40,4 @@ namespace Kernel
|
||||
BAN::Array<uint8_t, PAGE_SIZE> m_sync_cache;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Kernel::NVMe
|
||||
uint8_t cns;
|
||||
uint8_t __reserved1;
|
||||
uint16_t cntid;
|
||||
// dword 11
|
||||
// dword 11
|
||||
uint16_t cnsid;
|
||||
uint8_t __reserved2;
|
||||
uint8_t csi;
|
||||
@@ -292,4 +292,4 @@ namespace Kernel::NVMe
|
||||
} __attribute__((packed));
|
||||
static_assert(sizeof(NamespaceIdentify) == 0x1000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ namespace Kernel
|
||||
virtual BAN::ErrorOr<void> initialize() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,4 +47,4 @@ namespace Kernel
|
||||
friend class DiskCache;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user