diff options
-rw-r--r-- | sys/arch/alpha/pci/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/amd64/include/i82093var.h | 3 | ||||
-rw-r--r-- | sys/arch/amd64/include/pci_machdep.h | 7 | ||||
-rw-r--r-- | sys/arch/amd64/pci/pci_machdep.c | 145 | ||||
-rw-r--r-- | sys/arch/arm/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/hppa/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/hppa64/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/i386/pci/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/landisk/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/loongson/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/macppc/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/octeon/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/sgi/pci/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/socppc/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/pcireg.h | 17 |
16 files changed, 191 insertions, 17 deletions
diff --git a/sys/arch/alpha/pci/pci_machdep.h b/sys/arch/alpha/pci/pci_machdep.h index fc80bd0f306..7168db82d87 100644 --- a/sys/arch/alpha/pci/pci_machdep.h +++ b/sys/arch/alpha/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.29 2015/07/26 05:09:44 miod Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.30 2016/05/04 14:30:00 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.6 1996/11/19 04:49:21 cgd Exp $ */ /* @@ -104,6 +104,7 @@ int alpha_sysctl_chipset(int *, u_int, char *, size_t *); #define pci_conf_write(c, t, r, v) \ (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v)) #define pci_intr_map_msi(pa, ihp) (-1) +#define pci_intr_map_msix(pa, vec, ihp) (-1) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) #define pci_intr_line(c, ih) \ diff --git a/sys/arch/amd64/include/i82093var.h b/sys/arch/amd64/include/i82093var.h index 41b16842da6..9877422de42 100644 --- a/sys/arch/amd64/include/i82093var.h +++ b/sys/arch/amd64/include/i82093var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82093var.h,v 1.4 2011/05/21 15:58:27 kettenis Exp $ */ +/* $OpenBSD: i82093var.h,v 1.5 2016/05/04 14:30:00 kettenis Exp $ */ /* $NetBSD: i82093var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /*- @@ -70,6 +70,7 @@ struct ioapic_softc { #define APIC_INT_VIA_APIC 0x10000000 #define APIC_INT_VIA_MSG 0x20000000 +#define APIC_INT_VIA_MSGX 0x40000000 #define APIC_INT_APIC_MASK 0x00ff0000 #define APIC_INT_APIC_SHIFT 16 #define APIC_INT_PIN_MASK 0x0000ff00 diff --git a/sys/arch/amd64/include/pci_machdep.h b/sys/arch/amd64/include/pci_machdep.h index 09ad9888707..27b833b52cc 100644 --- a/sys/arch/amd64/include/pci_machdep.h +++ b/sys/arch/amd64/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.24 2015/10/29 23:08:45 miod Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.25 2016/05/04 14:30:00 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */ /* @@ -82,7 +82,10 @@ int pci_conf_size(pci_chipset_tag_t, pcitag_t); pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int); void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); -int pci_intr_map_msi(struct pci_attach_args *, pci_intr_handle_t *); +int pci_intr_map_msi(struct pci_attach_args *, + pci_intr_handle_t *); +int pci_intr_map_msix(struct pci_attach_args *, + int, pci_intr_handle_t *); int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *); const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t); void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c index 37532dabc16..6ce0ce4961e 100644 --- a/sys/arch/amd64/pci/pci_machdep.c +++ b/sys/arch/amd64/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.62 2015/03/14 03:38:46 jsg Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.63 2016/05/04 14:30:00 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -395,6 +395,143 @@ pci_intr_map_msi(struct pci_attach_args *pa, pci_intr_handle_t *ihp) return 0; } +void msix_hwmask(struct pic *, int); +void msix_hwunmask(struct pic *, int); +void msix_addroute(struct pic *, struct cpu_info *, int, int, int); +void msix_delroute(struct pic *, struct cpu_info *, int, int, int); + +struct pic msix_pic = { + {0, {NULL}, NULL, 0, "msix", NULL, 0, 0}, + PIC_MSI, +#ifdef MULTIPROCESSOR + {}, +#endif + msix_hwmask, + msix_hwunmask, + msix_addroute, + msix_delroute, + NULL, + ioapic_edge_stubs +}; + +/* + * We pack the MSI-X vector number into the lower 8 bits of the PCI + * tag and use that as the MSI-X "PIC" pin number. This allows us to + * address 256 MSI-X vectors which ought to be enough for anybody. + */ +#define PCI_MSIX_VEC_MASK 0xff +#define PCI_MSIX_VEC(pin) ((pin) & PCI_MSIX_VEC_MASK) +#define PCI_MSIX_TAG(pin) ((pin) & ~PCI_MSIX_VEC_MASK) +#define PCI_MSIX_PIN(tag, vec) ((tag) | (vec)) + +void +msix_hwmask(struct pic *pic, int pin) +{ +} + +void +msix_hwunmask(struct pic *pic, int pin) +{ +} + +void +msix_addroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type) +{ + pci_chipset_tag_t pc = NULL; /* XXX */ + bus_space_tag_t memt = X86_BUS_SPACE_MEM; /* XXX */ + bus_space_handle_t memh; + bus_addr_t base; + pcitag_t tag = PCI_MSIX_TAG(pin); + int entry = PCI_MSIX_VEC(pin); + pcireg_t reg, addr, table; + uint32_t ctrl; + int bir, offset; + int off, tblsz; + + if (pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, ®) == 0) + panic("%s: no msix capability", __func__); + + addr = 0xfee00000UL | (ci->ci_apicid << 12); + + table = pci_conf_read(pc, tag, off + PCI_MSIX_TABLE); + bir = (table & PCI_MSIX_TABLE_BIR); + offset = (table & PCI_MSIX_TABLE_OFF); + tblsz = (reg & PCI_MSIX_MC_TBLSZ) + 1; + + bir = PCI_MAPREG_START + bir * 4; + if (pci_mem_find(pc, tag, bir, &base, NULL, NULL) || + _bus_space_map(memt, base + offset, tblsz * 16, 0, &memh)) + panic("%s: cannot map registers", __func__); + + bus_space_write_8(memt, memh, PCI_MSIX_MA(entry), addr); + bus_space_write_4(memt, memh, PCI_MSIX_MD(entry), vec); + bus_space_barrier(memt, memh, PCI_MSIX_MA(entry), 16, + BUS_SPACE_BARRIER_WRITE); + ctrl = bus_space_read_4(memt, memh, PCI_MSIX_VC(entry)); + bus_space_write_4(memt, memh, PCI_MSIX_VC(entry), + ctrl & ~PCI_MSIX_VC_MASK); + + _bus_space_unmap(memt, memh, tblsz * 16, NULL); + + pci_conf_write(pc, tag, off, reg | PCI_MSIX_MC_MSIXE); +} + +void +msix_delroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type) +{ + pci_chipset_tag_t pc = NULL; /* XXX */ + bus_space_tag_t memt = X86_BUS_SPACE_MEM; /* XXX */ + bus_space_handle_t memh; + bus_addr_t base; + pcitag_t tag = PCI_MSIX_TAG(pin); + int entry = PCI_MSIX_VEC(pin); + pcireg_t reg, table; + uint32_t ctrl; + int bir, offset; + int off, tblsz; + + if (pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, ®) == 0) + return; + + table = pci_conf_read(pc, tag, off + PCI_MSIX_TABLE); + bir = (table & PCI_MSIX_TABLE_BIR); + offset = (table & PCI_MSIX_TABLE_OFF); + tblsz = (reg & PCI_MSIX_MC_TBLSZ) + 1; + + bir = PCI_MAPREG_START + bir * 4; + if (pci_mem_find(pc, tag, bir, &base, NULL, NULL) || + _bus_space_map(memt, base + offset, tblsz * 16, 0, &memh)) + panic("%s: cannot map registers", __func__); + + ctrl = bus_space_read_4(memt, memh, PCI_MSIX_VC(entry)); + bus_space_write_4(memt, memh, PCI_MSIX_VC(entry), + ctrl | PCI_MSIX_VC_MASK); + + _bus_space_unmap(memt, memh, tblsz * 16, NULL); +} + +int +pci_intr_map_msix(struct pci_attach_args *pa, int vec, pci_intr_handle_t *ihp) +{ + pci_chipset_tag_t pc = pa->pa_pc; + pcitag_t tag = pa->pa_tag; + pcireg_t reg; + + KASSERT(PCI_MSIX_VEC(vec) == vec); + + if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || mp_busses == NULL || + pci_get_capability(pc, tag, PCI_CAP_MSIX, NULL, NULL) == 0) + return 1; + + if (vec > (reg & PCI_MSIX_MC_TBLSZ)) + return 1; + + ihp->tag = PCI_MSIX_PIN(tag, vec); + ihp->line = APIC_INT_VIA_MSGX; + ihp->pin = 0; + return 0; +} + int pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) { @@ -527,6 +664,8 @@ pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih) if (ih.line & APIC_INT_VIA_MSG) return ("msi"); + if (ih.line & APIC_INT_VIA_MSGX) + return ("msix"); #if NIOAPIC > 0 if (ih.line & APIC_INT_VIA_APIC) @@ -559,6 +698,10 @@ pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level, return intr_establish(-1, &msi_pic, tag, IST_PULSE, level, func, arg, what); } + if (ih.line & APIC_INT_VIA_MSGX) { + return intr_establish(-1, &msix_pic, tag, IST_PULSE, level, + func, arg, what); + } pci_decompose_tag(pc, ih.tag, &bus, &dev, NULL); #if NACPIPRT > 0 diff --git a/sys/arch/arm/include/pci_machdep.h b/sys/arch/arm/include/pci_machdep.h index 6686b5aa936..94517e8f20c 100644 --- a/sys/arch/arm/include/pci_machdep.h +++ b/sys/arch/arm/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.13 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.14 2016/05/04 14:30:00 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.2 2002/05/15 19:23:52 thorpej Exp $ */ /* @@ -93,6 +93,7 @@ struct arm32_pci_chipset { #define pci_intr_map(pa, ihp) \ (*(pa)->pa_pc->pc_intr_map)((pa), (ihp)) #define pci_intr_map_msi(pa, ihp) (-1) +#define pci_intr_map_msix(pa, vec, ihp) (-1) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) #define pci_intr_establish(c, ih, l, h, a, n) \ diff --git a/sys/arch/hppa/include/pci_machdep.h b/sys/arch/hppa/include/pci_machdep.h index 38ee309a419..7e3d77b6f87 100644 --- a/sys/arch/hppa/include/pci_machdep.h +++ b/sys/arch/hppa/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.11 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.12 2016/05/04 14:30:00 kettenis Exp $ */ /* * Copyright (c) 2003 Michael Shalayeff @@ -81,6 +81,7 @@ struct hppa_pci_chipset_tag { #define pci_intr_map(p, ihp) \ (*(p)->pa_pc->pc_intr_map)((p), (ihp)) #define pci_intr_map_msi(p, ihp) (-1) +#define pci_intr_map_msix(p, vec, ihp) (-1) #define pci_intr_line(c, ih) (ih) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->_cookie, (ih)) diff --git a/sys/arch/hppa64/include/pci_machdep.h b/sys/arch/hppa64/include/pci_machdep.h index 53aaf52bae8..78dea0654ac 100644 --- a/sys/arch/hppa64/include/pci_machdep.h +++ b/sys/arch/hppa64/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.11 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.12 2016/05/04 14:30:00 kettenis Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -72,6 +72,7 @@ struct hppa64_pci_chipset_tag { #define pci_intr_map(p, ihp) \ (*(p)->pa_pc->pc_intr_map)((p), (ihp)) #define pci_intr_map_msi(p, ihp) (-1) +#define pci_intr_map_msix(p, vec, ihp) (-1) #define pci_intr_line(c, ih) (ih) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->_cookie, (ih)) diff --git a/sys/arch/i386/pci/pci_machdep.h b/sys/arch/i386/pci/pci_machdep.h index dc89d98ab49..283147033ca 100644 --- a/sys/arch/i386/pci/pci_machdep.h +++ b/sys/arch/i386/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.27 2015/07/17 22:42:09 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.28 2016/05/04 14:30:00 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.7 1997/06/06 23:29:18 thorpej Exp $ */ /* @@ -99,6 +99,7 @@ void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, struct pci_attach_args; int pci_intr_map_msi(struct pci_attach_args *, pci_intr_handle_t *); int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *); +#define pci_intr_map_msix(p, vec, ihp) (-1) #define pci_intr_line(c, ih) ((ih).line) const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t); void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, diff --git a/sys/arch/landisk/include/pci_machdep.h b/sys/arch/landisk/include/pci_machdep.h index c142c26c8f7..6d24a51d979 100644 --- a/sys/arch/landisk/include/pci_machdep.h +++ b/sys/arch/landisk/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.9 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.10 2016/05/04 14:30:01 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.1 2006/09/01 21:26:18 uwe Exp $ */ /* @@ -76,6 +76,7 @@ void landisk_pci_conf_interrupt(void *v, int bus, int dev, int pin, #define pci_intr_map(pa, ihp) \ landisk_pci_intr_map(pa, ihp) #define pci_intr_map_msi(pa, ihp) (-1) +#define pci_intr_map_msix(pa, vec, ihp) (-1) #define pci_intr_string(v, ih) \ landisk_pci_intr_string(v, ih) #define pci_intr_establish(v, ih, level, ih_fun, ih_arg, ih_name) \ diff --git a/sys/arch/loongson/include/pci_machdep.h b/sys/arch/loongson/include/pci_machdep.h index 10b97a58e48..32f50c4e9de 100644 --- a/sys/arch/loongson/include/pci_machdep.h +++ b/sys/arch/loongson/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.9 2014/03/27 22:16:03 miod Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.10 2016/05/04 14:30:01 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -76,6 +76,7 @@ struct mips_pci_chipset { #define pci_intr_map(c, ihp) \ (*(c)->pa_pc->pc_intr_map)((c), (ihp)) #define pci_intr_map_msi(c, ihp) (-1) +#define pci_intr_map_msix(c, vec, ihp) (-1) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) #define pci_intr_establish(c, ih, l, h, a, nm) \ diff --git a/sys/arch/macppc/include/pci_machdep.h b/sys/arch/macppc/include/pci_machdep.h index 73c7cdbc162..51ff69bdbd1 100644 --- a/sys/arch/macppc/include/pci_machdep.h +++ b/sys/arch/macppc/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.2 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.3 2016/05/04 14:30:01 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.7 2001/07/20 00:07:14 eeh Exp $ */ /* @@ -85,6 +85,7 @@ pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int); void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *); int pci_intr_map_msi(struct pci_attach_args *, pci_intr_handle_t *); +#define pci_intr_map_msix(p, vec, ihp) (-1) int pci_intr_line(pci_chipset_tag_t, pci_intr_handle_t); const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t); void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, diff --git a/sys/arch/octeon/include/pci_machdep.h b/sys/arch/octeon/include/pci_machdep.h index b868e06b61d..0793512cd56 100644 --- a/sys/arch/octeon/include/pci_machdep.h +++ b/sys/arch/octeon/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.7 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.8 2016/05/04 14:30:01 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -104,6 +104,7 @@ static inline void pci_conf_write_db(void * c, pcitag_t t, int r, pcireg_t v, #define pci_intr_map(c, ihp) \ (*(c)->pa_pc->pc_intr_map)((c), (ihp)) #define pci_intr_map_msi(c, ihp) (-1) +#define pci_intr_map_msix(c, vec, ihp) (-1) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) #define pci_intr_establish(c, ih, l, h, a, nm) \ diff --git a/sys/arch/sgi/pci/pci_machdep.h b/sys/arch/sgi/pci/pci_machdep.h index bedc7b65fec..3c656596bb6 100644 --- a/sys/arch/sgi/pci/pci_machdep.h +++ b/sys/arch/sgi/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.16 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.17 2016/05/04 14:30:01 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -87,6 +87,7 @@ struct mips_pci_chipset { #define pci_intr_map(c, ihp) \ (*(c)->pa_pc->pc_intr_map)((c), (ihp)) #define pci_intr_map_msi(c, ihp) (-1) +#define pci_intr_map_msix(c, vec, ihp) (-1) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) #define pci_intr_establish(c, ih, l, h, a, nm) \ diff --git a/sys/arch/socppc/include/pci_machdep.h b/sys/arch/socppc/include/pci_machdep.h index 1871d23b1a1..0553eb73b6c 100644 --- a/sys/arch/socppc/include/pci_machdep.h +++ b/sys/arch/socppc/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.2 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.3 2016/05/04 14:30:01 kettenis Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -86,6 +86,7 @@ struct ppc_pci_chipset { (*((pa)->pa_pc)->pc_intr_map)((pa)->pa_pc->pc_intr_v, \ (pa)->pa_intrtag, (pa)->pa_intrpin, (pa)->pa_intrline, (ihp)) #define pci_intr_map_msi(pa, ihp) (-1) +#define pci_intr_map_msix(pa, vec, ihp) (-1) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) #define pci_intr_line(c, ih) \ diff --git a/sys/arch/sparc64/include/pci_machdep.h b/sys/arch/sparc64/include/pci_machdep.h index 032fca935f1..bd48fe9e075 100644 --- a/sys/arch/sparc64/include/pci_machdep.h +++ b/sys/arch/sparc64/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.32 2013/11/05 10:12:35 mpi Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.33 2016/05/04 14:30:01 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.7 2001/07/20 00:07:14 eeh Exp $ */ /* @@ -88,6 +88,7 @@ void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *); int pci_intr_map_msi(struct pci_attach_args *, pci_intr_handle_t *); +#define pci_intr_map_msix(pa, vec, ihp) (-1) int pci_intr_line(pci_chipset_tag_t, pci_intr_handle_t); const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t); void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h index 3f415bd2650..5278989eb8b 100644 --- a/sys/dev/pci/pcireg.h +++ b/sys/dev/pci/pcireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcireg.h,v 1.48 2015/06/02 15:26:19 mpi Exp $ */ +/* $OpenBSD: pcireg.h,v 1.49 2016/05/04 14:30:00 kettenis Exp $ */ /* $NetBSD: pcireg.h,v 1.26 2000/05/10 16:58:42 thorpej Exp $ */ /* @@ -594,6 +594,21 @@ typedef u_int8_t pci_revision_t; #define PCI_PCIE_LCAP2 0x2c /* + * Extended Message Signaled Interrups; access via capability pointer. + */ +#define PCI_MSIX_MC_MSIXE 0x80000000 +#define PCI_MSIX_MC_TBLSZ 0x000007ff +#define PCI_MSIX_TABLE 0x04 +#define PCI_MSIX_TABLE_BIR 0x00000007 +#define PCI_MSIX_TABLE_OFF ~(PCI_MSIX_TABLE_BIR) + +#define PCI_MSIX_MA(i) ((i) * 16 + 0) +#define PCI_MSIX_MAU32(i) ((i) * 16 + 0) +#define PCI_MSIX_MD(i) ((i) * 16 + 8) +#define PCI_MSIX_VC(i) ((i) * 16 + 12) +#define PCI_MSIX_VC_MASK 0x00000001 + +/* * Interrupt Configuration Register; contains interrupt pin and line. */ #define PCI_INTERRUPT_REG 0x3c |