Make viadrm (UMS) almost build.

Missing part: something needs to issue config_found_ia("drmums_pci"),
and config(5) needs to be told that it will do that.  The sensible
approach is for vga_pci to do so.  But config(5) doesn't seem to
understand that *only* vga_pci will do that, not all vga.

The old scheme was to tell config(5) that vga would always attach
drm, and actually attach it in vga_pci, and hope that nobody would
ever consider trying to attach non-PCI devices but quietly leave the
token `pci' out of the name of the drm interface attribute so it
didn't look wrong to have it outside dev/pci/files.pci.

Maybe that's still the right thing, as far as anything UMS can be
right.
This commit is contained in:
riastradh 2015-04-29 04:45:03 +00:00
parent 9f0b3ec037
commit 42bda9b449
5 changed files with 28 additions and 12 deletions

View File

@ -53,6 +53,7 @@ static void via_driver_postclose(struct drm_device *dev, struct drm_file *file)
kfree(file_priv);
}
#ifndef __NetBSD__
static struct pci_device_id pciidlist[] = {
viadrv_PCI_IDS
};
@ -69,6 +70,7 @@ static const struct file_operations via_driver_fops = {
#endif
.llseek = noop_llseek,
};
#endif
static struct drm_driver driver = {
.driver_features =
@ -90,7 +92,9 @@ static struct drm_driver driver = {
.dma_quiescent = via_driver_dma_quiescent,
.lastclose = via_lastclose,
.ioctls = via_ioctls,
#ifndef __NetBSD__
.fops = &via_driver_fops,
#endif
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
@ -99,9 +103,14 @@ static struct drm_driver driver = {
.patchlevel = DRIVER_PATCHLEVEL,
};
#ifdef __NetBSD__
struct drm_driver *const via_drm_driver = &driver;
#endif
#ifndef __NetBSD__
static struct pci_driver via_pci_driver = {
.name = DRIVER_NAME,
.id_table = pciidlist,
.id_table = viadrm_pciidlist,
};
static int __init via_init(void)
@ -115,6 +124,7 @@ static void __exit via_exit(void)
{
drm_pci_exit(&driver, &via_pci_driver);
}
#endif /* __NetBSD__ */
module_init(via_init);
module_exit(via_exit);

View File

@ -152,7 +152,7 @@ extern u32 via_get_vblank_counter(struct drm_device *dev, int crtc);
extern int via_enable_vblank(struct drm_device *dev, int crtc);
extern void via_disable_vblank(struct drm_device *dev, int crtc);
extern irqreturn_t via_driver_irq_handler(int irq, void *arg);
extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS);
extern void via_driver_irq_preinstall(struct drm_device *dev);
extern int via_driver_irq_postinstall(struct drm_device *dev);
extern void via_driver_irq_uninstall(struct drm_device *dev);

View File

@ -104,7 +104,7 @@ u32 via_get_vblank_counter(struct drm_device *dev, int crtc)
return atomic_read(&dev_priv->vbl_received);
}
irqreturn_t via_driver_irq_handler(int irq, void *arg)
irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
{
struct drm_device *dev = (struct drm_device *) arg;
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;

View File

@ -1,7 +1,14 @@
# $NetBSD: files.drmkms_pci,v 1.5 2015/03/05 17:50:41 riastradh Exp $
# $NetBSD: files.drmkms_pci,v 1.6 2015/04/29 04:45:03 riastradh Exp $
# Attribute for kernel components supporting PCI-based real graphics
# drivers, a.k.a. `drmkms' (kernel mode-setting).
define drmkms_pci: drmkms
# Interface attribute for attaching PCI-based fake graphics drivers,
# a.k.a. `drmums' (user mode-setting). This uses all the same support
# code as PCI-based KMS drivers but has a bogus attachment via vga(4).
define drmums_pci {}: drmkms_pci
# XXX Not quite right! Should AGP stuff be kept separate?
makeoptions drmkms_pci CPPFLAGS+="-DCONFIG_AGP"
@ -16,4 +23,4 @@ file external/bsd/drm2/pci/drmfb_pci.c drmfb_pci
include "external/bsd/drm2/i915drm/files.i915drmkms"
include "external/bsd/drm2/radeon/files.radeon"
include "external/bsd/drm2/nouveau/files.nouveau"
#...
#include "external/bsd/drm2/via/files.via"

View File

@ -1,16 +1,13 @@
# $NetBSD: files.via,v 1.1 2014/08/26 17:28:14 riastradh Exp $
# $NetBSD: files.via,v 1.2 2015/04/29 04:45:03 riastradh Exp $
define viafbbus { }
device viadrmums: drmkms, drmkms_pci, viafbbus
attach viadrmums at pci
device viafb: viafbbus, genfb, wsemuldisplaydev
attach viafb at viafbbus
device viadrmums
attach viadrmums at drmums_pci
makeoptions viadrmums CPPFLAGS+="-I$S/external/bsd/drm2/dist/drm/via"
makeoptions viadrmums CPPFLAGS+="-I$S/external/bsd/drm2/via"
makeoptions viadrmums "CWARNFLAGS.via_verifier.c"+="-Wno-shadow"
makeoptions viadrmums "CWARNFLAGS.via_pci.c"+="-Wno-missing-field-initializers"
file external/bsd/drm2/dist/drm/via/via_dma.c viadrmums
file external/bsd/drm2/dist/drm/via/via_dmablit.c viadrmums
@ -20,3 +17,5 @@ file external/bsd/drm2/dist/drm/via/via_map.c viadrmums
file external/bsd/drm2/dist/drm/via/via_mm.c viadrmums
file external/bsd/drm2/dist/drm/via/via_verifier.c viadrmums
file external/bsd/drm2/dist/drm/via/via_video.c viadrmums
file external/bsd/drm2/via/via_pci.c viadrmums