aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-06-06 06:45:41 +0000
committerEric Anholt <anholt@freebsd.org>2005-06-06 06:45:41 +0000
commit751765dba5b15f431a12308e09237d895c65e471 (patch)
tree449413b86789b28e3e9ba33467cdfa96f33bb69d
parent805a07714f05833a1ed4e4a01f8086fafd46e849 (diff)
Add a few more bits of Tonnerre's NetBSD port (Still need to deal with the
device attachment).
-rw-r--r--bsd-core/drmP.h1
-rw-r--r--bsd-core/drm_bufs.c3
-rw-r--r--bsd-core/drm_drv.c17
-rw-r--r--bsd-core/drm_irq.c13
-rw-r--r--bsd-core/mga_drv.c5
-rw-r--r--bsd-core/r128_drv.c5
-rw-r--r--bsd-core/radeon_drv.c5
-rw-r--r--bsd-core/sis_drv.c5
-rw-r--r--bsd-core/tdfx_drv.c5
9 files changed, 48 insertions, 11 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 8d648f65..98e4945c 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -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 */
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
index 0f1b7a03..9397e4df 100644
--- a/bsd-core/drm_bufs.c
+++ b/bsd-core/drm_bufs.c
@@ -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__ */
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 71fcb7c8..44a6c85a 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -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);
}
diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c
index d0434c4d..8c5660c5 100644
--- a/bsd-core/drm_irq.c
+++ b/bsd-core/drm_irq.c
@@ -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 );
diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c
index e088ceca..6034212c 100644
--- a/bsd-core/mga_drv.c
+++ b/bsd-core/mga_drv.c
@@ -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
diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c
index 37a33240..94f4ce79 100644
--- a/bsd-core/r128_drv.c
+++ b/bsd-core/r128_drv.c
@@ -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
diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c
index 29f54cd9..78079b72 100644
--- a/bsd-core/radeon_drv.c
+++ b/bsd-core/radeon_drv.c
@@ -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__ */
diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c
index 985dc4bc..6aa25937 100644
--- a/bsd-core/sis_drv.c
+++ b/bsd-core/sis_drv.c
@@ -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
diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c
index 036d8ec1..98ae9ae5 100644
--- a/bsd-core/tdfx_drv.c
+++ b/bsd-core/tdfx_drv.c
@@ -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