From 491f19514fe986954e702e14023a2d9b1b54e066 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 8 Jan 2025 09:26:13 +0100 Subject: ADD: Format user name according to type of user in k*User macros. ADD: Refactor Power mgmt API in SCI. ADD: Rework documentation of AHCI. Signed-off-by: Amlal El Mahrouss --- dev/Kernel/KernelKit/User.h | 14 ++++++++------ dev/Kernel/src/User.cc | 3 +-- dev/LibSCI/SCI.h | 19 ++++++++++++------- dev/Mod/AHCI/AHCI.h | 31 ++++++++++++++++--------------- 4 files changed, 37 insertions(+), 30 deletions(-) (limited to 'dev') diff --git a/dev/Kernel/KernelKit/User.h b/dev/Kernel/KernelKit/User.h index 4e5167d4..c0d095d1 100644 --- a/dev/Kernel/KernelKit/User.h +++ b/dev/Kernel/KernelKit/User.h @@ -12,9 +12,10 @@ #include #include -///! We got the Super and guest user, both used to make authorization operations on the OS. -#define kSuperUser "OS AUTHORITY/SUPER" -#define kGuestUser "OS AUTHORITY/GUEST" +///! We got the Super, standard user (%s format) and guest user, all are used to make authorization operations on the OS. +#define kSuperUser "OS AUTHORITY/SUPER/%s" +#define kGuestUser "OS AUTHORITY/GUEST/%s" +#define kFmtUser "OS AUTHORITY/STD/%s" #define kUsersDir "/Users/" @@ -36,18 +37,19 @@ namespace Kernel typedef Char* usr_public_key_kind; + /// @brief User class. class User final { public: explicit User() = delete; - User(const Int32& sel, const Char* userName); - User(const UserRingKind& kind, const Char* userName); + User(const Int32& sel, const Char* username); + User(const UserRingKind& kind, const Char* username); ~User(); public: - ZKA_COPY_DEFAULT(User) + ZKA_COPY_DEFAULT(User); public: bool operator==(const User& lhs); diff --git a/dev/Kernel/src/User.cc b/dev/Kernel/src/User.cc index 2d9cb4d0..bf68231c 100644 --- a/dev/Kernel/src/User.cc +++ b/dev/Kernel/src/User.cc @@ -14,14 +14,13 @@ #include #include #include -#include #include #define kStdUserType (0xCE) #define kSuperUserType (0xEC) /// @file User.cc -/// @brief User support (or also called ) +/// @brief User support. namespace Kernel { diff --git a/dev/LibSCI/SCI.h b/dev/LibSCI/SCI.h index 7f7321d2..69945d20 100644 --- a/dev/LibSCI/SCI.h +++ b/dev/LibSCI/SCI.h @@ -244,13 +244,18 @@ IMPORT_C VoidPtr EvtDispatchEvent(_Input const Char* event_name, _Input VoidPtr // Power API. // ------------------------------------------------------------------------------------------ // -IMPORT_C Void PwrShutdownMachine(const Char* _Input msg, _Input SInt32 code); - -IMPORT_C Void PwrRebootMachine(const Char* _Input msg, _Input SInt32 code); - -IMPORT_C Void PwrSleepMachine(const Char* _Input msg, _Input SInt32 code); - -IMPORT_C SInt32 PwrGetCode(_Output SInt32& code); +enum +{ + kPowerCodeShutdown, + kPowerCodeReboot, + kPowerCodeSleep, + kPowerCodeWake, + kPowerCodeCount, +}; + +IMPORT_C SInt32 PwrReadCode(_Output SInt32& code); + +IMPORT_C SInt32 PwrSendCode(_Output SInt32& code); // ------------------------------------------------------------------------------------------ // // CD-ROM API. diff --git a/dev/Mod/AHCI/AHCI.h b/dev/Mod/AHCI/AHCI.h index f7211267..1e3324cf 100644 --- a/dev/Mod/AHCI/AHCI.h +++ b/dev/Mod/AHCI/AHCI.h @@ -13,10 +13,13 @@ #pragma once +#if defined(__AHCI__) + #include #include -/// @note Forward declarations of structs. +/// @file AHCI.h +/// @brief AHCI support. #define kAHCISectorSize (512) @@ -328,8 +331,6 @@ typedef struct HbaCmdTbl final struct HbaPrdtEntry PrdtEntries[1]; // Physical region descriptor table entries, 0 ~ 65535 } HbaCmdTbl; -#if defined(__AHCI__) - /// @brief Initializes an AHCI disk. /// @param PortsImplemented the amount of port that have been detected. /// @return @@ -337,26 +338,26 @@ Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented); Kernel::Boolean drv_std_detected(Kernel::Void); -/// @brief Read from disk. -/// @param Lba -/// @param Buf -/// @param SectorSz -/// @param Size +/// @brief Read from AHCI disk. +/// @param lba +/// @param buf +/// @param sector_sz +/// @param buf_sz /// @return Kernel::Void drv_std_read(Kernel::UInt64 lba, Kernel::Char* buf, Kernel::SizeT sector_sz, Kernel::SizeT buf_sz); -/// @brief Write to disk. -/// @param Lba -/// @param Buf -/// @param SectorSz -/// @param Size +/// @brief Write to AHCI disk. +/// @param lba +/// @param buf +/// @param sector_sz +/// @param buf_sz /// @return Kernel::Void drv_std_write(Kernel::UInt64 lba, Kernel::Char* buf, Kernel::SizeT sector_sz, Kernel::SizeT buf_sz); -/// @brief get sector count. +/// @brief Gets the sector count from AHCI disk. Kernel::SizeT drv_get_sector_count(); -/// @brief get device size. +/// @brief Gets the AHCI disk size. Kernel::SizeT drv_get_size(); #endif // ifdef __AHCI__ -- cgit v1.2.3