XenevaOS
Loading...
Searching...
No Matches
audrv.h
Go to the documentation of this file.
1
30#ifndef __AU_DRV_H__
31#define __AU_DRV_H__
32
33#include <stdint.h>
34#if defined(__GNUC__) || defined(__clang__)
35#ifndef __cplusplus
36#include <stdbool.h>
37#endif
38#endif
39#ifdef ARCH_X64
40#include <Hal/x86_64_hal.h>
41#include <Hal/hal.h>
42#endif
43#include <Fs/vfs.h>
44
45#define DRIVER_CLASS_AUDIO 1
46#define DRIVER_CLASS_VIDEO 2
47#define DRIVER_CLASS_NETWORK 3
48#define DRIVER_CLASS_CONNECTIVITY_BLUETOOTH 4
49#define DRIVER_CLASS_CONNECTIVITY_WIFI 5
50#define DRIVER_CLASS_STORAGE 6
51#define DRIVER_CLASS_USB 7
52#define DRIVER_CLASS_HID 8
53#define DRIVER_CLASS_UNKNOWN 9
54
55#define DEVICE_CLASS_ETHERNET 1
56#define DEVICE_CLASS_HD_AUDIO 2
57#define DEVICE_CLASS_USB3 3
58
59#define AURORA_MAX_DRIVERS 256
60
61typedef int(*au_drv_entry)(void* drv);
62typedef int(*au_drv_unload)(void* drv);
63
64
65#pragma pack(push,1)
87#pragma pack(pop)
88
89
90
91#pragma pack(push,1)
92
101
102#pragma pack(pop)
103
104
105/*
106* AuDrvMngrInitialize -- Initialize the driver manager
107* @param info -- kernel boot info
108*/
109extern void AuDrvMngrInitialize(KERNEL_BOOT_INFO *info);
110
111/*
112* AuRegisterDevice -- register a new device to
113* aurora system
114* @param dev -- Pointer to device to add
115*/
117
118/*
119* AuCheckDevice -- checks an aurora device if it's
120* already present
121* @param classC -- class code of the device to check
122* @param subclassC -- sub class code of the device to check
123* @param progIF -- programming interface of the device
124*/
125AU_EXTERN AU_EXPORT bool AuCheckDevice(uint16_t classC, uint16_t subclassC, uint8_t progIF);
126
127/*
128 * AuBootDriverInitialise -- Initialise and load all boot time drivers
129 * @param info -- Kernel boot information passed by XNLDR
130 * [TODO] : Everything is hard coded for now
131 */
133
134/*
135 * AuDrvMgrGetBaseAddress -- returns the current
136 * driver load base address
137 */
139
140/*
141 * AuDrvMgrSetBaseAddress -- sets a new base
142 * address for driver to load
143 * it's highly risky because, if we set it to
144 * kernel stack location, kernel will crash
145 */
146extern void AuDrvMgrSetBaseAddress(uint64_t base_address);
147
148/*
149* AuGetConfEntry -- Get an entry offset in the file for required device
150* @param vendor_id -- vendor id of the product
151* @param device_id -- device id of the product
152* @param buffer -- configuration file buffer
153* @param entryoff -- entry offset from where search begins
154*/
155extern char* AuGetConfEntry(uint32_t vendor_id, uint32_t device_id, uint8_t* buffer, int entryoff);
156
157/*
158* AuGetDriverName -- Extract the driver path from its entry offset
159* @param vendor_id -- vendor id of the product
160* @param device_id -- device id of the product
161* @param buffer -- configuration file buffer
162* @param entryoff -- entry offset from where search begins
163*/
164extern AuDriver* AuGetDriverName(uint32_t vendor_id, uint32_t device_id, uint8_t* buffer, int entryoff);
165
171extern AuDriver* AuDrvManagerCheckFault(uint64_t fault_addr);
172
179extern void AuDrvCatchFault(AuDriver* drv, uint64_t fault_addr);
180
184extern void AuDrvUnloadAll();
185
186
187#endif
#define AU_EXTERN
Definition aurora.h:55
#define AU_EXPORT
Definition aurora.h:41
unsigned int uint32_t
Definition acefiex.h:163
unsigned char uint8_t
Definition acefiex.h:161
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
unsigned short int uint16_t
Definition acefiex.h:162
int(* au_drv_unload)(void *drv)
Definition audrv.h:62
uint64_t AuDrvMgrGetBaseAddress()
AuDrvMgrGetBaseAddress – returns the current driver load base address.
Definition audrv.cpp:428
AU_EXTERN AU_EXPORT void AuBootDriverInitialise(KERNEL_BOOT_INFO *info)
AuBootDriverInitialise – Initialise and load all boot time drivers.
Definition audrv.cpp:395
char * AuGetConfEntry(uint32_t vendor_id, uint32_t device_id, uint8_t *buffer, int entryoff)
AuGetConfEntry – Get an entry offset in the file for required device.
Definition audrv.cpp:91
AuDriver * AuGetDriverName(uint32_t vendor_id, uint32_t device_id, uint8_t *buffer, int entryoff)
AuGetDriverName – Extract the driver path from its entry offset.
Definition audrv.cpp:199
void AuDrvMngrInitialize(KERNEL_BOOT_INFO *info)
AuDrvMngrInitialize – Initialize the driver manager.
Definition audrv.cpp:283
AU_EXTERN AU_EXPORT bool AuCheckDevice(uint16_t classC, uint16_t subclassC, uint8_t progIF)
AuCheckDevice – checks an aurora device if it's already present.
Definition audrv.cpp:357
AuDriver * AuDrvManagerCheckFault(uint64_t fault_addr)
AuDrvManagerCheckFault – check if this driver contain the fault address, helpful for debugging.
Definition audrv.c:616
void AuDrvCatchFault(AuDriver *drv, uint64_t fault_addr)
AuDrvCatchFault – resolves original virtual address of the driver and relocate its symbol name.
Definition audrv.c:633
struct _aurora_device_ AuDevice
void AuDrvMgrSetBaseAddress(uint64_t base_address)
AuDrvMgrSetBaseAddress – sets a new base address for driver to load it's highly risky because,...
Definition audrv.cpp:438
struct _aurora_driver_ AuDriver
int(* au_drv_entry)(void *drv)
Definition audrv.h:61
AU_EXTERN AU_EXPORT void AuRegisterDevice(AuDevice *dev)
AuRegisterDevice – register a new device to aurora system.
Definition audrv.cpp:345
void AuDrvUnloadAll()
AuDrvUnloadAll – call unload handler of all registered drivers.
Definition audrv.c:645
Definition aurora.h:117
Definition audrv.h:93
uint8_t progIf
Definition audrv.h:96
uint16_t subClassCode
Definition audrv.h:95
uint8_t aurora_dev_class
Definition audrv.h:98
uint8_t aurora_driver_class
Definition audrv.h:99
uint16_t classCode
Definition audrv.h:94
bool initialized
Definition audrv.h:97
Definition audrv.h:66
uint64_t base
Definition audrv.h:71
int dev
Definition audrv.h:79
uint16_t vendorID
Definition audrv.h:73
uint8_t drv_type
Definition audrv.h:68
uint8_t classCode
Definition audrv.h:75
size_t image_sz
Definition audrv.h:85
bool present
Definition audrv.h:70
uint64_t new_load_base
Definition audrv.h:84
int bus
Definition audrv.h:77
au_drv_unload unload
Definition audrv.h:82
uint64_t device
Definition audrv.h:80
uint64_t end
Definition audrv.h:72
au_drv_entry entry
Definition audrv.h:81
int func
Definition audrv.h:78
char name[32]
Definition audrv.h:69
uint16_t deviceID
Definition audrv.h:74
uint8_t subClassCode
Definition audrv.h:76
uint8_t id
Definition audrv.h:67
uint64_t original_load_base
Definition audrv.h:83