All: Cleanup all files
Add newline to end of files and remove whitespace from end of lines
This commit is contained in:
@@ -126,7 +126,7 @@ namespace Kernel
|
||||
|
||||
SDTHeader* as_header() { return (SDTHeader*)vaddr; }
|
||||
};
|
||||
BAN::Vector<MappedPage> m_mapped_headers;
|
||||
BAN::Vector<MappedPage> m_mapped_headers;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -135,7 +135,7 @@ namespace BAN::Formatter
|
||||
{
|
||||
template<typename F>
|
||||
void print_argument(F putc, const Kernel::ACPI::SDTHeader& header, const ValueFormat& format)
|
||||
{
|
||||
{
|
||||
putc(header.signature[0]);
|
||||
putc(header.signature[1]);
|
||||
putc(header.signature[2]);
|
||||
|
||||
@@ -18,4 +18,4 @@ namespace Kernel::API
|
||||
DirectoryEntry array[];
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Kernel
|
||||
BAN::Vector<Processor> m_processors;
|
||||
Kernel::paddr_t m_local_apic_paddr = 0;
|
||||
Kernel::vaddr_t m_local_apic_vaddr = 0;
|
||||
BAN::Vector<IOAPIC> m_io_apics;
|
||||
BAN::Vector<IOAPIC> m_io_apics;
|
||||
uint8_t m_irq_overrides[0x100] {};
|
||||
uint8_t m_reserved_gsis[0x100 / 8] {};
|
||||
};
|
||||
|
||||
@@ -7,38 +7,38 @@ namespace CPUID
|
||||
|
||||
enum Features : uint32_t
|
||||
{
|
||||
ECX_SSE3 = (uint32_t)1 << 0,
|
||||
ECX_SSE3 = (uint32_t)1 << 0,
|
||||
ECX_PCLMULQDQ = (uint32_t)1 << 1,
|
||||
ECX_DTES64 = (uint32_t)1 << 2,
|
||||
ECX_MONITOR = (uint32_t)1 << 3,
|
||||
ECX_DS_CPL = (uint32_t)1 << 4,
|
||||
ECX_VMX = (uint32_t)1 << 5,
|
||||
ECX_SMX = (uint32_t)1 << 6,
|
||||
ECX_EST = (uint32_t)1 << 7,
|
||||
ECX_TM2 = (uint32_t)1 << 8,
|
||||
ECX_SSSE3 = (uint32_t)1 << 9,
|
||||
ECX_MONITOR = (uint32_t)1 << 3,
|
||||
ECX_DS_CPL = (uint32_t)1 << 4,
|
||||
ECX_VMX = (uint32_t)1 << 5,
|
||||
ECX_SMX = (uint32_t)1 << 6,
|
||||
ECX_EST = (uint32_t)1 << 7,
|
||||
ECX_TM2 = (uint32_t)1 << 8,
|
||||
ECX_SSSE3 = (uint32_t)1 << 9,
|
||||
ECX_CNTX_ID = (uint32_t)1 << 10,
|
||||
ECX_SDBG = (uint32_t)1 << 11,
|
||||
ECX_FMA = (uint32_t)1 << 12,
|
||||
ECX_CX16 = (uint32_t)1 << 13,
|
||||
ECX_XTPR = (uint32_t)1 << 14,
|
||||
ECX_PDCM = (uint32_t)1 << 15,
|
||||
ECX_PCID = (uint32_t)1 << 17,
|
||||
ECX_DCA = (uint32_t)1 << 18,
|
||||
ECX_SSE4_1 = (uint32_t)1 << 19,
|
||||
ECX_SSE4_2 = (uint32_t)1 << 20,
|
||||
ECX_X2APIC = (uint32_t)1 << 21,
|
||||
ECX_MOVBE = (uint32_t)1 << 22,
|
||||
ECX_POPCNT = (uint32_t)1 << 23,
|
||||
ECX_TSC_DEADLINE = (uint32_t)1 << 24,
|
||||
ECX_AES = (uint32_t)1 << 25,
|
||||
ECX_XSAVE = (uint32_t)1 << 26,
|
||||
ECX_OSXSAVE = (uint32_t)1 << 27,
|
||||
ECX_CX16 = (uint32_t)1 << 13,
|
||||
ECX_XTPR = (uint32_t)1 << 14,
|
||||
ECX_PDCM = (uint32_t)1 << 15,
|
||||
ECX_PCID = (uint32_t)1 << 17,
|
||||
ECX_DCA = (uint32_t)1 << 18,
|
||||
ECX_SSE4_1 = (uint32_t)1 << 19,
|
||||
ECX_SSE4_2 = (uint32_t)1 << 20,
|
||||
ECX_X2APIC = (uint32_t)1 << 21,
|
||||
ECX_MOVBE = (uint32_t)1 << 22,
|
||||
ECX_POPCNT = (uint32_t)1 << 23,
|
||||
ECX_TSC_DEADLINE = (uint32_t)1 << 24,
|
||||
ECX_AES = (uint32_t)1 << 25,
|
||||
ECX_XSAVE = (uint32_t)1 << 26,
|
||||
ECX_OSXSAVE = (uint32_t)1 << 27,
|
||||
ECX_AVX = (uint32_t)1 << 28,
|
||||
ECX_F16C = (uint32_t)1 << 29,
|
||||
ECX_RDRND = (uint32_t)1 << 30,
|
||||
ECX_HYPERVISOR = (uint32_t)1 << 31,
|
||||
|
||||
|
||||
EDX_FPU = (uint32_t)1 << 0,
|
||||
EDX_VME = (uint32_t)1 << 1,
|
||||
EDX_DE = (uint32_t)1 << 2,
|
||||
@@ -79,4 +79,4 @@ namespace CPUID
|
||||
bool is_64_bit();
|
||||
bool has_nxe();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,4 @@ namespace Kernel
|
||||
size_t m_flags;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,4 +61,4 @@ namespace Debug
|
||||
static void lock();
|
||||
static void unlock();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,4 @@ namespace Kernel
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,4 @@ namespace Kernel
|
||||
friend class FramebufferMemoryRegion;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,4 @@ namespace Kernel
|
||||
const dev_t m_rdev;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ namespace Kernel
|
||||
const dev_t m_rdev;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,4 @@ namespace Kernel
|
||||
|
||||
BAN::StringView error_string(ErrorCode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Kernel
|
||||
public:
|
||||
static void initialize();
|
||||
static DevFileSystem& get();
|
||||
|
||||
|
||||
void initialize_device_updater();
|
||||
|
||||
void add_device(BAN::RefPtr<Device>);
|
||||
@@ -39,4 +39,4 @@ namespace Kernel
|
||||
volatile bool m_should_sync { false };
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,4 +259,4 @@ namespace Kernel::Ext2
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Kernel
|
||||
{
|
||||
m_used = false;
|
||||
}
|
||||
|
||||
|
||||
size_t size() const { return m_buffer.size(); }
|
||||
|
||||
uint8_t* data() { return m_buffer.data(); }
|
||||
@@ -44,7 +44,7 @@ namespace Kernel
|
||||
bool& m_used;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
static BAN::ErrorOr<Ext2FS*> create(BAN::RefPtr<BlockDevice>);
|
||||
|
||||
virtual BAN::RefPtr<Inode> root_inode() override { return m_root_inode; }
|
||||
@@ -120,4 +120,4 @@ namespace Kernel
|
||||
friend class Ext2Inode;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Kernel
|
||||
virtual BAN::ErrorOr<void> create_file_impl(BAN::StringView, mode_t, uid_t, gid_t) override;
|
||||
virtual BAN::ErrorOr<void> create_directory_impl(BAN::StringView, mode_t, uid_t, gid_t) override;
|
||||
virtual BAN::ErrorOr<void> unlink_impl(BAN::StringView) override;
|
||||
|
||||
|
||||
virtual BAN::ErrorOr<BAN::String> link_target_impl() override;
|
||||
|
||||
virtual BAN::ErrorOr<size_t> read_impl(off_t, BAN::ByteSpan) override;
|
||||
@@ -81,4 +81,4 @@ namespace Kernel
|
||||
friend class BAN::RefPtr<Ext2Inode>;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ namespace Kernel
|
||||
virtual BAN::RefPtr<Inode> root_inode() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,4 +131,4 @@ namespace Kernel
|
||||
friend class FileBackedRegion;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,4 @@ namespace Kernel
|
||||
uint32_t m_writing_count { 1 };
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@ namespace Kernel
|
||||
ProcFileSystem();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Kernel
|
||||
|
||||
private:
|
||||
ProcROInode(Process&, size_t (Process::*)(off_t, BAN::ByteSpan) const, TmpFileSystem&, const TmpInodeInfo&);
|
||||
|
||||
|
||||
private:
|
||||
Process& m_process;
|
||||
size_t (Process::*m_callback)(off_t, BAN::ByteSpan) const;
|
||||
|
||||
@@ -177,4 +177,4 @@ namespace Kernel
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,4 +44,4 @@ namespace Kernel
|
||||
BAN::Vector<MountPoint> m_mount_points;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ namespace Kernel
|
||||
uint32_t m_pitch = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ namespace Kernel::GDT
|
||||
void initialize();
|
||||
void set_tss_stack(uintptr_t);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ namespace Kernel::IDT
|
||||
void initialize();
|
||||
[[noreturn]] void force_triple_fault();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,4 +62,4 @@ namespace IO
|
||||
outb(0x80, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +95,4 @@ namespace Kernel::Input
|
||||
Key key_event_to_key(KeyEvent);
|
||||
const char* key_to_utf8(Key key, uint16_t modifier);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Kernel::Input
|
||||
MouseButtonEvent button_event;
|
||||
MouseMoveEvent move_event;
|
||||
MouseScrollEvent scroll_event;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,4 +53,4 @@ namespace Kernel
|
||||
|
||||
bool interrupts_enabled();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ namespace Kernel
|
||||
uint64_t ss;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Kernel
|
||||
LockGuard(Lock& lock)
|
||||
: m_lock(lock)
|
||||
{
|
||||
m_lock.lock();
|
||||
m_lock.lock();
|
||||
}
|
||||
|
||||
~LockGuard()
|
||||
@@ -27,4 +27,4 @@ namespace Kernel
|
||||
Lock& m_lock;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,4 @@ namespace MMIO
|
||||
return *(volatile uint64_t*)addr;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
|
||||
class DMARegion
|
||||
{
|
||||
public:
|
||||
@@ -27,4 +27,4 @@ namespace Kernel
|
||||
const paddr_t m_paddr;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,4 @@ namespace Kernel
|
||||
BAN::RefPtr<SharedFileData> m_shared_data;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Kernel
|
||||
{
|
||||
BAN_NON_COPYABLE(MemoryBackedRegion);
|
||||
BAN_NON_MOVABLE(MemoryBackedRegion);
|
||||
|
||||
|
||||
public:
|
||||
static BAN::ErrorOr<BAN::UniqPtr<MemoryBackedRegion>> create(PageTable&, size_t size, AddressRange, Type, PageTable::flags_t);
|
||||
~MemoryBackedRegion();
|
||||
@@ -29,4 +29,4 @@ namespace Kernel
|
||||
MemoryBackedRegion(PageTable&, size_t size, Type, PageTable::flags_t);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Kernel
|
||||
BAN::ErrorOr<bool> allocate_page_containing(vaddr_t address);
|
||||
|
||||
virtual BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> clone(PageTable& new_page_table) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
MemoryRegion(PageTable&, size_t size, Type type, PageTable::flags_t flags);
|
||||
BAN::ErrorOr<void> initialize(AddressRange);
|
||||
@@ -64,4 +64,4 @@ namespace Kernel
|
||||
size_t m_physical_page_count { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Kernel
|
||||
{
|
||||
public:
|
||||
using flags_t = uint16_t;
|
||||
enum Flags : flags_t
|
||||
enum Flags : flags_t
|
||||
{
|
||||
Present = (1 << 0),
|
||||
ReadWrite = (1 << 1),
|
||||
@@ -107,7 +107,7 @@ namespace Kernel
|
||||
uint64_t get_page_data(vaddr_t) const;
|
||||
void initialize_kernel();
|
||||
void map_kernel_memory();
|
||||
void prepare_fast_page();
|
||||
void prepare_fast_page();
|
||||
static void invalidate(vaddr_t);
|
||||
|
||||
private:
|
||||
|
||||
@@ -30,4 +30,4 @@ namespace Kernel
|
||||
PageTable& m_temp;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Kernel
|
||||
private:
|
||||
unsigned long long* ull_bitmap_ptr() { return (unsigned long long*)m_vaddr; }
|
||||
const unsigned long long* ull_bitmap_ptr() const { return (const unsigned long long*)m_vaddr; }
|
||||
|
||||
|
||||
paddr_t paddr_for_bit(unsigned long long) const;
|
||||
unsigned long long bit_for_paddr(paddr_t paddr) const;
|
||||
|
||||
@@ -47,4 +47,4 @@ namespace Kernel
|
||||
size_t m_free_pages { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@ namespace Kernel
|
||||
using vaddr_t = uintptr_t;
|
||||
using paddr_t = uintptr_t;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,4 +48,4 @@ namespace Kernel
|
||||
PageTable::flags_t m_flags { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <BAN/UniqPtr.h>
|
||||
#include <kernel/InterruptController.h>
|
||||
#include <kernel/Networking/NetworkDriver.h>
|
||||
#include <kernel/PCI.h>
|
||||
|
||||
@@ -10,7 +11,7 @@
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
class E1000 final : public NetworkDriver
|
||||
class E1000 final : public NetworkDriver, public Interruptable
|
||||
{
|
||||
public:
|
||||
static bool probe(PCI::Device&);
|
||||
@@ -23,9 +24,11 @@ namespace Kernel
|
||||
virtual bool link_up() override { return m_link_up; }
|
||||
virtual int link_speed() override;
|
||||
|
||||
virtual void handle_irq() override { ASSERT_NOT_REACHED(); }
|
||||
|
||||
private:
|
||||
E1000() = default;
|
||||
BAN::ErrorOr<void> initialize(PCI::Device&);
|
||||
E1000(PCI::Device& pci_device) : m_pci_device(pci_device) {}
|
||||
BAN::ErrorOr<void> initialize();
|
||||
|
||||
static void interrupt_handler();
|
||||
|
||||
@@ -40,11 +43,12 @@ namespace Kernel
|
||||
void initialize_tx();
|
||||
|
||||
void enable_link();
|
||||
void enable_interrupts();
|
||||
|
||||
BAN::ErrorOr<void> enable_interrupts();
|
||||
|
||||
void handle_receive();
|
||||
|
||||
private:
|
||||
PCI::Device& m_pci_device;
|
||||
BAN::UniqPtr<PCI::BarRegion> m_bar_region;
|
||||
bool m_has_eerprom { false };
|
||||
uint8_t m_mac_address[6] {};
|
||||
|
||||
@@ -17,4 +17,4 @@ namespace Kernel
|
||||
virtual int link_speed() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,4 +78,4 @@ namespace Kernel
|
||||
BAN::Array<BAN::RefPtr<OpenFileDescription>, OPEN_MAX> m_open_files;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Kernel::PCI
|
||||
public:
|
||||
static void initialize();
|
||||
static PCIManager& get();
|
||||
|
||||
|
||||
const BAN::Vector<PCI::Device>& devices() const { return m_devices; }
|
||||
|
||||
static uint32_t read_config_dword(uint8_t bus, uint8_t dev, uint8_t func, uint8_t offset);
|
||||
@@ -153,4 +153,4 @@ namespace Kernel::PCI
|
||||
BAN::Vector<PCI::Device> m_devices;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,4 @@ namespace Kernel::detail
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,4 +225,4 @@ namespace Kernel
|
||||
friend class Thread;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,4 +76,4 @@ namespace Kernel
|
||||
friend class Process;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ namespace Kernel
|
||||
void unblock();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Kernel
|
||||
{
|
||||
BAN_NON_COPYABLE(RecursivePrioritySpinLock);
|
||||
BAN_NON_MOVABLE(RecursivePrioritySpinLock);
|
||||
|
||||
|
||||
public:
|
||||
RecursivePrioritySpinLock() = default;
|
||||
void lock();
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Kernel
|
||||
{
|
||||
public:
|
||||
static BAN::ErrorOr<BAN::RefPtr<SerialTTY>> create(Serial);
|
||||
|
||||
|
||||
virtual uint32_t width() const override;
|
||||
virtual uint32_t height() const override;
|
||||
|
||||
@@ -69,4 +69,4 @@ namespace Kernel
|
||||
const dev_t m_rdev;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Kernel
|
||||
{
|
||||
public:
|
||||
void set_termios(const termios& termios) { m_termios = termios; }
|
||||
termios get_termios() const { return m_termios; }
|
||||
termios get_termios() const { return m_termios; }
|
||||
virtual void set_font(const Font&) {};
|
||||
|
||||
void set_foreground_pgrp(pid_t pgrp) { m_foreground_pgrp = pgrp; }
|
||||
|
||||
@@ -58,4 +58,4 @@ namespace TerminalColor
|
||||
static constexpr TerminalDriver::Color BRIGHT_MAGENTA = 0xFF55FF;
|
||||
static constexpr TerminalDriver::Color BRIGHT_YELLOW = 0xFFFF55;
|
||||
static constexpr TerminalDriver::Color BRIGHT_WHITE = 0xFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,4 @@ namespace Kernel
|
||||
bool echo { true };
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Kernel
|
||||
{
|
||||
BAN_NON_COPYABLE(Thread);
|
||||
BAN_NON_MOVABLE(Thread);
|
||||
|
||||
|
||||
public:
|
||||
using entry_t = void(*)(void*);
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Kernel
|
||||
private:
|
||||
Thread(pid_t tid, Process*);
|
||||
void on_exit();
|
||||
|
||||
|
||||
void validate_stack() const;
|
||||
|
||||
private:
|
||||
@@ -125,4 +125,4 @@ namespace Kernel
|
||||
friend class Scheduler;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,4 @@ namespace Kernel
|
||||
vaddr_t m_mmio_base { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@ namespace Kernel
|
||||
volatile uint64_t m_system_time { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Kernel
|
||||
virtual uint64_t ms_since_boot() const override;
|
||||
virtual uint64_t ns_since_boot() const override;
|
||||
virtual timespec time_since_boot() const override;
|
||||
|
||||
|
||||
void sleep(uint64_t ms) const;
|
||||
|
||||
timespec real_time() const;
|
||||
@@ -44,4 +44,4 @@ namespace Kernel
|
||||
BAN::UniqPtr<Timer> m_timer;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user