36 lines
1,009 B
C
36 lines
1,009 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef _DRIVER_H_
|
|
#define _DRIVER_H_
|
|
|
|
#include <kernel/common.h>
|
|
#include <drivers/pci.h>
|
|
|
|
#define DRIVER_ENTRY(fn) static void (*__initcall_##fn)(void) __attribute((used, section(".initcall"))) = fn
|
|
#define DRIVER_ENTRY_PRIORITY(fn, pr) static void (*__initcall_##fn)(void) __attribute((used, section(".initcall." #pr))) = fn
|
|
#define DRIVER_EXIT(fn) static void (*__exitcall_##fn)(void) __attribute((used, section(".exitcall"))) = fn
|
|
|
|
#define DRIVER_PCI 1
|
|
|
|
typedef int (*pci_init_t)(struct pci_device *dev);
|
|
|
|
struct ksym {
|
|
const char *name;
|
|
void *addr;
|
|
};
|
|
|
|
struct driver {
|
|
char name[32];
|
|
u32 type;
|
|
void *init_device;
|
|
void *deinit_device;
|
|
};
|
|
|
|
struct driver *driver_register(const char *name, u32 type, void *init, void *deinit, u32 class);
|
|
struct driver *driver_find(u32 type, u32 class);
|
|
int driver_load(const char *name);
|
|
int driver_unload(const char *name);
|
|
|
|
extern struct ksym kernel_symtab[];
|
|
extern size_t kernel_symtab_count;
|
|
|
|
#endif /* _DRIVER_H_ */
|