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