xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2012 Red Hat.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Author: Dave Airlie <airlied@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file contains the interfaces to the bus-specific code
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_XORG_CONFIG_H
|
|
|
|
#include <xorg-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XSERVER_PLATFORM_BUS
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include <pciaccess.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "os.h"
|
|
|
|
#include "hotplug.h"
|
2014-03-03 16:58:54 +01:00
|
|
|
#include "systemd-logind.h"
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
2016-12-12 17:03:17 +01:00
|
|
|
#include "loaderProcs.h"
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
#include "xf86.h"
|
|
|
|
#include "xf86_OSproc.h"
|
|
|
|
#include "xf86Priv.h"
|
|
|
|
#include "xf86str.h"
|
|
|
|
#include "xf86Bus.h"
|
|
|
|
#include "Pci.h"
|
|
|
|
#include "xf86platformBus.h"
|
2014-02-13 13:54:23 +01:00
|
|
|
#include "xf86Config.h"
|
2012-08-17 01:49:24 +02:00
|
|
|
#include "xf86Crtc.h"
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
2013-01-09 05:26:35 +01:00
|
|
|
#include "randrstr.h"
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
int platformSlotClaimed;
|
|
|
|
|
|
|
|
int xf86_num_platform_devices;
|
|
|
|
|
2014-01-07 12:15:12 +01:00
|
|
|
struct xf86_platform_device *xf86_platform_devices;
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
|
|
|
int
|
2014-02-02 13:54:33 +01:00
|
|
|
xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned)
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
{
|
2015-03-22 01:12:06 +01:00
|
|
|
xf86_platform_devices = xnfreallocarray(xf86_platform_devices,
|
|
|
|
xf86_num_platform_devices + 1,
|
|
|
|
sizeof(struct xf86_platform_device));
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
|
|
|
xf86_platform_devices[xf86_num_platform_devices].attribs = attribs;
|
|
|
|
xf86_platform_devices[xf86_num_platform_devices].pdev = NULL;
|
2014-02-02 13:54:33 +01:00
|
|
|
xf86_platform_devices[xf86_num_platform_devices].flags =
|
|
|
|
unowned ? XF86_PDEV_UNOWNED : 0;
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
|
|
|
xf86_num_platform_devices++;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
xf86_remove_platform_device(int dev_index)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
|
2014-07-16 02:31:58 +02:00
|
|
|
config_odev_free_attributes(xf86_platform_devices[dev_index].attribs);
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
|
|
|
for (j = dev_index; j < xf86_num_platform_devices - 1; j++)
|
|
|
|
memcpy(&xf86_platform_devices[j], &xf86_platform_devices[j + 1], sizeof(struct xf86_platform_device));
|
|
|
|
xf86_num_platform_devices--;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-04-10 08:32:15 +02:00
|
|
|
Bool
|
|
|
|
xf86_get_platform_device_unowned(int index)
|
|
|
|
{
|
2014-02-02 13:54:33 +01:00
|
|
|
return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ?
|
|
|
|
TRUE : FALSE;
|
2013-04-10 08:32:15 +02:00
|
|
|
}
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
2014-01-13 12:03:46 +01:00
|
|
|
struct xf86_platform_device *
|
|
|
|
xf86_find_platform_device_by_devnum(int major, int minor)
|
|
|
|
{
|
|
|
|
int i, attr_major, attr_minor;
|
|
|
|
|
|
|
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
2014-07-16 02:31:58 +02:00
|
|
|
attr_major = xf86_platform_odev_attributes(i)->major;
|
|
|
|
attr_minor = xf86_platform_odev_attributes(i)->minor;
|
2014-01-13 12:03:46 +01:00
|
|
|
if (attr_major == major && attr_minor == minor)
|
|
|
|
return &xf86_platform_devices[i];
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
/*
|
|
|
|
* xf86IsPrimaryPlatform() -- return TRUE if primary device
|
|
|
|
* is a platform device and it matches this one.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
xf86IsPrimaryPlatform(struct xf86_platform_device *plat)
|
|
|
|
{
|
2016-09-30 12:29:09 +02:00
|
|
|
/* Add max. 1 screen for the IgnorePrimary fallback path */
|
|
|
|
if (xf86ProbeIgnorePrimary && xf86NumScreens == 0)
|
|
|
|
return TRUE;
|
|
|
|
|
xfree86: recognize primary BUS_PCI device in xf86IsPrimaryPlatform()
The new platform bus code and the old PCI bus code overlap. Platform bus
can handle any type of device, including PCI devices, whereas the PCI code
can only handle PCI devices. Some drivers only support the old style
PCI-probe methods, but the primary device detection code is server based,
not driver based; so we might end up with a primary device which only has
a PCI bus-capable driver, but was detected as primary by the platform
code, or the other way around.
(The above paragraph was shamelessly stolen from Hans de Goede, and
customized.)
The latter case applies to QEMU's virtio-gpu-pci device: it is detected as
a BUS_PCI primary device, but we actually probe it first (with the
modesetting driver) through xf86platformProbeDev(). The
xf86IsPrimaryPlatform() function doesn't recognize the device as primary
(it bails out as soon as it sees BUS_PCI); instead, we add the device as a
secondary graphics card under "autoAddGPU". In turn, the success of this
automatic probing-as-GPU prevents xf86CallDriverProbe() from proceeding to
the PCI probing.
The result is that the server exits with no primary devices detected.
Commit cf66471353ac ("xfree86: use udev to provide device enumeration for
kms devices (v10)") added "cross-bus" matching to xf86IsPrimaryPci(). Port
that now to xf86IsPrimaryPlatform(), so that we can probe virtio-gpu-pci
as a primary card in platform bus code.
Cc: Adam Jackson <ajax@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Keith Packard <keithp@keithp.com>
Cc: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-By: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-07 15:08:06 +02:00
|
|
|
if (primaryBus.type == BUS_PLATFORM)
|
|
|
|
return plat == primaryBus.id.plat;
|
|
|
|
#ifdef XSERVER_LIBPCIACCESS
|
|
|
|
if (primaryBus.type == BUS_PCI)
|
|
|
|
if (plat->pdev)
|
|
|
|
if (MATCH_PCI_DEVICES(primaryBus.id.pci, plat->pdev))
|
|
|
|
return TRUE;
|
|
|
|
#endif
|
|
|
|
return FALSE;
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
platform_find_pci_info(struct xf86_platform_device *pd, char *busid)
|
|
|
|
{
|
|
|
|
struct pci_slot_match devmatch;
|
|
|
|
struct pci_device *info;
|
|
|
|
struct pci_device_iterator *iter;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = sscanf(busid, "pci:%04x:%02x:%02x.%u",
|
|
|
|
&devmatch.domain, &devmatch.bus, &devmatch.dev,
|
|
|
|
&devmatch.func);
|
|
|
|
if (ret != 4)
|
|
|
|
return;
|
|
|
|
|
|
|
|
iter = pci_slot_match_iterator_create(&devmatch);
|
|
|
|
info = pci_device_next(iter);
|
2016-12-12 17:03:15 +01:00
|
|
|
if (info)
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
pd->pdev = info;
|
|
|
|
pci_iterator_destroy(iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
xf86_check_platform_slot(const struct xf86_platform_device *pd)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < xf86NumEntities; i++) {
|
|
|
|
const EntityPtr u = xf86Entities[i];
|
|
|
|
|
2014-12-30 18:13:15 +01:00
|
|
|
if (pd->pdev && u->bus.type == BUS_PCI &&
|
|
|
|
MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci)) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-02-13 13:54:23 +01:00
|
|
|
static Bool
|
|
|
|
MatchToken(const char *value, struct xorg_list *patterns,
|
|
|
|
int (*compare)(const char *, const char *))
|
|
|
|
{
|
|
|
|
const xf86MatchGroup *group;
|
|
|
|
|
|
|
|
/* If there are no patterns, accept the match */
|
|
|
|
if (xorg_list_is_empty(patterns))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* If there are patterns but no attribute, reject the match */
|
|
|
|
if (!value)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Otherwise, iterate the list of patterns ensuring each entry has a
|
|
|
|
* match. Each list entry is a separate Match line of the same type.
|
|
|
|
*/
|
|
|
|
xorg_list_for_each_entry(group, patterns, entry) {
|
|
|
|
Bool match = FALSE;
|
|
|
|
char *const *cur;
|
|
|
|
|
|
|
|
for (cur = group->values; *cur; cur++) {
|
|
|
|
if ((*compare)(value, *cur) == 0) {
|
|
|
|
match = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!match)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All the entries in the list matched the attribute */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2016-12-12 17:03:13 +01:00
|
|
|
OutputClassMatches(const XF86ConfOutputClassPtr oclass,
|
|
|
|
struct xf86_platform_device *dev)
|
2014-02-13 13:54:23 +01:00
|
|
|
{
|
2016-12-12 17:03:13 +01:00
|
|
|
char *driver = dev->attribs->driver;
|
2014-02-13 13:54:23 +01:00
|
|
|
|
|
|
|
if (!MatchToken(driver, &oclass->match_driver, strcmp))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-07-23 01:42:07 +02:00
|
|
|
static void
|
|
|
|
xf86OutputClassDriverList(int index, XF86MatchedDrivers *md)
|
2014-02-13 13:54:23 +01:00
|
|
|
{
|
|
|
|
XF86ConfOutputClassPtr cl;
|
|
|
|
|
|
|
|
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
|
2016-12-12 17:03:13 +01:00
|
|
|
if (OutputClassMatches(cl, &xf86_platform_devices[index])) {
|
2014-07-16 02:31:58 +02:00
|
|
|
char *path = xf86_platform_odev_attributes(index)->path;
|
2014-02-13 13:54:23 +01:00
|
|
|
|
|
|
|
xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
|
|
|
|
cl->identifier, path);
|
|
|
|
xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver);
|
|
|
|
|
2015-07-23 01:42:07 +02:00
|
|
|
xf86AddMatchedDriver(md, cl->driver);
|
2014-02-13 13:54:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
/**
|
|
|
|
* @return The numbers of found devices that match with the current system
|
|
|
|
* drivers.
|
|
|
|
*/
|
2015-07-23 01:42:07 +02:00
|
|
|
void
|
|
|
|
xf86PlatformMatchDriver(XF86MatchedDrivers *md)
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
{
|
2015-07-23 01:42:07 +02:00
|
|
|
int i;
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
struct pci_device *info = NULL;
|
|
|
|
int pass = 0;
|
|
|
|
|
|
|
|
for (pass = 0; pass < 2; pass++) {
|
|
|
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
|
|
|
|
|
|
|
if (xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 1))
|
|
|
|
continue;
|
|
|
|
else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0))
|
|
|
|
continue;
|
|
|
|
|
2015-07-23 01:42:07 +02:00
|
|
|
xf86OutputClassDriverList(i, md);
|
2014-02-13 13:54:23 +01:00
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
info = xf86_platform_devices[i].pdev;
|
|
|
|
#ifdef __linux__
|
|
|
|
if (info)
|
2015-07-23 01:42:07 +02:00
|
|
|
xf86MatchDriverFromFiles(info->vendor_id, info->device_id, md);
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
#endif
|
|
|
|
|
2015-07-23 01:42:07 +02:00
|
|
|
if (info != NULL) {
|
|
|
|
xf86VideoPtrToDriverList(info, md);
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
xf86platformProbe(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Bool pci = TRUE;
|
2018-02-05 06:17:52 +01:00
|
|
|
XF86ConfOutputClassPtr cl, cl_head = (xf86configptr) ?
|
|
|
|
xf86configptr->conf_outputclass_lst : NULL;
|
2016-12-12 17:03:17 +01:00
|
|
|
char *old_path, *path = NULL;
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
2012-09-10 06:48:37 +02:00
|
|
|
config_odev_probe(xf86PlatformDeviceProbe);
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
if (!xf86scanpci()) {
|
|
|
|
pci = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
2014-07-16 02:31:58 +02:00
|
|
|
char *busid = xf86_platform_odev_attributes(i)->busid;
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
2018-10-27 02:47:30 +02:00
|
|
|
if (pci && busid && (strncmp(busid, "pci:", 4) == 0)) {
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
platform_find_pci_info(&xf86_platform_devices[i], busid);
|
|
|
|
}
|
2016-12-12 17:03:17 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Deal with OutputClass ModulePath directives, these must be
|
|
|
|
* processed before we do any module loading.
|
|
|
|
*/
|
2018-02-05 06:17:52 +01:00
|
|
|
for (cl = cl_head; cl; cl = cl->list.next) {
|
2016-12-12 17:03:17 +01:00
|
|
|
if (!OutputClassMatches(cl, &xf86_platform_devices[i]))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (cl->modulepath && xf86ModPathFrom != X_CMDLINE) {
|
|
|
|
old_path = path;
|
|
|
|
XNFasprintf(&path, "%s,%s", cl->modulepath,
|
|
|
|
path ? path : xf86ModulePath);
|
|
|
|
free(old_path);
|
|
|
|
xf86Msg(X_CONFIG, "OutputClass \"%s\" ModulePath extended to \"%s\"\n",
|
|
|
|
cl->identifier, path);
|
|
|
|
LoaderSetPath(path);
|
|
|
|
}
|
|
|
|
}
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
}
|
2016-12-12 17:03:15 +01:00
|
|
|
|
2016-12-12 17:03:17 +01:00
|
|
|
free(path);
|
|
|
|
|
2016-12-12 17:03:16 +01:00
|
|
|
/* First see if there is an OutputClass match marking a device as primary */
|
|
|
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
|
|
|
struct xf86_platform_device *dev = &xf86_platform_devices[i];
|
2018-02-05 06:17:52 +01:00
|
|
|
for (cl = cl_head; cl; cl = cl->list.next) {
|
2016-12-12 17:03:16 +01:00
|
|
|
if (!OutputClassMatches(cl, dev))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (xf86CheckBoolOption(cl->option_lst, "PrimaryGPU", FALSE)) {
|
|
|
|
xf86Msg(X_CONFIG, "OutputClass \"%s\" setting %s as PrimaryGPU\n",
|
|
|
|
cl->identifier, dev->attribs->path);
|
|
|
|
primaryBus.type = BUS_PLATFORM;
|
|
|
|
primaryBus.id.plat = dev;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Then check for pci_device_is_boot_vga() */
|
2016-12-12 17:03:15 +01:00
|
|
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
|
|
|
struct xf86_platform_device *dev = &xf86_platform_devices[i];
|
|
|
|
|
|
|
|
if (!dev->pdev)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
pci_device_probe(dev->pdev);
|
|
|
|
if (pci_device_is_boot_vga(dev->pdev)) {
|
|
|
|
primaryBus.type = BUS_PLATFORM;
|
|
|
|
primaryBus.id.plat = dev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-12-12 17:03:14 +01:00
|
|
|
void
|
|
|
|
xf86MergeOutputClassOptions(int entityIndex, void **options)
|
|
|
|
{
|
|
|
|
const EntityPtr entity = xf86Entities[entityIndex];
|
|
|
|
struct xf86_platform_device *dev = NULL;
|
|
|
|
XF86ConfOutputClassPtr cl;
|
|
|
|
XF86OptionPtr classopts;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
switch (entity->bus.type) {
|
|
|
|
case BUS_PLATFORM:
|
|
|
|
dev = entity->bus.id.plat;
|
|
|
|
break;
|
|
|
|
case BUS_PCI:
|
|
|
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
|
|
|
if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
|
|
|
|
entity->bus.id.pci)) {
|
|
|
|
dev = &xf86_platform_devices[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
xf86Msg(X_DEBUG, "xf86MergeOutputClassOptions unsupported bus type %d\n",
|
|
|
|
entity->bus.type);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!dev)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
|
|
|
|
if (!OutputClassMatches(cl, dev) || !cl->option_lst)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
xf86Msg(X_INFO, "Applying OutputClass \"%s\" options to %s\n",
|
|
|
|
cl->identifier, dev->attribs->path);
|
|
|
|
|
|
|
|
classopts = xf86optionListDup(cl->option_lst);
|
|
|
|
*options = xf86optionListMerge(*options, classopts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
static int
|
|
|
|
xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp,
|
|
|
|
int chipset, GDevPtr dev, Bool active)
|
|
|
|
{
|
|
|
|
EntityPtr p = NULL;
|
|
|
|
int num;
|
|
|
|
|
|
|
|
if (xf86_check_platform_slot(d)) {
|
|
|
|
num = xf86AllocateEntity();
|
|
|
|
p = xf86Entities[num];
|
|
|
|
p->driver = drvp;
|
|
|
|
p->chipset = chipset;
|
|
|
|
p->bus.type = BUS_PLATFORM;
|
|
|
|
p->bus.id.plat = d;
|
|
|
|
p->active = active;
|
|
|
|
p->inUse = FALSE;
|
|
|
|
if (dev)
|
|
|
|
xf86AddDevToEntity(num, dev);
|
|
|
|
|
|
|
|
platformSlotClaimed++;
|
|
|
|
return num;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86UnclaimPlatformSlot(struct xf86_platform_device *d, GDevPtr dev)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < xf86NumEntities; i++) {
|
|
|
|
const EntityPtr p = xf86Entities[i];
|
|
|
|
|
|
|
|
if ((p->bus.type == BUS_PLATFORM) && (p->bus.id.plat == d)) {
|
|
|
|
if (dev)
|
|
|
|
xf86RemoveDevFromEntity(i, dev);
|
|
|
|
platformSlotClaimed--;
|
|
|
|
p->bus.type = BUS_NONE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define END_OF_MATCHES(m) \
|
|
|
|
(((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0))
|
|
|
|
|
|
|
|
static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
|
|
|
|
GDevPtr gdev, int flags, intptr_t match_data)
|
|
|
|
{
|
|
|
|
Bool foundScreen = FALSE;
|
2014-07-18 20:19:01 +02:00
|
|
|
int entity;
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
2014-03-03 16:07:16 +01:00
|
|
|
if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev))
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
entity = xf86ClaimPlatformSlot(dev, drvp, 0,
|
2014-03-03 16:07:16 +01:00
|
|
|
gdev, gdev ? gdev->active : 0);
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
|
2014-03-03 16:07:16 +01:00
|
|
|
if ((entity == -1) && gdev && (gdev->screen > 0)) {
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
unsigned nent;
|
|
|
|
|
|
|
|
for (nent = 0; nent < xf86NumEntities; nent++) {
|
|
|
|
EntityPtr pEnt = xf86Entities[nent];
|
|
|
|
|
|
|
|
if (pEnt->bus.type != BUS_PLATFORM)
|
|
|
|
continue;
|
|
|
|
if (pEnt->bus.id.plat == dev) {
|
|
|
|
entity = nent;
|
|
|
|
xf86AddDevToEntity(nent, gdev);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (entity != -1) {
|
2014-03-03 16:58:54 +01:00
|
|
|
if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc ||
|
|
|
|
!drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) {
|
2014-07-18 20:19:01 +02:00
|
|
|
systemd_logind_release_fd(dev->attribs->major, dev->attribs->minor, dev->attribs->fd);
|
2014-07-16 02:31:58 +02:00
|
|
|
dev->attribs->fd = -1;
|
2014-03-03 16:58:54 +01:00
|
|
|
dev->flags &= ~XF86_PDEV_SERVER_FD;
|
|
|
|
}
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
if (drvp->platformProbe(drvp, entity, flags, dev, match_data))
|
|
|
|
foundScreen = TRUE;
|
|
|
|
else
|
|
|
|
xf86UnclaimPlatformSlot(dev, gdev);
|
|
|
|
}
|
|
|
|
return foundScreen;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
probeSingleDevice(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev, int flags)
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
Bool foundScreen = FALSE;
|
|
|
|
struct pci_device *pPci;
|
|
|
|
const struct pci_id_match *const devices = drvp->supported_devices;
|
|
|
|
|
|
|
|
if (dev->pdev && devices) {
|
|
|
|
int device_id = dev->pdev->device_id;
|
|
|
|
pPci = dev->pdev;
|
|
|
|
for (k = 0; !END_OF_MATCHES(devices[k]); k++) {
|
|
|
|
if (PCI_ID_COMPARE(devices[k].vendor_id, pPci->vendor_id)
|
|
|
|
&& PCI_ID_COMPARE(devices[k].device_id, device_id)
|
|
|
|
&& ((devices[k].device_class_mask & pPci->device_class)
|
|
|
|
== devices[k].device_class)) {
|
|
|
|
foundScreen = doPlatformProbe(dev, drvp, gdev, flags, devices[k].match_data);
|
|
|
|
if (foundScreen)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (dev->pdev && !devices)
|
|
|
|
return FALSE;
|
|
|
|
else
|
|
|
|
foundScreen = doPlatformProbe(dev, drvp, gdev, flags, 0);
|
|
|
|
return foundScreen;
|
|
|
|
}
|
|
|
|
|
2016-09-08 15:24:58 +02:00
|
|
|
static Bool
|
|
|
|
isGPUDevice(GDevPtr gdev)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < gdev->myScreenSection->num_gpu_devices; i++) {
|
|
|
|
if (gdev == gdev->myScreenSection->gpu_devices[i])
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
int
|
|
|
|
xf86platformProbeDev(DriverPtr drvp)
|
|
|
|
{
|
|
|
|
Bool foundScreen = FALSE;
|
|
|
|
GDevPtr *devList;
|
|
|
|
const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList);
|
|
|
|
int i, j;
|
|
|
|
|
2020-07-05 22:07:33 +02:00
|
|
|
/* find the main device or any device specified in xorg.conf */
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
for (i = 0; i < numDevs; i++) {
|
Fix modesetting device matching through kmsdev device path
xf86platformProbeDev didn't check the device path, fix it.
This is a problem when trying to set up a non-PCI device via
explicit xorg.conf.d configuration.
An USB DisplayLink device, being non-PCI was always set up
as a GPU device assigned to screen 0 instead of a regular
framebuffer, potentially having its own dedicated screen,
despite such configuration as below. Only the relevant parts
of the configuration are quoted, it's part of a larger context
with an Intel chip that has 3 outputs:
* DP1 connected to an LCD panel,
* VGA1 connected to an external monitor,
* HDMI1 unconnected and having no user visible connector
Section "ServerFlags"
Option "AutoBindGPU" "false"
EndSection
...
Section "Device"
Identifier "Intel2"
Driver "intel"
BusID "PCI:0:2:0"
Screen 2
Option "Monitor-HDMI1" "HDMI1"
Option "ZaphodHeads" "HDMI1"
EndSection
Section "Device"
Identifier "UDL"
Driver "modesetting"
Option "kmsdev" "/dev/dri/card0"
#BusID "usb:0:1.2:1.0"
Option "Monitor-DVI-I-1" "DVI-I-1"
Option "ShadowFB" "on"
Option "DoubleShadow" "on"
EndSection
...
Section "Screen"
Identifier "SCREEN2"
Option "AutoServerLayout" "on"
Device "UDL"
GPUDevice "Intel2"
Monitor "Monitor-DVI-I-1"
SubSection "Display"
Modes "1024x768"
Depth 24
EndSubSection
EndSection
Section "ServerLayout"
Identifier "LAYOUT"
Option "AutoServerLayout" "on"
Screen 0 "SCREEN"
Screen 1 "SCREEN1" RightOf "SCREEN"
Screen 2 "SCREEN2" RightOf "SCREEN1"
EndSection
On the particular machine I was trying to set up an UDL device,
I found the following structure was being used to match
the device to a platform device while I was debugging the issue:
xf86_platform_devices[0] == Intel, /dev/dri/card1, primary platform device
xf86_platform_devices[1] == UDL, /dev/dri/card0
devList[0] == "Intel0", ZaphodHeads: DP1
devList[1] == "Intel1", ZaphodHeads: VGA1
devList[2] == "UDL"
devList[3] == "Intel2", ZaphodHeads: HDMI1 (intended GPU device to UDL)
When xf86platformProbeDev() matched the UDL device, the BusID
check failed in both cases of:
* BusID "usb:0:1.2:1.0" was specified
* Option "kmsdev" "/dev/dri/card0" was specified
As a result, xf86platformProbeDev() went on to call probeSingleDevice()
with xf86_platform_devices[0] and devList[2], resulting in the
UDL device being set up as a GPU device assigned to the first screen
instead of as a framebuffer on the third screen as the configuration
specified.
Checking Option "kmsdev" in code code may be a layering violation.
But the modesetting driver is actually part of the Xorg sources
instead of being an external driver, so he "kmsdev" path knowledge
may be used here.
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2020-02-12 22:29:52 +01:00
|
|
|
const char *devpath;
|
|
|
|
|
2014-12-30 18:13:16 +01:00
|
|
|
/* skip inactive devices */
|
|
|
|
if (!devList[i]->active)
|
|
|
|
continue;
|
|
|
|
|
Fix modesetting device matching through kmsdev device path
xf86platformProbeDev didn't check the device path, fix it.
This is a problem when trying to set up a non-PCI device via
explicit xorg.conf.d configuration.
An USB DisplayLink device, being non-PCI was always set up
as a GPU device assigned to screen 0 instead of a regular
framebuffer, potentially having its own dedicated screen,
despite such configuration as below. Only the relevant parts
of the configuration are quoted, it's part of a larger context
with an Intel chip that has 3 outputs:
* DP1 connected to an LCD panel,
* VGA1 connected to an external monitor,
* HDMI1 unconnected and having no user visible connector
Section "ServerFlags"
Option "AutoBindGPU" "false"
EndSection
...
Section "Device"
Identifier "Intel2"
Driver "intel"
BusID "PCI:0:2:0"
Screen 2
Option "Monitor-HDMI1" "HDMI1"
Option "ZaphodHeads" "HDMI1"
EndSection
Section "Device"
Identifier "UDL"
Driver "modesetting"
Option "kmsdev" "/dev/dri/card0"
#BusID "usb:0:1.2:1.0"
Option "Monitor-DVI-I-1" "DVI-I-1"
Option "ShadowFB" "on"
Option "DoubleShadow" "on"
EndSection
...
Section "Screen"
Identifier "SCREEN2"
Option "AutoServerLayout" "on"
Device "UDL"
GPUDevice "Intel2"
Monitor "Monitor-DVI-I-1"
SubSection "Display"
Modes "1024x768"
Depth 24
EndSubSection
EndSection
Section "ServerLayout"
Identifier "LAYOUT"
Option "AutoServerLayout" "on"
Screen 0 "SCREEN"
Screen 1 "SCREEN1" RightOf "SCREEN"
Screen 2 "SCREEN2" RightOf "SCREEN1"
EndSection
On the particular machine I was trying to set up an UDL device,
I found the following structure was being used to match
the device to a platform device while I was debugging the issue:
xf86_platform_devices[0] == Intel, /dev/dri/card1, primary platform device
xf86_platform_devices[1] == UDL, /dev/dri/card0
devList[0] == "Intel0", ZaphodHeads: DP1
devList[1] == "Intel1", ZaphodHeads: VGA1
devList[2] == "UDL"
devList[3] == "Intel2", ZaphodHeads: HDMI1 (intended GPU device to UDL)
When xf86platformProbeDev() matched the UDL device, the BusID
check failed in both cases of:
* BusID "usb:0:1.2:1.0" was specified
* Option "kmsdev" "/dev/dri/card0" was specified
As a result, xf86platformProbeDev() went on to call probeSingleDevice()
with xf86_platform_devices[0] and devList[2], resulting in the
UDL device being set up as a GPU device assigned to the first screen
instead of as a framebuffer on the third screen as the configuration
specified.
Checking Option "kmsdev" in code code may be a layering violation.
But the modesetting driver is actually part of the Xorg sources
instead of being an external driver, so he "kmsdev" path knowledge
may be used here.
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2020-02-12 22:29:52 +01:00
|
|
|
/* This is specific to modesetting. */
|
|
|
|
devpath = xf86FindOptionValue(devList[i]->options, "kmsdev");
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
for (j = 0; j < xf86_num_platform_devices; j++) {
|
Fix modesetting device matching through kmsdev device path
xf86platformProbeDev didn't check the device path, fix it.
This is a problem when trying to set up a non-PCI device via
explicit xorg.conf.d configuration.
An USB DisplayLink device, being non-PCI was always set up
as a GPU device assigned to screen 0 instead of a regular
framebuffer, potentially having its own dedicated screen,
despite such configuration as below. Only the relevant parts
of the configuration are quoted, it's part of a larger context
with an Intel chip that has 3 outputs:
* DP1 connected to an LCD panel,
* VGA1 connected to an external monitor,
* HDMI1 unconnected and having no user visible connector
Section "ServerFlags"
Option "AutoBindGPU" "false"
EndSection
...
Section "Device"
Identifier "Intel2"
Driver "intel"
BusID "PCI:0:2:0"
Screen 2
Option "Monitor-HDMI1" "HDMI1"
Option "ZaphodHeads" "HDMI1"
EndSection
Section "Device"
Identifier "UDL"
Driver "modesetting"
Option "kmsdev" "/dev/dri/card0"
#BusID "usb:0:1.2:1.0"
Option "Monitor-DVI-I-1" "DVI-I-1"
Option "ShadowFB" "on"
Option "DoubleShadow" "on"
EndSection
...
Section "Screen"
Identifier "SCREEN2"
Option "AutoServerLayout" "on"
Device "UDL"
GPUDevice "Intel2"
Monitor "Monitor-DVI-I-1"
SubSection "Display"
Modes "1024x768"
Depth 24
EndSubSection
EndSection
Section "ServerLayout"
Identifier "LAYOUT"
Option "AutoServerLayout" "on"
Screen 0 "SCREEN"
Screen 1 "SCREEN1" RightOf "SCREEN"
Screen 2 "SCREEN2" RightOf "SCREEN1"
EndSection
On the particular machine I was trying to set up an UDL device,
I found the following structure was being used to match
the device to a platform device while I was debugging the issue:
xf86_platform_devices[0] == Intel, /dev/dri/card1, primary platform device
xf86_platform_devices[1] == UDL, /dev/dri/card0
devList[0] == "Intel0", ZaphodHeads: DP1
devList[1] == "Intel1", ZaphodHeads: VGA1
devList[2] == "UDL"
devList[3] == "Intel2", ZaphodHeads: HDMI1 (intended GPU device to UDL)
When xf86platformProbeDev() matched the UDL device, the BusID
check failed in both cases of:
* BusID "usb:0:1.2:1.0" was specified
* Option "kmsdev" "/dev/dri/card0" was specified
As a result, xf86platformProbeDev() went on to call probeSingleDevice()
with xf86_platform_devices[0] and devList[2], resulting in the
UDL device being set up as a GPU device assigned to the first screen
instead of as a framebuffer on the third screen as the configuration
specified.
Checking Option "kmsdev" in code code may be a layering violation.
But the modesetting driver is actually part of the Xorg sources
instead of being an external driver, so he "kmsdev" path knowledge
may be used here.
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2020-02-12 22:29:52 +01:00
|
|
|
if (devpath && *devpath) {
|
|
|
|
if (strcmp(xf86_platform_devices[j].attribs->path, devpath) == 0)
|
|
|
|
break;
|
|
|
|
} else if (devList[i]->busID && *devList[i]->busID) {
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
if (xf86PlatformDeviceCheckBusID(&xf86_platform_devices[j], devList[i]->busID))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else {
|
2012-08-27 07:22:44 +02:00
|
|
|
/* for non-seat0 servers assume first device is the master */
|
|
|
|
if (ServerIsNotSeat0())
|
|
|
|
break;
|
2014-02-13 13:36:12 +01:00
|
|
|
|
|
|
|
if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
|
|
|
|
break;
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j == xf86_num_platform_devices)
|
|
|
|
continue;
|
|
|
|
|
2016-09-08 15:24:58 +02:00
|
|
|
foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i],
|
|
|
|
isGPUDevice(devList[i]) ? PLATFORM_PROBE_GPU_SCREEN : 0);
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
}
|
|
|
|
|
2016-12-12 17:03:12 +01:00
|
|
|
free(devList);
|
|
|
|
|
2016-09-30 11:59:04 +02:00
|
|
|
return foundScreen;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
xf86platformAddGPUDevices(DriverPtr drvp)
|
|
|
|
{
|
|
|
|
Bool foundScreen = FALSE;
|
|
|
|
GDevPtr *devList;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
if (!drvp->platformProbe)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
xf86MatchDevice(drvp->driverName, &devList);
|
|
|
|
|
2014-12-30 18:13:16 +01:00
|
|
|
/* if autoaddgpu devices is enabled then go find any unclaimed platform
|
|
|
|
* devices and add them as GPU screens */
|
|
|
|
if (xf86Info.autoAddGPU) {
|
2012-06-05 18:45:03 +02:00
|
|
|
for (j = 0; j < xf86_num_platform_devices; j++) {
|
2014-12-30 18:13:16 +01:00
|
|
|
if (probeSingleDevice(&xf86_platform_devices[j], drvp,
|
|
|
|
devList ? devList[0] : NULL,
|
|
|
|
PLATFORM_PROBE_GPU_SCREEN))
|
|
|
|
foundScreen = TRUE;
|
2012-06-05 18:45:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-12 17:03:12 +01:00
|
|
|
free(devList);
|
|
|
|
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
return foundScreen;
|
|
|
|
}
|
|
|
|
|
2012-06-05 18:30:39 +02:00
|
|
|
int
|
|
|
|
xf86platformAddDevice(int index)
|
|
|
|
{
|
|
|
|
int i, old_screens, scr_index;
|
|
|
|
DriverPtr drvp = NULL;
|
|
|
|
screenLayoutPtr layout;
|
2013-11-15 08:56:15 +01:00
|
|
|
static const char *hotplug_driver_name = "modesetting";
|
2012-06-05 18:30:39 +02:00
|
|
|
|
2015-09-12 23:45:15 +02:00
|
|
|
if (!xf86Info.autoAddGPU)
|
|
|
|
return -1;
|
|
|
|
|
2012-06-05 18:30:39 +02:00
|
|
|
/* force load the driver for now */
|
|
|
|
xf86LoadOneModule(hotplug_driver_name, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < xf86NumDrivers; i++) {
|
|
|
|
if (!xf86DriverList[i])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!strcmp(xf86DriverList[i]->driverName, hotplug_driver_name)) {
|
|
|
|
drvp = xf86DriverList[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i == xf86NumDrivers)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
old_screens = xf86NumGPUScreens;
|
2014-03-03 16:07:16 +01:00
|
|
|
doPlatformProbe(&xf86_platform_devices[index], drvp, NULL,
|
|
|
|
PLATFORM_PROBE_GPU_SCREEN, 0);
|
2012-06-05 18:30:39 +02:00
|
|
|
if (old_screens == xf86NumGPUScreens)
|
|
|
|
return -1;
|
|
|
|
i = old_screens;
|
|
|
|
|
|
|
|
for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
|
|
|
|
layout++) {
|
|
|
|
xf86GPUScreens[i]->confScreen = layout->screen;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xf86GPUScreens[i]->PreInit &&
|
|
|
|
xf86GPUScreens[i]->PreInit(xf86GPUScreens[i], 0))
|
2014-10-31 00:45:12 +01:00
|
|
|
xf86GPUScreens[i]->configured = TRUE;
|
2012-06-05 18:30:39 +02:00
|
|
|
|
|
|
|
if (!xf86GPUScreens[i]->configured) {
|
|
|
|
ErrorF("hotplugged device %d didn't configure\n", i);
|
|
|
|
xf86DeleteScreen(xf86GPUScreens[i]);
|
|
|
|
return -1;
|
|
|
|
}
|
2012-06-13 15:03:04 +02:00
|
|
|
|
2012-06-05 18:30:39 +02:00
|
|
|
scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL);
|
2013-01-09 03:51:45 +01:00
|
|
|
if (scr_index == -1) {
|
|
|
|
xf86DeleteScreen(xf86GPUScreens[i]);
|
|
|
|
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
|
|
|
|
xf86NumGPUScreens = old_screens;
|
|
|
|
return -1;
|
|
|
|
}
|
2012-06-05 18:30:39 +02:00
|
|
|
dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates,
|
|
|
|
xf86ScreenKey, xf86GPUScreens[i]);
|
|
|
|
|
|
|
|
CreateScratchPixmapsForScreen(xf86GPUScreens[i]->pScreen);
|
2012-06-13 15:03:04 +02:00
|
|
|
|
2013-01-09 03:52:13 +01:00
|
|
|
if (xf86GPUScreens[i]->pScreen->CreateScreenResources &&
|
|
|
|
!(*xf86GPUScreens[i]->pScreen->CreateScreenResources) (xf86GPUScreens[i]->pScreen)) {
|
|
|
|
RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
|
|
|
|
xf86DeleteScreen(xf86GPUScreens[i]);
|
|
|
|
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
|
|
|
|
xf86NumGPUScreens = old_screens;
|
|
|
|
return -1;
|
|
|
|
}
|
2012-06-13 15:03:04 +02:00
|
|
|
/* attach unbound to 0 protocol screen */
|
|
|
|
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
|
2012-08-17 01:49:24 +02:00
|
|
|
if (xf86Info.autoBindGPU)
|
|
|
|
RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
|
|
|
|
xf86ScrnToScreen(xf86Screens[0]));
|
2012-06-13 15:03:04 +02:00
|
|
|
|
2013-10-30 12:33:50 +01:00
|
|
|
RRResourcesChanged(xf86Screens[0]->pScreen);
|
|
|
|
RRTellChanged(xf86Screens[0]->pScreen);
|
|
|
|
|
2012-06-05 18:30:39 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
xf86platformRemoveDevice(int index)
|
|
|
|
{
|
|
|
|
EntityPtr entity;
|
|
|
|
int ent_num, i, j;
|
|
|
|
Bool found;
|
|
|
|
|
|
|
|
for (ent_num = 0; ent_num < xf86NumEntities; ent_num++) {
|
|
|
|
entity = xf86Entities[ent_num];
|
|
|
|
if (entity->bus.type == BUS_PLATFORM &&
|
|
|
|
entity->bus.id.plat == &xf86_platform_devices[index])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (ent_num == xf86NumEntities)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
found = FALSE;
|
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++) {
|
|
|
|
for (j = 0; j < xf86GPUScreens[i]->numEntities; j++)
|
|
|
|
if (xf86GPUScreens[i]->entityList[j] == ent_num) {
|
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (found)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
ErrorF("failed to find screen to remove\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen);
|
|
|
|
|
|
|
|
RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
|
|
|
|
xf86DeleteScreen(xf86GPUScreens[i]);
|
|
|
|
|
|
|
|
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
|
|
|
|
|
|
|
|
xf86_remove_platform_device(index);
|
2013-10-30 12:33:50 +01:00
|
|
|
|
|
|
|
RRResourcesChanged(xf86Screens[0]->pScreen);
|
2013-01-09 05:26:35 +01:00
|
|
|
RRTellChanged(xf86Screens[0]->pScreen);
|
2012-06-05 18:30:39 +02:00
|
|
|
out:
|
|
|
|
return;
|
|
|
|
}
|
2013-04-10 08:32:15 +02:00
|
|
|
|
|
|
|
/* called on return from VT switch to find any new devices */
|
|
|
|
void xf86platformVTProbe(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
2014-02-02 13:54:33 +01:00
|
|
|
if (!(xf86_platform_devices[i].flags & XF86_PDEV_UNOWNED))
|
2013-04-10 08:32:15 +02:00
|
|
|
continue;
|
|
|
|
|
2014-02-02 13:54:33 +01:00
|
|
|
xf86_platform_devices[i].flags &= ~XF86_PDEV_UNOWNED;
|
2013-04-10 08:32:15 +02:00
|
|
|
xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs);
|
|
|
|
}
|
|
|
|
}
|
2014-02-13 13:31:31 +01:00
|
|
|
|
|
|
|
void xf86platformPrimary(void)
|
|
|
|
{
|
|
|
|
/* use the first platform device as a fallback */
|
|
|
|
if (primaryBus.type == BUS_NONE) {
|
|
|
|
xf86Msg(X_INFO, "no primary bus or device found\n");
|
|
|
|
|
|
|
|
if (xf86_num_platform_devices > 0) {
|
|
|
|
primaryBus.id.plat = &xf86_platform_devices[0];
|
|
|
|
primaryBus.type = BUS_PLATFORM;
|
|
|
|
|
|
|
|
xf86Msg(X_NONE, "\tfalling back to %s\n", primaryBus.id.plat->attribs->syspath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
xfree86: use udev to provide device enumeration for kms devices (v10)
On Linux in order for future hotplug work, we are required to interface
to udev to detect device creation/removal. In order to try and get
some earlier testing on this, this patch adds the ability to use
udev for device enumeration on Linux.
At startup the list of drm/kms devices is probed and this info is
used to load drivers.
A new driver probing method is introduced that passes the udev
device info to the driver for probing.
The probing integrates with the pci probing code and will fallback
to the pci probe and old school probe functions in turn.
The flags parameter to the probe function will be used later
to provide hotplug and gpu screen flags for the driver to behave
in a different way.
This patch changes the driver ABI, all drivers should at least
be set with a NULL udev probe function after this commit.
v2: rename to platform bus, now with 100% less udev specific,
this version passes config_odev_attribs around which are an array
of id/string pairs, then the udev code can attach the set of attribs
it understands, the OS specific code can attach its attrib, and then
the core/drivers can lookup the required attribs.
also add MATCH_PCI_DEVICES macro.
This version is mainly to address concerns raised by ajax.
v3: Address comments from Peter.
fix whitespace that snuck in.
rework to use a linked list with some core functions that
xf86 wraps.
v4: add free list, fix struct whitespace.
ajax this address most of your issues?
v5: drop probe ifdef, fix logic issue
v6: some overhaul after more testing.
Implement primaryBus for platform devices.
document hotplug.h dev attribs - drop sysname attrib
fix build with udev kms disabled
make probing work like the PCI probe code,
match against bus id if one exists, or primary device.
RFC: add new bus id support "PLAT:syspath". we probably
want to match on this a bit different, or use a different
property maybe. I was mainly wanting this for use with
specifying usb devices in xorg.conf directly, but PLAT:path
could also work I suppose.
v6.1: add missing noop platform function
v7: fix two interactions with pci probing and slot claiming, prevents
pci and platform trying to load two drivers for same slot.
v8: test with zaphod mode on -ati driver, fixup resulting issue
clean up common probe code into another function, change busid
matching to allow dropping end of strings.
v9: fix platform probing logic so it actually works.
v9.1: fix pdev init to NULL properly.
v10: address most of Keith's concerns.
v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com>
v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-08 15:26:47 +02:00
|
|
|
#endif
|