summaryrefslogtreecommitdiffhomepage
path: root/src/modules/ACPI/ACPIFactoryInterface.h
blob: fb151b9c3a36feec899ab5f5f5b564bfec43a9b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel

#ifndef __MOD_ACPI_H__
#define __MOD_ACPI_H__

#include <KernelKit/DebugOutput.h>
#include <NeKit/Config.h>
#include <NeKit/ErrorOr.h>
#include <NeKit/Ref.h>
#include <modules/ACPI/ACPI.h>
#include <modules/Power/PowerFactory.h>

namespace Kernel {
class PowerFactory;
class ACPIFactoryInterface;

typedef ACPIFactoryInterface PowerFactoryInterface;

class ACPIFactoryInterface final NE_POWER_FACTORY {
 public:
  explicit ACPIFactoryInterface(voidPtr rsp_ptr);
  ~ACPIFactoryInterface() = default;

  ACPIFactoryInterface& operator=(const ACPIFactoryInterface&) = default;
  ACPIFactoryInterface(const ACPIFactoryInterface&)            = default;

 public:
  Bool Shutdown();  // shutdown
  Void Reboot();    // soft-reboot

 public:
  /// @brief Descriptor find factory.
  /// @param signature The signature of the descriptor table (MADT, ACPI...)
  /// @return the blob inside an ErrorOr object.
  ErrorOr<voidPtr> Find(const Char* signature);

  /// @brief Checksum factory.
  /// @param checksum the data to checksum
  /// @param len it's size
  /// @return if it succeed
  bool Checksum(const Char* checksum, SSizeT len);  // watch for collides!

 public:
  ErrorOr<voidPtr> operator[](const Char* signature);

 private:
  VoidPtr fRsdp{nullptr};  // pointer to root descriptor.
  SizeT   fEntries{0UL};   // number of entries, -1 tells that no invalid entries were
                           // found.
};
}  // namespace Kernel

#endif  // !__MOD_ACPI_H__