2
0
mirror of https://github.com/xcat2/xNBA.git synced 2026-01-12 01:52:30 +00:00
Files
xNBA/src/include/ipxe/device.h
Michael Brown 3c35ae2f3b [int13] Add infrastructure to support EDD version 4.0
Support the extensions mandated by EDD 4.0, including:

 o  the ability to specify a flat physical address in a disk address
    packet,

 o  the ability to specify a sector count greater than 127 in a disk
    address packet,

 o  support for all functions within the Fixed Disk Access and EDD
    Support subsets,

 o  the ability to describe a device using EDD Device Path Information.

This implementation is based on draft revision 3 of the EDD 4.0
specification, with reference to the EDD 3.0 specification.  It is
possible that this implementation may need to change in order to
conform to the final published EDD 4.0 specification.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-22 17:09:56 +01:00

120 lines
2.2 KiB
C

#ifndef _IPXE_DEVICE_H
#define _IPXE_DEVICE_H
/**
* @file
*
* Device model
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/list.h>
#include <ipxe/tables.h>
struct interface;
/** A hardware device description */
struct device_description {
/** Bus type
*
* This must be a BUS_TYPE_XXX constant.
*/
unsigned int bus_type;
/** Location
*
* The interpretation of this field is bus-type-specific.
*/
unsigned int location;
/** Vendor ID */
unsigned int vendor;
/** Device ID */
unsigned int device;
/** Device class */
unsigned long class;
/** I/O address */
unsigned long ioaddr;
/** IRQ */
unsigned int irq;
};
/** PCI bus type */
#define BUS_TYPE_PCI 1
/** ISAPnP bus type */
#define BUS_TYPE_ISAPNP 2
/** EISA bus type */
#define BUS_TYPE_EISA 3
/** MCA bus type */
#define BUS_TYPE_MCA 4
/** ISA bus type */
#define BUS_TYPE_ISA 5
/** A hardware device */
struct device {
/** Name */
char name[16];
/** Device description */
struct device_description desc;
/** 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 );
};
/** Root device table */
#define ROOT_DEVICES __table ( struct root_device, "root_devices" )
/** Declare a root device */
#define __root_device __table_entry ( ROOT_DEVICES, 01 )
extern struct device * identify_device ( struct interface *intf );
#define identify_device_TYPE( object_type ) \
typeof ( struct device * ( object_type ) )
#endif /* _IPXE_DEVICE_H */