Lines Matching refs:offset

20 int vmm_pci_mem_device_read(void *cookie, int offset, int size, uint32_t *result)
22 if (offset < 0) {
26 if (offset + size >= PCI_CAPABILITY_SPACE_OFFSET) {
32 /* Read the PCI device field at the given offset
34 memcpy(result, cookie + offset, size);
39 int vmm_pci_mem_device_write(void *cookie, int offset, int size, uint32_t value)
41 if (offset < 0) {
45 if (offset + size >= PCI_CAPABILITY_SPACE_OFFSET) {
56 /* Write the PCI device field at the given offset
58 memcpy(cookie + offset, &value, size);
63 int vmm_pci_entry_ignore_write(void *cookie, int offset, int size, uint32_t value)
65 ZF_LOGI("Ignoring PCI entry write @ offset 0x%x", offset);
107 static int passthrough_pci_config_ioread(void *cookie, int offset, int size, uint32_t *result)
112 *result = dev->config.ioread8(dev->config.cookie, dev->addr, offset);
115 *result = dev->config.ioread16(dev->config.cookie, dev->addr, offset);
118 *result = dev->config.ioread32(dev->config.cookie, dev->addr, offset);
126 static int passthrough_pci_config_iowrite(void *cookie, int offset, int size, uint32_t val)
131 dev->config.iowrite8(dev->config.cookie, dev->addr, offset, val);
134 dev->config.iowrite16(dev->config.cookie, dev->addr, offset, val);
137 dev->config.iowrite32(dev->config.cookie, dev->addr, offset, val);
145 static int pci_bar_emul_check_range(unsigned int offset, unsigned int size)
147 if (offset < PCI_BASE_ADDRESS_0 || offset + size > PCI_BASE_ADDRESS_5 + 4) {
171 static int pci_irq_emul_read(void *cookie, int offset, int size, uint32_t *result)
174 if (offset <= PCI_INTERRUPT_LINE && offset + size > PCI_INTERRUPT_LINE) {
176 int ret = emul->passthrough.ioread(emul->passthrough.cookie, offset, size, result);
180 int bit_offset = (PCI_INTERRUPT_LINE - offset) * 8;
185 return emul->passthrough.ioread(emul->passthrough.cookie, offset, size, result);
189 static int pci_irq_emul_write(void *cookie, int offset, int size, uint32_t value)
192 if (offset == PCI_INTERRUPT_LINE && size == 1) {
195 } else if (offset < PCI_INTERRUPT_LINE && offset + size >= PCI_INTERRUPT_LINE) {
199 return emul->passthrough.iowrite(emul->passthrough.cookie, offset, size, value);
203 static int pci_bar_emul_read(void *cookie, int offset, int size, uint32_t *result)
206 if (pci_bar_emul_check_range(offset, size)) {
207 return emul->passthrough.ioread(emul->passthrough.cookie, offset, size, result);
210 int bar = (offset - PCI_BASE_ADDRESS_0) / 4;
211 int bar_offset = offset & 3;
219 static int pci_bar_emul_write(void *cookie, int offset, int size, uint32_t value)
222 if (pci_bar_emul_check_range(offset, size)) {
223 return emul->passthrough.iowrite(emul->passthrough.cookie, offset, size, value);
226 int bar = (offset - PCI_BASE_ADDRESS_0) / 4;
227 int bar_offset = offset & 3;
233 static int pci_bar_passthrough_emul_read(void *cookie, int offset, int size, uint32_t *result)
236 return emul->passthrough.ioread(emul->passthrough.cookie, offset, size, result);
239 static int pci_bar_passthrough_emul_write(void *cookie, int offset, int size, uint32_t value)
242 return emul->passthrough.iowrite(emul->passthrough.cookie, offset, size, value);
294 static int pci_cap_emul_read(void *cookie, int offset, int size, uint32_t *result)
297 if (offset <= PCI_STATUS && offset + size > PCI_STATUS) {
299 int ret = emul->passthrough.ioread(emul->passthrough.cookie, offset, size, result);
303 int bit_offset = (PCI_STATUS - offset) * 8;
309 } else if (offset <= PCI_CAPABILITY_LIST && offset + size > PCI_CAPABILITY_LIST) {
311 int ret = emul->passthrough.ioread(emul->passthrough.cookie, offset, size, result);
315 int bit_offset = (PCI_CAPABILITY_LIST - offset) * 8;
325 if (offset <= emul->ignore_start[i] && offset + size > emul->ignore_end[i]) {
327 ZF_LOGI("Attempted read at 0x%x of size %d from region 0x%x-0x%x", offset, size, emul->ignore_start[i],
335 if (offset <= emul->caps[i] + 1 && offset + size > emul->caps[i] + 1) {
337 int ret = emul->passthrough.ioread(emul->passthrough.cookie, offset, size, result);
341 int bit_offset = (emul->caps[i] + 1 - offset) * 8;
350 return emul->passthrough.ioread(emul->passthrough.cookie, offset, size, result);
353 static int pci_cap_emul_write(void *cookie, int offset, int size, uint32_t value)
359 if (offset <= emul->ignore_start[i] && offset + size > emul->ignore_end[i]) {
361 ZF_LOGI("Attempted write at 0x%x of size %d from region 0x%x-0x%x", offset, size, emul->ignore_start[i],
366 return emul->passthrough.iowrite(emul->passthrough.cookie, offset, size, value);