yo solo se lo del PCI, que te servira para la mayorria del hardware.
Al hardware se le suelen asignar unas direcciones de I/O o tambin de memria. pueden ser estáticas o variar.
Se enumeran asi:
#define outb(port,value) \
__asm__ __volatile__("outb %%al,%%dx"::"a" (value),"d" (port))
#define inb(port) ({\
unsigned char _v; \
__asm__ __volatile__ ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
_v; \
})
#define outw(port,value) \
__asm__ __volatile__("outw %%ax,%%dx"::"a" (value),"d" (port))
#define inw(port) ({\
unsigned short _v; \
__asm__ __volatile__ ("inw %%dx,%%ax":"=a" (_v):"d" (port)); \
_v; \
})
#define outd(port,value) \
__asm__ __volatile__("outl %%eax,%%dx"::"a" (value),"d" (port))
#define ind(port) ({\
unsigned long _v; \
__asm__ __volatile__ ("inl %%dx,%%eax":"=a" (_v):"d" (port)); \
_v; \
})
#define PCI_CONFIG_ADDRESS 0xCF8
#define PCI_CONFIG_DATA 0xCFC
//Las direcciones del espacio PCI estan compuestas de esta manera
typedef struct PCI_ADDRESS{
union {
struct {
unsigned long zero:2;
unsigned long Registro:6;//Numero de registro del espacio PCI de un dispositivo
unsigned long Funtion:3;
unsigned long Device:5;
unsigned long Bus:8;
unsigned long Reserved:7;
unsigned long Enable:1;
}flag;
unsigned long ADDRESS;
};
}PCI_ADDRESS;
typedef struct HARDWARE_ID{
union{
struct {
unsigned long vendor;
unsigned long device;
};
unsigned long id;
};
}HARDWARE_ID;
void PCI_Enum(){
PCI_ADDRESS Addr;
HARDWARE_ID ID;
Addr.ADDRESS = 0;
ID.id = 0;
Addr.flag.Enable = 1;
for(short bus = 0;bus<256;bus++){//Busca en un numero de bus los dispositivos, hay 256 posibles
//Cada bus tiene al menos un dispositivo y 32 de maximo
for(short dev = 0;dev<32;dev++){//Busca en un bus los dispositivos
//Cada dispositivo puede tener una o hasta 8 funciones diferentes
for(int fun = 0;fun<8;fun++){//La funcion 0 siempre estara disponible, sino el dispositivo no esta
Addr.flag.Funtion = fun;
Addr.flag.Device = dev;
Addr.flag.Bus = bus;
outd(PCI_CONFIG_ADDRESS,Addr.ADDRESS);
ID.id = ind(PCI_CONFIG_DATA);
if(!(ID.vendor+1)){//Si el vendor es 0xFFFF significa que esa funcion no esta presente
if(!fun)break;
}else{
printf("Detected: PCI\VEND_%X04&DEV_%X04\n",ID.
vendor, ID.
device); };
}
};
}
};
busca en esta pagina lo que necesites:
http://wiki.osdev.org/PCI#Configuration_Space