#define SRIOV_ERROR -1
struct _virPCIDevice {
- unsigned domain;
- unsigned bus;
- unsigned slot;
- unsigned function;
+ unsigned int domain;
+ unsigned int bus;
+ unsigned int slot;
+ unsigned int function;
char name[PCI_ADDR_LEN]; /* domain:bus:slot.function */
char id[PCI_ID_LEN]; /* product vendor */
char *path;
const char *used_by; /* The domain which uses the device */
- unsigned pcie_cap_pos;
- unsigned pci_pm_cap_pos;
+ unsigned int pcie_cap_pos;
+ unsigned int pci_pm_cap_pos;
bool has_flr;
bool has_pm_reset;
bool managed;
struct _virPCIDeviceList {
virObjectLockable parent;
- unsigned count;
+ unsigned int count;
virPCIDevicePtr *devs;
};
static int
virPCIDeviceRead(virPCIDevicePtr dev,
int cfgfd,
- unsigned pos,
+ unsigned int pos,
uint8_t *buf,
- unsigned buflen)
+ unsigned int buflen)
{
memset(buf, 0, buflen);
}
static uint8_t
-virPCIDeviceRead8(virPCIDevicePtr dev, int cfgfd, unsigned pos)
+virPCIDeviceRead8(virPCIDevicePtr dev, int cfgfd, unsigned int pos)
{
uint8_t buf;
virPCIDeviceRead(dev, cfgfd, pos, &buf, sizeof(buf));
}
static uint16_t
-virPCIDeviceRead16(virPCIDevicePtr dev, int cfgfd, unsigned pos)
+virPCIDeviceRead16(virPCIDevicePtr dev, int cfgfd, unsigned int pos)
{
uint8_t buf[2];
virPCIDeviceRead(dev, cfgfd, pos, &buf[0], sizeof(buf));
}
static uint32_t
-virPCIDeviceRead32(virPCIDevicePtr dev, int cfgfd, unsigned pos)
+virPCIDeviceRead32(virPCIDevicePtr dev, int cfgfd, unsigned int pos)
{
uint8_t buf[4];
virPCIDeviceRead(dev, cfgfd, pos, &buf[0], sizeof(buf));
static int
virPCIDeviceWrite(virPCIDevicePtr dev,
int cfgfd,
- unsigned pos,
+ unsigned int pos,
uint8_t *buf,
- unsigned buflen)
+ unsigned int buflen)
{
if (lseek(cfgfd, pos, SEEK_SET) != pos ||
safewrite(cfgfd, buf, buflen) != buflen) {
}
static void
-virPCIDeviceWrite16(virPCIDevicePtr dev, int cfgfd, unsigned pos, uint16_t val)
+virPCIDeviceWrite16(virPCIDevicePtr dev, int cfgfd, unsigned int pos, uint16_t val)
{
uint8_t buf[2] = { (val >> 0), (val >> 8) };
virPCIDeviceWrite(dev, cfgfd, pos, &buf[0], sizeof(buf));
}
static void
-virPCIDeviceWrite32(virPCIDevicePtr dev, int cfgfd, unsigned pos, uint32_t val)
+virPCIDeviceWrite32(virPCIDevicePtr dev, int cfgfd, unsigned int pos, uint32_t val)
{
uint8_t buf[4] = { (val >> 0), (val >> 8), (val >> 16), (val >> 24) };
virPCIDeviceWrite(dev, cfgfd, pos, &buf[0], sizeof(buf));
}
static uint8_t
-virPCIDeviceFindCapabilityOffset(virPCIDevicePtr dev, int cfgfd, unsigned capability)
+virPCIDeviceFindCapabilityOffset(virPCIDevicePtr dev,
+ int cfgfd,
+ unsigned int capability)
{
uint16_t status;
uint8_t pos;
static unsigned int
virPCIDeviceFindExtendedCapabilityOffset(virPCIDevicePtr dev,
int cfgfd,
- unsigned capability)
+ unsigned int capability)
{
int ttl;
unsigned int pos;
* and that a D3hot->D0 transition will results in a full
* internal reset, not just a soft reset.
*/
-static unsigned
+static unsigned int
virPCIDeviceDetectPowerManagementReset(virPCIDevicePtr dev, int cfgfd)
{
if (dev->pci_pm_cap_pos) {
}
int
-virPCIGetAddrString(unsigned domain,
- unsigned bus,
- unsigned slot,
- unsigned function,
+virPCIGetAddrString(unsigned int domain,
+ unsigned int bus,
+ unsigned int slot,
+ unsigned int function,
char **pciConfigAddr)
{
virPCIDevicePtr dev = NULL;
}
virPCIDevicePtr
-virPCIDeviceNew(unsigned domain,
- unsigned bus,
- unsigned slot,
- unsigned function)
+virPCIDeviceNew(unsigned int domain,
+ unsigned int bus,
+ unsigned int slot,
+ unsigned int function)
{
virPCIDevicePtr dev;
char *vendor = NULL;
dev->managed = managed;
}
-unsigned virPCIDeviceGetManaged(virPCIDevicePtr dev)
+unsigned int
+virPCIDeviceGetManaged(virPCIDevicePtr dev)
{
return dev->managed;
}
-unsigned
+unsigned int
virPCIDeviceGetUnbindFromStub(virPCIDevicePtr dev)
{
return dev->unbind_from_stub;
dev->unbind_from_stub = unbind;
}
-unsigned
+unsigned int
virPCIDeviceGetRemoveSlot(virPCIDevicePtr dev)
{
return dev->remove_slot;
dev->remove_slot = remove_slot;
}
-unsigned
+unsigned int
virPCIDeviceGetReprobe(virPCIDevicePtr dev)
{
return dev->reprobe;
unsigned int function;
};
-virPCIDevicePtr virPCIDeviceNew(unsigned domain,
- unsigned bus,
- unsigned slot,
- unsigned function);
+virPCIDevicePtr virPCIDeviceNew(unsigned int domain,
+ unsigned int bus,
+ unsigned int slot,
+ unsigned int function);
void virPCIDeviceFree(virPCIDevicePtr dev);
const char *virPCIDeviceGetName(virPCIDevicePtr dev);
void virPCIDeviceSetManaged(virPCIDevice *dev,
bool managed);
-unsigned virPCIDeviceGetManaged(virPCIDevice *dev);
+unsigned int virPCIDeviceGetManaged(virPCIDevice *dev);
void virPCIDeviceSetUsedBy(virPCIDevice *dev,
const char *used_by);
const char *virPCIDeviceGetUsedBy(virPCIDevice *dev);
-unsigned virPCIDeviceGetUnbindFromStub(virPCIDevicePtr dev);
+unsigned int virPCIDeviceGetUnbindFromStub(virPCIDevicePtr dev);
void virPCIDeviceSetUnbindFromStub(virPCIDevice *dev,
bool unbind);
-unsigned virPCIDeviceGetRemoveSlot(virPCIDevicePtr dev);
+unsigned int virPCIDeviceGetRemoveSlot(virPCIDevicePtr dev);
void virPCIDeviceSetRemoveSlot(virPCIDevice *dev,
bool remove_slot);
-unsigned virPCIDeviceGetReprobe(virPCIDevicePtr dev);
+unsigned int virPCIDeviceGetReprobe(virPCIDevicePtr dev);
void virPCIDeviceSetReprobe(virPCIDevice *dev,
bool reprobe);
void virPCIDeviceReattachInit(virPCIDevice *dev);
char **pci_sysfs_device_link)
ATTRIBUTE_RETURN_CHECK;
-int virPCIGetAddrString(unsigned domain,
- unsigned bus,
- unsigned slot,
- unsigned function,
+int virPCIGetAddrString(unsigned int domain,
+ unsigned int bus,
+ unsigned int slot,
+ unsigned int function,
char **pciConfigAddr)
ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;