2006-05-16 16:10:21 +02:00
|
|
|
#ifndef _GPXE_DEVICE_H
|
|
|
|
#define _GPXE_DEVICE_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*
|
|
|
|
* Device model
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gpxe/list.h>
|
|
|
|
#include <gpxe/tables.h>
|
|
|
|
|
2007-03-10 19:08:33 +01:00
|
|
|
/** A hardware device description */
|
|
|
|
struct device_description {
|
2007-01-10 16:27:48 +01:00
|
|
|
/** Bus type
|
|
|
|
*
|
2007-03-10 19:08:33 +01:00
|
|
|
* This must be a BUS_TYPE_XXX constant.
|
2007-01-10 16:27:48 +01:00
|
|
|
*/
|
|
|
|
unsigned int bus_type;
|
2007-03-10 19:08:33 +01:00
|
|
|
/** Location
|
2007-01-10 16:27:48 +01:00
|
|
|
*
|
2007-03-10 19:08:33 +01:00
|
|
|
* The interpretation of this field is bus-type-specific.
|
2007-01-10 16:27:48 +01:00
|
|
|
*/
|
2007-03-10 19:08:33 +01:00
|
|
|
unsigned int location;
|
2007-01-10 16:27:48 +01:00
|
|
|
/** Vendor ID */
|
|
|
|
unsigned int vendor;
|
|
|
|
/** Device ID */
|
|
|
|
unsigned int device;
|
2007-07-02 18:43:32 +02:00
|
|
|
/** Device class */
|
|
|
|
unsigned long class;
|
|
|
|
/** I/O address */
|
|
|
|
unsigned long ioaddr;
|
|
|
|
/** IRQ */
|
|
|
|
unsigned int irq;
|
2007-01-10 16:27:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** PCI bus type */
|
|
|
|
#define BUS_TYPE_PCI 1
|
|
|
|
|
2007-03-10 19:08:33 +01:00
|
|
|
/** ISAPnP bus type */
|
2007-01-10 16:27:48 +01:00
|
|
|
#define BUS_TYPE_ISAPNP 2
|
|
|
|
|
2007-03-10 19:08:33 +01:00
|
|
|
/** EISA bus type */
|
|
|
|
#define BUS_TYPE_EISA 3
|
|
|
|
|
|
|
|
/** MCA bus type */
|
|
|
|
#define BUS_TYPE_MCA 4
|
|
|
|
|
|
|
|
/** ISA bus type */
|
|
|
|
#define BUS_TYPE_ISA 5
|
2007-01-10 16:27:48 +01:00
|
|
|
|
2006-05-16 16:10:21 +02:00
|
|
|
/** A hardware device */
|
|
|
|
struct device {
|
2007-01-10 05:22:09 +01:00
|
|
|
/** Name */
|
|
|
|
char name[16];
|
2007-01-10 16:27:48 +01:00
|
|
|
/** Device description */
|
2007-03-10 19:08:33 +01:00
|
|
|
struct device_description desc;
|
2006-05-16 16:10:21 +02:00
|
|
|
/** Devices on the same bus */
|
|
|
|
struct list_head siblings;
|
|
|
|
/** Devices attached to this device */
|
|
|
|
struct list_head children;
|
|
|
|
/** Bus device */
|
|
|
|
struct device *parent;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A root device
|
|
|
|
*
|
|
|
|
* Root devices are system buses such as PCI, EISA, etc.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct root_device {
|
|
|
|
/** Device chain
|
|
|
|
*
|
|
|
|
* A root device has a NULL parent field.
|
|
|
|
*/
|
|
|
|
struct device dev;
|
|
|
|
/** Root device driver */
|
|
|
|
struct root_driver *driver;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** A root device driver */
|
|
|
|
struct root_driver {
|
|
|
|
/**
|
|
|
|
* Add root device
|
|
|
|
*
|
|
|
|
* @v rootdev Root device
|
|
|
|
* @ret rc Return status code
|
|
|
|
*
|
|
|
|
* Called from probe_devices() for all root devices in the build.
|
|
|
|
*/
|
|
|
|
int ( * probe ) ( struct root_device *rootdev );
|
|
|
|
/**
|
|
|
|
* Remove root device
|
|
|
|
*
|
|
|
|
* @v rootdev Root device
|
|
|
|
*
|
|
|
|
* Called from remove_device() for all successfully-probed
|
|
|
|
* root devices.
|
|
|
|
*/
|
|
|
|
void ( * remove ) ( struct root_device *rootdev );
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Declare a root device */
|
2007-01-10 05:22:09 +01:00
|
|
|
#define __root_device __table ( struct root_device, root_devices, 01 )
|
2006-05-16 16:10:21 +02:00
|
|
|
|
|
|
|
#endif /* _GPXE_DEVICE_H */
|