summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/scripts/i386.lds9
-rw-r--r--src/core/dev.c19
-rw-r--r--src/include/dev.h15
3 files changed, 13 insertions, 30 deletions
diff --git a/src/arch/i386/scripts/i386.lds b/src/arch/i386/scripts/i386.lds
index d6ae9be3..9da043d2 100644
--- a/src/arch/i386/scripts/i386.lds
+++ b/src/arch/i386/scripts/i386.lds
@@ -145,18 +145,9 @@ SECTIONS {
*(SORT(.tbl.*))
- device_drivers = .;
- *(.drivers.device)
- device_drivers_end = .;
isa_drivers = . ;
*(.drivers.isa)
isa_drivers_end = .;
- bus_drivers = .;
- *(.drivers.bus)
- bus_drivers_end = .;
- type_drivers = .;
- *(.drivers.type)
- type_drivers_end = .;
_progbits_end = .;
}
diff --git a/src/core/dev.c b/src/core/dev.c
index 8fa3089d..f03965d2 100644
--- a/src/core/dev.c
+++ b/src/core/dev.c
@@ -3,19 +3,18 @@
#include "dev.h"
/*
- * Each driver specifies a name, the bus-scanning function
- * (find_bus_boot_device) that it wants to use, a driver information
- * structure (bus_driver) containing e.g. device IDs to be passed to
- * find_bus_boot_device, and a probe function (probe) to be called
- * whenever a suitable device is found.
+ * Each bus driver defines several methods, which are described in
+ * dev.h. This file provides a centralised, bus-independent mechanism
+ * for locating devices and drivers.
*
- * The generic device-probing code knows nothing about particular bus
- * types; it simply passes the driver information structure
- * (bus_driver) to the bus-scanning function (find_bus_boot_device),
- * then passes the result of that function (if not NULL) to the probe
- * function (probe).
*/
+/* Linker symbols for the various tables */
+static struct bus_driver bus_drivers[0] __table_start ( bus_driver );
+static struct bus_driver bus_drivers_end[0] __table_end ( bus_driver );
+static struct device_driver device_drivers[0] __table_start ( device_driver );
+static struct device_driver device_drivers_end[0] __table_end (device_driver );
+
/* Current attempted boot device */
struct dev dev = {
.bus_driver = bus_drivers,
diff --git a/src/include/dev.h b/src/include/dev.h
index e441da5e..8bf17355 100644
--- a/src/include/dev.h
+++ b/src/include/dev.h
@@ -4,6 +4,7 @@
#include "stdint.h"
#include "string.h"
#include "dhcp.h" /* for dhcp_dev_id */
+#include "tables.h"
/*
* Forward declarations
@@ -158,7 +159,7 @@ struct bus_driver {
const char * ( *name_device ) ( struct bus_dev *bus_dev );
};
-#define __bus_driver __attribute__ (( used, __section__ ( ".drivers.bus" ) ))
+#define __bus_driver __attribute__ (( used, __table_section(bus_driver,01) ))
/*
* A structure fully describing the bus-independent parts of a
@@ -187,7 +188,7 @@ struct type_driver {
unsigned int len, int eof ) );
};
-#define __type_driver __attribute__ (( used, __section__ ( ".drivers.type" ) ))
+#define __type_driver __attribute__ (( used, __table_section(type_driver,01) ))
/*
* A driver for a device.
@@ -205,7 +206,7 @@ struct device_driver {
};
#define __device_driver \
- __attribute__ (( used, __section__ ( ".drivers.device" ) ))
+ __attribute__ (( used, __table_section(device_driver,01) ))
#define DRIVER(_name,_type_driver,_bus_driver,_bus_info, \
_probe,_disable) \
@@ -283,12 +284,4 @@ static inline int load ( struct dev *dev,
return dev->type_driver->load ( dev->type_dev, process );
}
-/* Linker symbols for the various tables */
-extern struct bus_driver bus_drivers[];
-extern struct bus_driver bus_drivers_end[];
-extern struct type_driver type_drivers[];
-extern struct type_driver type_drivers_end[];
-extern struct device_driver device_drivers[];
-extern struct device_driver device_drivers_end[];
-
#endif /* DEV_H */