38 #define PCI_CONFIG_ADDR_PORT 0xCF8
40 #define PCI_CONFIG_DATA_PORT 0xCFC
53 outl(PCI_CONFIG_ADDR_PORT, addr.raw);
66 return inl(PCI_CONFIG_DATA_PORT);
79 outl(PCI_CONFIG_DATA_PORT, data);
95 data = pci_config_read(addr);
96 pci_config_write(addr, data | flags);
108 SYSCALLS_DEFINE_SINGLETON(pci_irq_agent_set_pirq,
110 IRQAGENT agent, INTR_PIN pin, PIRQ pirq)
113 uint32_t rcba_addr, offset = 0;
115 rcba_addr = PROT_DOMAINS_MMIO(root_complex_drv);
117 assert(agent >= IRQAGENT0 && agent <= IRQAGENT3);
118 assert(pin >= INTA && pin <= INTD);
119 assert(pirq >= PIRQA && pirq <= PIRQH);
141 prot_domains_enable_mmio();
143 MMIO_READW(value, *(uint16_t ATTR_MMIO_ADDR_SPACE *)(rcba_addr + offset));
153 value |= (pirq << 4);
157 value |= (pirq << 8);
161 value |= (pirq << 12);
164 MMIO_WRITEW(*(uint16_t ATTR_MMIO_ADDR_SPACE *)(rcba_addr + offset), value);
166 prot_domains_disable_mmio();
179 pci_pirq_set_irq(PIRQ pirq, uint8_t irq, uint8_t route_to_legacy)
184 assert(pirq >= PIRQA && pirq <= PIRQH);
185 assert(irq >= 0 && irq <= 0xF);
186 assert(route_to_legacy == 0 || route_to_legacy == 1);
192 pci.
reg_off = (pirq <= PIRQD) ? 0x60 : 0x64;
194 value = pci_config_read(pci);
201 value |= (!route_to_legacy << 7);
207 value |= (!route_to_legacy << 15);
212 value |= (irq << 16);
213 value |= (!route_to_legacy << 23);
217 value &= ~0x8F000000;
218 value |= (irq << 24);
219 value |= (!route_to_legacy << 31);
223 outl(PCI_CONFIG_DATA_PORT, value);
247 mmio = pci_config_read(pci_addr) & ~0xFFF;
249 prot_domains_reg(c_this, mmio, mmio_sz, meta, meta_sz,
false);
256 pci_root_complex_init(
void)
264 rcba_addr = pci_config_read(pci) & ~0x3FFF;
266 PROT_DOMAINS_INIT_ID(root_complex_drv);
267 prot_domains_reg(&root_complex_drv, rcba_addr, 0x4000, 0, 0,
false);
268 SYSCALLS_INIT(pci_irq_agent_set_pirq);
269 SYSCALLS_AUTHZ(pci_irq_agent_set_pirq, root_complex_drv);
276 pci_root_complex_lock(
void)
278 SYSCALLS_DEAUTHZ(pci_irq_agent_set_pirq, root_complex_drv);
uint32_t func
Function number.
static uip_ds6_addr_t * addr
Pointer to a router list entry.
PCI configuration address.
uint32_t dev
Device number.
Data associated with each protection domain that is owned by clients of that domain and used to ident...
uint32_t en_mapping
Must be set to perform PCI configuration access.
uint32_t reg_off
Register/offset number.