mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
ac7ce12123
This was a premature optimization from the early days of SerenityOS. The eternal heap was a simple bump pointer allocator over a static byte array. My original idea was to avoid heap fragmentation and improve data locality, but both ideas were rooted in cargo culting, not data. We would reserve 4 MiB at boot and only ended up using ~256 KiB, wasting the rest. This patch replaces all kmalloc_eternal() usage by regular kmalloc().
59 lines
1.9 KiB
C++
59 lines
1.9 KiB
C++
/*
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/OwnPtr.h>
|
|
#include <AK/RefPtr.h>
|
|
#include <AK/Types.h>
|
|
#include <Kernel/Sections.h>
|
|
#include <Kernel/Storage/ATA/AHCI.h>
|
|
#include <Kernel/Storage/ATA/ATAController.h>
|
|
#include <Kernel/Storage/StorageDevice.h>
|
|
|
|
namespace Kernel {
|
|
|
|
class AsyncBlockDeviceRequest;
|
|
class AHCIPortHandler;
|
|
class AHCIPort;
|
|
class AHCIController final : public ATAController
|
|
, public PCI::Device {
|
|
friend class AHCIPortHandler;
|
|
friend class AHCIPort;
|
|
|
|
public:
|
|
UNMAP_AFTER_INIT static NonnullRefPtr<AHCIController> initialize(PCI::DeviceIdentifier const& pci_device_identifier);
|
|
virtual ~AHCIController() override;
|
|
|
|
virtual RefPtr<StorageDevice> device(u32 index) const override;
|
|
virtual bool reset() override;
|
|
virtual bool shutdown() override;
|
|
virtual size_t devices_count() const override;
|
|
virtual void start_request(const ATADevice&, AsyncBlockDeviceRequest&) override;
|
|
virtual void complete_current_request(AsyncDeviceRequest::RequestResult) override;
|
|
|
|
const AHCI::HBADefinedCapabilities& hba_capabilities() const { return m_capabilities; };
|
|
|
|
private:
|
|
void disable_global_interrupts() const;
|
|
void enable_global_interrupts() const;
|
|
|
|
UNMAP_AFTER_INIT explicit AHCIController(PCI::DeviceIdentifier const&);
|
|
UNMAP_AFTER_INIT void initialize_hba(PCI::DeviceIdentifier const&);
|
|
|
|
AHCI::HBADefinedCapabilities capabilities() const;
|
|
RefPtr<StorageDevice> device_by_port(u32 index) const;
|
|
|
|
volatile AHCI::PortRegisters& port(size_t port_number) const;
|
|
UNMAP_AFTER_INIT NonnullOwnPtr<Memory::Region> default_hba_region() const;
|
|
volatile AHCI::HBA& hba() const;
|
|
|
|
NonnullOwnPtr<Memory::Region> m_hba_region;
|
|
AHCI::HBADefinedCapabilities m_capabilities;
|
|
NonnullRefPtrVector<AHCIPortHandler> m_handlers;
|
|
};
|
|
}
|