2010-09-29 13:59:24 +02:00
|
|
|
|
|
|
|
#include <ddk.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <mutex.h>
|
|
|
|
#include <pci.h>
|
|
|
|
#include <syscall.h>
|
|
|
|
|
|
|
|
int pci_bus_read_config_byte (struct pci_bus *bus, u32 devfn,
|
|
|
|
int pos, u8 *value)
|
|
|
|
{
|
|
|
|
// raw_spin_lock_irqsave(&pci_lock, flags);
|
|
|
|
*value = PciRead8(bus->number, devfn, pos);
|
|
|
|
// raw_spin_unlock_irqrestore(&pci_lock, flags);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int pci_bus_read_config_word (struct pci_bus *bus, u32 devfn,
|
|
|
|
int pos, u16 *value)
|
|
|
|
{
|
|
|
|
if ( pos & 1)
|
|
|
|
return PCIBIOS_BAD_REGISTER_NUMBER;
|
|
|
|
|
|
|
|
// raw_spin_lock_irqsave(&pci_lock, flags);
|
|
|
|
*value = PciRead16(bus->number, devfn, pos);
|
|
|
|
// raw_spin_unlock_irqrestore(&pci_lock, flags);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int pci_bus_read_config_dword (struct pci_bus *bus, u32 devfn,
|
2010-09-30 20:43:26 +02:00
|
|
|
int pos, u32 *value)
|
2010-09-29 13:59:24 +02:00
|
|
|
{
|
|
|
|
if ( pos & 3)
|
|
|
|
return PCIBIOS_BAD_REGISTER_NUMBER;
|
|
|
|
|
|
|
|
// raw_spin_lock_irqsave(&pci_lock, flags);
|
|
|
|
*value = PciRead32(bus->number, devfn, pos);
|
|
|
|
// raw_spin_unlock_irqrestore(&pci_lock, flags);
|
|
|
|
return 0;
|
|
|
|
}
|