Add a few more bits of Tonnerre's NetBSD port (Still need to deal with the
device attachment).main
parent
805a07714f
commit
751765dba5
|
@ -723,7 +723,6 @@ struct drm_device {
|
|||
struct resource *irqr; /* Resource for interrupt used by board */
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
struct pci_attach_args pa;
|
||||
pci_intr_handle_t ih;
|
||||
#endif
|
||||
void *irqh; /* Handle from bus_setup_intr */
|
||||
|
||||
|
|
|
@ -927,7 +927,8 @@ int drm_mapbufs(DRM_IOCTL_ARGS)
|
|||
vm_offset_t vaddr;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
struct vnode *vn;
|
||||
vm_size_t size;
|
||||
voff_t foff;
|
||||
vsize_t size;
|
||||
vaddr_t vaddr;
|
||||
#endif /* __NetBSD__ || __OpenBSD__ */
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ MOD_DEV("drm", LM_DT_CHAR, CDEV_MAJOR, &drm_cdevsw);
|
|||
int drm_lkmentry(struct lkm_table *lkmtp, int cmd, int ver);
|
||||
static int drm_lkmhandle(struct lkm_table *lkmtp, int cmd);
|
||||
|
||||
int drm_modprobe();
|
||||
int drm_modprobe(void);
|
||||
int drm_probe(struct pci_attach_args *pa);
|
||||
void drm_attach(struct pci_attach_args *pa, dev_t kdev);
|
||||
|
||||
|
@ -212,10 +212,7 @@ int drm_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) {
|
|||
|
||||
static int drm_lkmhandle(struct lkm_table *lkmtp, int cmd)
|
||||
{
|
||||
int j, error = 0;
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ > 106080000)
|
||||
struct lkm_dev *args = lkmtp->private.lkm_dev;
|
||||
#endif
|
||||
int error = 0;
|
||||
|
||||
switch(cmd) {
|
||||
case LKM_E_LOAD:
|
||||
|
@ -242,7 +239,8 @@ static int drm_lkmhandle(struct lkm_table *lkmtp, int cmd)
|
|||
return error;
|
||||
}
|
||||
|
||||
int drm_modprobe() {
|
||||
int drm_modprobe(void)
|
||||
{
|
||||
struct pci_attach_args pa;
|
||||
int error;
|
||||
|
||||
|
@ -279,6 +277,13 @@ void drm_attach(struct pci_attach_args *pa, dev_t kdev,
|
|||
memset(dev, 0, sizeof(drm_device_t));
|
||||
memcpy(&dev->pa, pa, sizeof(dev->pa));
|
||||
|
||||
dev->irq = pa->pa_intrline;
|
||||
dev->pci_domain = 0;
|
||||
dev->pci_bus = pa->pa_bus;
|
||||
dev->pci_slot = pa->pa_device;
|
||||
dev->pci_func = pa->pa_function;
|
||||
dev->dma_tag = pa->pa_dmat;
|
||||
|
||||
DRM_INFO("%s", drm_find_description(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id), idlist));
|
||||
drm_init(dev);
|
||||
}
|
||||
|
|
|
@ -69,6 +69,9 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS)
|
|||
int drm_irq_install(drm_device_t *dev)
|
||||
{
|
||||
int retcode;
|
||||
#ifdef __NetBSD__
|
||||
pci_intr_handle_t ih;
|
||||
#endif
|
||||
|
||||
if (dev->irq == 0 || dev->dev_private == NULL)
|
||||
return DRM_ERR(EINVAL);
|
||||
|
@ -109,12 +112,12 @@ int drm_irq_install(drm_device_t *dev)
|
|||
if (retcode != 0)
|
||||
goto err;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
if (pci_intr_map(&dev->pa, &dev->ih) != 0) {
|
||||
if (pci_intr_map(&dev->pa, &ih) != 0) {
|
||||
retcode = ENOENT;
|
||||
goto err;
|
||||
}
|
||||
dev->irqh = pci_intr_establish(&dev->pa.pa_pc, dev->ih, IPL_TTY,
|
||||
(irqreturn_t (*)(DRM_IRQ_ARGS))dev->irq_handler, dev);
|
||||
dev->irqh = pci_intr_establish(&dev->pa.pa_pc, ih, IPL_TTY,
|
||||
(irqreturn_t (*)(void *))dev->irq_handler, dev);
|
||||
if (!dev->irqh) {
|
||||
retcode = ENOENT;
|
||||
goto err;
|
||||
|
@ -144,14 +147,18 @@ err:
|
|||
|
||||
int drm_irq_uninstall(drm_device_t *dev)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
int irqrid;
|
||||
#endif
|
||||
|
||||
if (!dev->irq_enabled)
|
||||
return DRM_ERR(EINVAL);
|
||||
|
||||
dev->irq_enabled = 0;
|
||||
#ifdef __FreeBSD__
|
||||
irqrid = dev->irqrid;
|
||||
dev->irqrid = 0;
|
||||
#endif
|
||||
|
||||
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );
|
||||
|
||||
|
|
|
@ -141,5 +141,10 @@ DRIVER_MODULE(mga, pci, mga_driver, drm_devclass, 0, 0);
|
|||
MODULE_DEPEND(mga, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#ifdef _LKM
|
||||
CFDRIVER_DECL(mga, DV_TTY, NULL);
|
||||
#else
|
||||
CFATTACH_DECL(mga, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
||||
drm_activate);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -113,5 +113,10 @@ DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
|
|||
MODULE_DEPEND(r128, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#ifdef _LKM
|
||||
CFDRIVER_DECL(r128, DV_TTY, NULL);
|
||||
#else
|
||||
CFATTACH_DECL(r128, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
||||
drm_activate);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -115,5 +115,10 @@ DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0);
|
|||
MODULE_DEPEND(radeon, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#ifdef _LKM
|
||||
CFDRIVER_DECL(radeon, DV_TTY, NULL);
|
||||
#else
|
||||
CFATTACH_DECL(radeon, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
||||
drm_activate);
|
||||
#endif
|
||||
#endif /* __FreeBSD__ */
|
||||
|
|
|
@ -96,5 +96,10 @@ DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0);
|
|||
MODULE_DEPEND(sisdrm, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#ifdef _LKM
|
||||
CFDRIVER_DECL(sis, DV_TTY, NULL);
|
||||
#else
|
||||
CFATTACH_DECL(sis, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
||||
drm_activate);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -97,5 +97,10 @@ DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0);
|
|||
MODULE_DEPEND(tdfx, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#ifdef _LKM
|
||||
CFDRIVER_DECL(tdfx, DV_TTY, NULL);
|
||||
#else
|
||||
CFATTACH_DECL(tdfx, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
||||
drm_activate);
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue