Lines Matching refs:offset

23 static uint8_t libpci_vdevice_rebase_callback_ioread(libpci_vdevice_t* vdevice, int offset) {
25 assert(offset >= PCI_BASE_ADDRESS_0 && offset < PCI_BASE_ADDRESS_5 + 4);
27 int index = (offset - PCI_BASE_ADDRESS_0) / 4;
28 int byte_offset = (offset - PCI_BASE_ADDRESS_0) % 4;
34 static void libpci_vdevice_rebase_callback_iowrite(libpci_vdevice_t* vdevice, int offset,
37 assert(offset >= PCI_BASE_ADDRESS_0 && offset < PCI_BASE_ADDRESS_5 + 4);
39 int index = (offset - PCI_BASE_ADDRESS_0) / 4;
40 int byte_offset = (offset - PCI_BASE_ADDRESS_0) % 4;
77 void libpci_vdevice_set_mode(libpci_vdevice_t* self, int offset,
80 assert(offset >= 0 && offset < PCI_STD_HEADER_SIZEOF);
82 int sz = libpci_device_cfg_sizeof(offset);
86 self->mode[offset + i] = m;
191 uint32_t libpci_vdevice_ioread(libpci_vdevice_t* self, int offset, int size){
194 assert(offset >= 0);
200 if ((offset + size) >= PCI_STD_HEADER_SIZEOF) {
202 printf("ERROR: device tried to access extended PCI config space offset %d, but "
204 "misconfiguration.\n", offset + size);
213 offset, size);
218 libpci_vdevice_mode_t* m = &self->mode[offset + i];
227 offset + i);
231 printf("PCI_VDEVICE_MODE_FATAL_ERROR triggered for offset %d size %d\n", offset, size);
239 result_byte = m->callback_ioread(self, offset + i);
252 void libpci_vdevice_iowrite(libpci_vdevice_t* self, int offset, int size, uint32_t val) {
255 assert(offset >= 0);
259 if ((offset + size) >= PCI_STD_HEADER_SIZEOF) {
261 printf("ERROR: device tried to access extended PCI config space offset %d, but "
263 "misconfiguration.\n", offset + size);
272 offset, val, size);
279 libpci_vdevice_mode_t* m = &self->mode[offset + i];
290 offset, val, size);
296 libpci_vdevice_mode_t* m = &self->mode[offset + i];
301 printf(" writing 0x%x into offset %d (total val = 0x%x)\n", val_p[i], offset + i, val);
305 offset + i, val_p[i]);
309 printf("PCI_VDEVICE_MODE_FATAL_ERROR triggered for offset %d size %d\n", offset, size);
317 m->callback_iowrite(self, offset + i, ((uint8_t*)(&val))[i]);