[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#499501: xserver-xorg-core: does not detect video devices anymore (kfreebsd-amd64)



I found the cause, there have been change in GNU/kFreeBSD specific headers.
The identification (struct pcisel) have been extended by domain field in
FreeBSD 7.x series. There is a ABI compatibility layer - the reason why
2:1.4.2-1 works. With current interface, the io.pi_sel.pc_domain is not
initialized, it contains garbage, in the first iteration
it have been luckily zeroed -> some entries have been found.

In long term, it should properly handle domains, but in short term
(for current sid and our lenny snapshot) please, could you add
the patch bellow. It really does not affect any official release
architectures.

Why should domain be set to 0, as opposed to PCI_DOM_FROM_TAG(tag)?
(I don't really care either way, just trying to understand this.)

I tested xorg-server with suggested modification, it works for me too.

only in patch2:
unchanged:
--- xorg-server-1.4.2.orig/hw/xfree86/os-support/bus/freebsdPci.c
+++ xorg-server-1.4.2/hw/xfree86/os-support/bus/freebsdPci.c
@@ -133,6 +133,7 @@
 {
        struct pci_io io;
        int error;
+       io.pi_sel.pc_domain = PCI_DOM_FROM_TAG(tag);
        io.pi_sel.pc_bus = BUS(tag);
        io.pi_sel.pc_dev = DFN(tag) >> 3;
        io.pi_sel.pc_func = DFN(tag) & 7;
@@ -148,6 +149,7 @@
 freebsdPciCfgWrite(PCITAG tag, int off, CARD32 val)
 {
        struct pci_io io;
+       io.pi_sel.pc_domain = PCI_DOM_FROM_TAG(tag);
        io.pi_sel.pc_bus = BUS(tag);
        io.pi_sel.pc_dev = DFN(tag) >> 3;
        io.pi_sel.pc_func = DFN(tag) & 7;


It is important to have the "pc_domain" field initialized,
the "PCI_DOM_FROM_TAG(tag)" seems be better compared to plain "0".

Please could you apply your fix. Many thanks.


FWIW, libpciaccess is used in newer versions of X for this, and has:
#if __FreeBSD_version >= 700053
#define DOMAIN_SUPPORT 1
#else
#define DOMAIN_SUPPORT 0
#endif

and then sets io.pi_sel.pc_domain if DOMAIN_SUPPORT is non-zero.

IMHO, it is a wrong way of testing. It should be changed as follows.
Should I file a separate bug report against libpciaccess ?

only in patch2:
unchanged:
--- libpciaccess-0.10.3.orig/configure.ac
+++ libpciaccess-0.10.3/configure.ac
@@ -97,6 +97,14 @@
     AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
 fi

+dnl check for the pci_io.pi_sel.pc_domain
+AC_CHECK_MEMBER([struct pci_io.pi_sel.pc_domain],
+               [AC_DEFINE(HAVE_PCI_IO_PC_DOMAIN,1,[Have the pci_io.pi_sel.pc_domain member.])],
+               [],
+               [ #include <sys/types.h>
+                 #include <sys/pciio.h>
+               ])
+
 AC_SUBST(PCIACCESS_CFLAGS)
 AC_SUBST(PCIACCESS_LIBS)

only in patch2:
unchanged:
--- libpciaccess-0.10.3.orig/src/freebsd_pci.c
+++ libpciaccess-0.10.3/src/freebsd_pci.c
@@ -43,7 +43,7 @@
 #include <sys/mman.h>
 #include <sys/memrange.h>

-#if __FreeBSD_version >= 700053
+#if HAVE_PCI_IO_PC_DOMAIN
 #define DOMAIN_SUPPORT 1
 #else
 #define DOMAIN_SUPPORT 0



Petr




Reply to: