summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/r128_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci/drm/r128_drv.c')
-rw-r--r--sys/dev/pci/drm/r128_drv.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/sys/dev/pci/drm/r128_drv.c b/sys/dev/pci/drm/r128_drv.c
index 37a91a9074c..aa0911303a8 100644
--- a/sys/dev/pci/drm/r128_drv.c
+++ b/sys/dev/pci/drm/r128_drv.c
@@ -36,11 +36,12 @@
#include "r128_drm.h"
#include "r128_drv.h"
-int r128drm_probe(struct device *, void *, void *);
-void r128drm_attach(struct device *, struct device *, void *);
+int ragedrm_probe(struct device *, void *, void *);
+void ragedrm_attach(struct device *, struct device *, void *);
+int ragedrm_detach(struct device *, int);
int ragedrm_ioctl(struct drm_device *, u_long, caddr_t, struct drm_file *);
-static drm_pci_id_list_t r128_pciidlist[] = {
+static drm_pci_id_list_t ragedrm_pciidlist[] = {
{PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE128_LE},
{PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MOBILITY_M3},
{PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE128_MF},
@@ -81,7 +82,7 @@ static drm_pci_id_list_t r128_pciidlist[] = {
{0, 0, 0}
};
-static const struct drm_driver_info r128_driver = {
+static const struct drm_driver_info ragedrm_driver = {
.buf_priv_size = sizeof(drm_r128_buf_priv_t),
.ioctl = ragedrm_ioctl,
.preclose = r128_driver_preclose,
@@ -107,24 +108,43 @@ static const struct drm_driver_info r128_driver = {
};
int
-r128drm_probe(struct device *parent, void *match, void *aux)
+ragedrm_probe(struct device *parent, void *match, void *aux)
{
- return drm_probe((struct pci_attach_args *)aux, r128_pciidlist);
+ return drm_probe((struct pci_attach_args *)aux, ragedrm_pciidlist);
}
void
-r128drm_attach(struct device *parent, struct device *self, void *aux)
+ragedrm_attach(struct device *parent, struct device *self, void *aux)
{
struct pci_attach_args *pa = aux;
struct drm_device *dev = (struct drm_device *)self;
+ drm_r128_private_t *dev_priv;
- dev->driver = &r128_driver;
- return drm_attach(parent, self, pa, r128_pciidlist);
+ dev_priv = drm_calloc(1, sizeof(*dev_priv), DRM_MEM_DRIVER);
+ if (dev_priv == NULL)
+ return;
+ dev->dev_private = (void *)dev_priv;
+
+ dev->driver = &ragedrm_driver;
+ return drm_attach(parent, self, pa);
+}
+
+int
+ragedrm_detach(struct device *self, int flags)
+{
+ struct drm_device *dev = (struct drm_device *)self;
+ drm_r128_private_t *dev_priv = dev->dev_private;
+
+ drm_free(dev_priv, sizeof(*dev_priv),
+ DRM_MEM_DRIVER);
+ dev->dev_private = NULL;
+
+ return (drm_detach(self, flags));
}
struct cfattach ragedrm_ca = {
- sizeof(struct drm_device), r128drm_probe, r128drm_attach,
- drm_detach, drm_activate
+ sizeof(struct drm_device), ragedrm_probe, ragedrm_attach,
+ ragedrm_detach, drm_activate
};
struct cfdriver ragedrm_cd = {