1 /* 2 * Copyright 2022, Jérôme Duval, jerome.duval@gmail.com. 3 * 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef _CCP_H 7 #define _CCP_H 8 9 10 #include <stdlib.h> 11 12 #include <KernelExport.h> 13 14 15 //#define TRACE_CCP_RNG 16 #ifndef DRIVER_NAME 17 # define DRIVER_NAME "ccp_rng" 18 #endif 19 #ifdef TRACE_CCP_RNG 20 # define TRACE(x...) dprintf("\33[33m" DRIVER_NAME ":\33[0m " x) 21 #else 22 # define TRACE(x...) ; 23 #endif 24 #define TRACE_ALWAYS(x...) dprintf("\33[33m" DRIVER_NAME ":\33[0m " x) 25 #define ERROR(x...) dprintf("\33[33m" DRIVER_NAME ":\33[0m " x) 26 #define CALLED(x...) TRACE("CALLED %s\n", __PRETTY_FUNCTION__) 27 28 29 #define CCP_ACPI_DEVICE_MODULE_NAME "busses/random/ccp_rng/acpi/driver_v1" 30 #define CCP_PCI_DEVICE_MODULE_NAME "busses/random/ccp_rng/pci/driver_v1" 31 #define CCP_DEVICE_MODULE_NAME "busses/random/ccp_rng/device/v1" 32 33 34 #define read32(address) \ 35 (*((volatile uint32*)(address))) 36 37 38 39 extern device_manager_info* gDeviceManager; 40 extern driver_module_info gCcpAcpiDevice; 41 extern driver_module_info gCcpPciDevice; 42 43 44 typedef struct { 45 phys_addr_t base_addr; 46 uint64 map_size; 47 48 device_node* node; 49 device_node* driver_node; 50 51 area_id registersArea; 52 addr_t registers; 53 54 timer extractTimer; 55 void* dpcHandle; 56 } ccp_device_info; 57 58 59 #endif // _CCP_H 60