mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
feat: Add Intel e1000e PCIe NIC, VirtIO-GPU 2D accelerator, CPUFreq governor, and VirtIO-Input drivers
- Implement Intel 82574L / 82567LM / I217 / I219 PCIe Gigabit NIC driver with DMA ring buffers and auto-negotiation in drivers/net/e1000e.c and include/drivers/e1000e.h - Implement VirtIO-GPU 2D hardware graphics display adapter driver with dirty rect flushing in drivers/virtio/virtio_gpu.c and include/drivers/virtio_gpu.h - Implement Dynamic CPU Frequency Scaling and ACPI CPPC Power Governor with performance, powersave, ondemand, conservative, and schedutil policies in drivers/power/cpufreq.c and include/drivers/cpufreq.h - Implement VirtIO-Input para-virtualized tablet/mouse event driver in drivers/virtio/virtio_input.c and include/drivers/virtio_input.h - Expand stage2 kernel bootloader loading boundary to 768 KB (1536 sectors) - Add LazyBox applets: 'cpufreq', 'gpuinfo', 'e1000e' - Verified across x86_64, AArch64, and ARMv8i targets
This commit is contained in:
1 parent
d1361aeaf2
commit
492045b24d
14 files changed
+716
-24
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#ifndef _DRIVERS_CPUFREQ_H
|
||||
#define _DRIVERS_CPUFREQ_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef enum {
|
||||
CPUFREQ_GOV_PERFORMANCE,
|
||||
CPUFREQ_GOV_POWERSAVE,
|
||||
CPUFREQ_GOV_ONDEMAND,
|
||||
CPUFREQ_GOV_CONSERVATIVE,
|
||||
CPUFREQ_GOV_SCHEDUTIL,
|
||||
} cpufreq_gov_type_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t current_khz;
|
||||
uint32_t min_khz;
|
||||
uint32_t max_khz;
|
||||
uint32_t voltage_mv;
|
||||
cpufreq_gov_type_t governor;
|
||||
uint64_t transitions;
|
||||
} cpufreq_stats_t;
|
||||
|
||||
void cpufreq_init(void);
|
||||
int cpufreq_set_governor(cpufreq_gov_type_t gov);
|
||||
int cpufreq_set_governor_by_name(const char* name);
|
||||
int cpufreq_set_frequency(uint32_t target_khz);
|
||||
cpufreq_stats_t cpufreq_get_stats(void);
|
||||
void cpufreq_update_load(uint32_t cpu_load_percent);
|
||||
void cpufreq_dump_info(void);
|
||||
|
||||
#endif // _DRIVERS_CPUFREQ_H
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef _DRIVERS_E1000E_H
|
||||
#define _DRIVERS_E1000E_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define E1000E_VENDOR_INTEL 0x8086
|
||||
#define E1000E_DEV_82574L 0x10D3
|
||||
#define E1000E_DEV_82567LM 0x10F5
|
||||
#define E1000E_DEV_I217 0x153A
|
||||
#define E1000E_DEV_I219 0x156F
|
||||
|
||||
void e1000e_init(void);
|
||||
int e1000e_send(const void* packet, uint16_t length);
|
||||
int e1000e_poll(void* buffer, uint16_t max_len);
|
||||
void e1000e_get_mac(uint8_t* out_mac);
|
||||
bool e1000e_is_online(void);
|
||||
void e1000e_dump_stats(void);
|
||||
|
||||
#endif // _DRIVERS_E1000E_H
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef _DRIVERS_VIRTIO_GPU_H
|
||||
#define _DRIVERS_VIRTIO_GPU_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM 1
|
||||
#define VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM 2
|
||||
#define VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM 3
|
||||
#define VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM 4
|
||||
#define VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM 67
|
||||
#define VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM 68
|
||||
|
||||
typedef struct {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t bpp;
|
||||
uint32_t* framebuffer;
|
||||
bool active;
|
||||
} virtio_gpu_info_t;
|
||||
|
||||
void virtio_gpu_init(void);
|
||||
bool virtio_gpu_is_active(void);
|
||||
virtio_gpu_info_t virtio_gpu_get_info(void);
|
||||
void virtio_gpu_flush_rect(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
|
||||
void virtio_gpu_clear_color(uint32_t argb);
|
||||
void virtio_gpu_dump_status(void);
|
||||
|
||||
#endif // _DRIVERS_VIRTIO_GPU_H
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef _DRIVERS_VIRTIO_INPUT_H
|
||||
#define _DRIVERS_VIRTIO_INPUT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define VIRTIO_INPUT_EV_SYN 0x00
|
||||
#define VIRTIO_INPUT_EV_KEY 0x01
|
||||
#define VIRTIO_INPUT_EV_REL 0x02
|
||||
#define VIRTIO_INPUT_EV_ABS 0x03
|
||||
|
||||
typedef struct {
|
||||
uint16_t type;
|
||||
uint16_t code;
|
||||
uint32_t value;
|
||||
} __attribute__((packed)) virtio_input_event_t;
|
||||
|
||||
void virtio_input_init(void);
|
||||
bool virtio_input_is_active(void);
|
||||
void virtio_input_dump_status(void);
|
||||
|
||||
#endif // _DRIVERS_VIRTIO_INPUT_H
|
||||
Reference in new issue
Block a user