Module Name: src Committed By: snj Date: Sat Oct 3 23:56:43 UTC 2009
Modified Files: src/sys/arch/xen/xen [netbsd-5]: pciback.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1054): sys/arch/xen/xen/pciback.c: revision 1.2 - xentools also use pci vendor/product id and subsystem id; export them via the kernfs file - EVTCHNOP_bind_pirq wants the legacy IRQ number; so always set the legacy IRQ number in the PCI_INTERRUPT_REG. To generate a diff of this commit: cvs rdiff -u -r1.4.6.2 -r1.4.6.3 src/sys/arch/xen/xen/pciback.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/xen/xen/pciback.c diff -u src/sys/arch/xen/xen/pciback.c:1.4.6.2 src/sys/arch/xen/xen/pciback.c:1.4.6.3 --- src/sys/arch/xen/xen/pciback.c:1.4.6.2 Sat Oct 3 23:54:05 2009 +++ src/sys/arch/xen/xen/pciback.c Sat Oct 3 23:56:43 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pciback.c,v 1.4.6.2 2009/10/03 23:54:05 snj Exp $ */ +/* $NetBSD: pciback.c,v 1.4.6.3 2009/10/03 23:56:43 snj Exp $ */ /* * Copyright (c) 2009 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.4.6.2 2009/10/03 23:54:05 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.4.6.3 2009/10/03 23:56:43 snj Exp $"); #include "opt_xen.h" #include "rnd.h" @@ -105,6 +105,8 @@ } sc_bars[PCI_NBARS]; pci_intr_handle_t sc_intrhandle; int sc_irq; + pcireg_t sc_id; + pcireg_t sc_subid; char sc_kernfsname[16]; }; @@ -187,7 +189,7 @@ SLIST_ENTRY(pb_xenbus_instance) pbx_next; /* list of backend instances*/ struct xenbus_device *pbx_xbusd; domid_t pbx_domid; - struct pciback_pci_devlist pbx_pb_pci_dev; /* list of exported PCi devices */ + struct pciback_pci_devlist pbx_pb_pci_dev; /* list of exported PCI devices */ /* communication with the domU */ unsigned int pbx_evtchn; /* our even channel */ struct xen_pci_sharedinfo *pbx_sh_info; @@ -237,6 +239,9 @@ sc->sc_pb->pb_pc = pa->pa_pc; sc->sc_pb->pb_tag = pa->pa_tag; + sc->sc_id = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_ID_REG); + sc->sc_subid = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG); + for (i = 0; i < PCI_NBARS;) { sc->sc_bars[i].b_type = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START + i * 4); @@ -267,11 +272,7 @@ aprint_normal_dev(self, "interrupting at %s\n", intrstr ? intrstr : "unknown interrupt"); } - if (sc->sc_intrhandle.pirq & APIC_INT_VIA_APIC) { - sc->sc_irq = APIC_IRQ_PIN(sc->sc_intrhandle.pirq); - } else { - sc->sc_irq = APIC_IRQ_LEGACY_IRQ(sc->sc_intrhandle.pirq); - } + sc->sc_irq = APIC_IRQ_LEGACY_IRQ(sc->sc_intrhandle.pirq); /* XXX should be done elsewhere ? */ reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_INTERRUPT_REG); reg &= ~ (PCI_INTERRUPT_LINE_MASK << PCI_INTERRUPT_LINE_SHIFT); @@ -314,6 +315,12 @@ off = uio->uio_offset; len = 0; + len += snprintf(&buf[len], PCIBACK_KERNFS_SIZE - len, + "vendor: 0x%04x\nproduct: 0x%04x\n", + PCI_VENDOR(sc->sc_id), PCI_PRODUCT(sc->sc_id)); + len += snprintf(&buf[len], PCIBACK_KERNFS_SIZE - len, + "subsys_vendor: 0x%04x\nsubsys_product: 0x%04x\n", + PCI_VENDOR(sc->sc_subid), PCI_PRODUCT(sc->sc_subid)); for(i = 0; i < PCI_NBARS; i++) { if (sc->sc_bars[i].b_valid) { len += snprintf(&buf[len], PCIBACK_KERNFS_SIZE - len, @@ -776,6 +783,7 @@ op->err = XEN_PCI_ERR_invalid_offset; break; } + break; default: aprint_error("pciback: unknown cmd %d\n", op->cmd); op->err = XEN_PCI_ERR_not_implemented;