feat: reformatted driver code and linkage. Some optimizations
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#define NEW_KERNEL_PCI_H
|
||||
|
||||
#include <types.h>
|
||||
#include <driver.h>
|
||||
#include <stdbool.h>
|
||||
#include <attributes.h>
|
||||
|
||||
@@ -76,14 +77,6 @@
|
||||
|
||||
#define PCI_INTERRUPT_LINE_DISABLED 0xff
|
||||
|
||||
#ifndef PCI_DRIVER_ALIGNMENT
|
||||
#if defined(__LP64__)
|
||||
#define PCI_DRIVER_ALIGNMENT 16
|
||||
#else
|
||||
#define PCI_DRIVER_ALIGNMENT 8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct pci_device pci_device;
|
||||
|
||||
typedef uint8_t (*pci_driver_validate)(const pci_device *);
|
||||
@@ -103,16 +96,9 @@ struct pci_driver {
|
||||
};
|
||||
pci_driver_validate validate;
|
||||
pci_driver_initialize initialize;
|
||||
} __attribute__((__aligned__(PCI_DRIVER_ALIGNMENT)));
|
||||
} __attribute__((__aligned__(STRUCT_ALIGNMENT)));
|
||||
|
||||
#define PCI_DRIVER_NAME(counter) DRIVER_CAT(pci_driver_, counter)
|
||||
#define DRIVER_CAT(a, b) DRIVER_DUMMY() a ## b
|
||||
#define DRIVER_DUMMY()
|
||||
|
||||
#define PCI_DRIVER(data...) \
|
||||
static struct pci_driver PCI_DRIVER_NAME(__COUNTER__) \
|
||||
__attribute((__used__, __section__("pci_drivers"))) \
|
||||
= { data }
|
||||
#define PCI_DRIVER(data...) GENERIC_DRIVER(pci_driver, data)
|
||||
|
||||
typedef struct {
|
||||
uint32_t address;
|
||||
|
||||
Reference in New Issue
Block a user