1 /* sis.c -- sis driver -*- linux-c -*-
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
29 #include "dev/drm/drmP.h"
30 #include "dev/drm/sis_drm.h"
31 #include "dev/drm/sis_drv.h"
32 #include "dev/drm/drm_pciids.h"
34 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
35 static drm_pci_id_list_t sis_pciidlist[] = {
39 static void sis_configure(struct drm_device *dev)
41 dev->driver->driver_features =
42 DRIVER_USE_AGP | DRIVER_USE_MTRR;
44 dev->driver->buf_priv_size = 1; /* No dev_priv */
45 dev->driver->context_ctor = sis_init_context;
46 dev->driver->context_dtor = sis_final_context;
48 dev->driver->ioctls = sis_ioctls;
49 dev->driver->max_ioctl = sis_max_ioctl;
51 dev->driver->name = DRIVER_NAME;
52 dev->driver->desc = DRIVER_DESC;
53 dev->driver->date = DRIVER_DATE;
54 dev->driver->major = DRIVER_MAJOR;
55 dev->driver->minor = DRIVER_MINOR;
56 dev->driver->patchlevel = DRIVER_PATCHLEVEL;
60 sis_probe(device_t kdev)
62 return drm_probe(kdev, sis_pciidlist);
66 sis_attach(device_t kdev)
68 struct drm_device *dev = device_get_softc(kdev);
70 dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
75 return drm_attach(kdev, sis_pciidlist);
79 sis_detach(device_t kdev)
81 struct drm_device *dev = device_get_softc(kdev);
84 ret = drm_detach(kdev);
86 free(dev->driver, DRM_MEM_DRIVER);
91 static device_method_t sis_methods[] = {
92 /* Device interface */
93 DEVMETHOD(device_probe, sis_probe),
94 DEVMETHOD(device_attach, sis_attach),
95 DEVMETHOD(device_detach, sis_detach),
100 static driver_t sis_driver = {
103 sizeof(struct drm_device)
106 extern devclass_t drm_devclass;
107 #if __FreeBSD_version >= 700010
108 DRIVER_MODULE(sisdrm, vgapci, sis_driver, drm_devclass, 0, 0);
110 DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0);
112 MODULE_DEPEND(sisdrm, drm, 1, 1, 1);