2002-07-05 02:31:11 -06:00
|
|
|
/* radeon_drv.c -- ATI Radeon driver -*- linux-c -*-
|
|
|
|
* Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
|
2005-04-15 21:02:52 -06:00
|
|
|
*/
|
|
|
|
/*-
|
2000-06-13 11:38:09 -06:00
|
|
|
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
2000-05-30 11:13:31 -06:00
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2002-01-27 13:05:42 -07:00
|
|
|
*
|
2000-05-30 11:13:31 -06:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
2002-01-27 13:05:42 -07:00
|
|
|
*
|
2000-05-30 11:13:31 -06:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
2002-07-05 02:31:11 -06:00
|
|
|
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
2000-05-30 11:13:31 -06:00
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
2002-07-05 02:31:11 -06:00
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
2002-01-27 13:05:42 -07:00
|
|
|
*
|
2000-06-13 11:38:09 -06:00
|
|
|
* Authors:
|
2002-01-27 13:05:42 -07:00
|
|
|
* Gareth Hughes <gareth@valinux.com>
|
2003-04-23 18:46:03 -06:00
|
|
|
*
|
2000-05-30 11:13:31 -06:00
|
|
|
*/
|
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
#include "drmP.h"
|
2002-07-05 02:31:11 -06:00
|
|
|
#include "drm.h"
|
|
|
|
#include "radeon_drm.h"
|
|
|
|
#include "radeon_drv.h"
|
2004-11-05 18:41:47 -07:00
|
|
|
#include "drm_pciids.h"
|
|
|
|
|
2005-09-30 00:41:10 -06:00
|
|
|
int radeon_no_wb;
|
|
|
|
|
2004-11-05 18:41:47 -07:00
|
|
|
/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
|
|
|
|
static drm_pci_id_list_t radeon_pciidlist[] = {
|
|
|
|
radeon_PCI_IDS
|
|
|
|
};
|
|
|
|
|
2008-05-27 15:12:51 -06:00
|
|
|
static void radeon_configure(struct drm_device *dev)
|
2004-11-05 18:41:47 -07:00
|
|
|
{
|
2005-08-04 21:50:23 -06:00
|
|
|
dev->driver.buf_priv_size = sizeof(drm_radeon_buf_priv_t);
|
|
|
|
dev->driver.load = radeon_driver_load;
|
|
|
|
dev->driver.unload = radeon_driver_unload;
|
|
|
|
dev->driver.firstopen = radeon_driver_firstopen;
|
|
|
|
dev->driver.open = radeon_driver_open;
|
|
|
|
dev->driver.preclose = radeon_driver_preclose;
|
|
|
|
dev->driver.postclose = radeon_driver_postclose;
|
|
|
|
dev->driver.lastclose = radeon_driver_lastclose;
|
2008-05-23 12:36:05 -06:00
|
|
|
dev->driver.get_vblank_counter = radeon_get_vblank_counter;
|
|
|
|
dev->driver.enable_vblank = radeon_enable_vblank;
|
|
|
|
dev->driver.disable_vblank = radeon_disable_vblank;
|
2005-08-04 21:50:23 -06:00
|
|
|
dev->driver.irq_preinstall = radeon_driver_irq_preinstall;
|
|
|
|
dev->driver.irq_postinstall = radeon_driver_irq_postinstall;
|
|
|
|
dev->driver.irq_uninstall = radeon_driver_irq_uninstall;
|
|
|
|
dev->driver.irq_handler = radeon_driver_irq_handler;
|
|
|
|
dev->driver.dma_ioctl = radeon_cp_buffers;
|
2004-11-05 18:41:47 -07:00
|
|
|
|
2005-08-04 21:50:23 -06:00
|
|
|
dev->driver.ioctls = radeon_ioctls;
|
|
|
|
dev->driver.max_ioctl = radeon_max_ioctl;
|
2004-11-05 18:41:47 -07:00
|
|
|
|
2005-08-04 21:50:23 -06:00
|
|
|
dev->driver.name = DRIVER_NAME;
|
|
|
|
dev->driver.desc = DRIVER_DESC;
|
|
|
|
dev->driver.date = DRIVER_DATE;
|
|
|
|
dev->driver.major = DRIVER_MAJOR;
|
|
|
|
dev->driver.minor = DRIVER_MINOR;
|
|
|
|
dev->driver.patchlevel = DRIVER_PATCHLEVEL;
|
2004-11-05 18:41:47 -07:00
|
|
|
|
2005-08-04 21:50:23 -06:00
|
|
|
dev->driver.use_agp = 1;
|
|
|
|
dev->driver.use_mtrr = 1;
|
|
|
|
dev->driver.use_pci_dma = 1;
|
|
|
|
dev->driver.use_sg = 1;
|
|
|
|
dev->driver.use_dma = 1;
|
|
|
|
dev->driver.use_irq = 1;
|
|
|
|
dev->driver.use_vbl_irq = 1;
|
2007-12-01 23:23:11 -07:00
|
|
|
dev->driver.use_vbl_irq2 = 1;
|
2004-11-05 18:41:47 -07:00
|
|
|
}
|
2000-05-30 11:13:31 -06:00
|
|
|
|
2003-04-23 18:46:03 -06:00
|
|
|
#ifdef __FreeBSD__
|
2004-11-05 18:41:47 -07:00
|
|
|
static int
|
|
|
|
radeon_probe(device_t dev)
|
|
|
|
{
|
|
|
|
return drm_probe(dev, radeon_pciidlist);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
radeon_attach(device_t nbdev)
|
|
|
|
{
|
2008-05-27 15:12:51 -06:00
|
|
|
struct drm_device *dev = device_get_softc(nbdev);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
2008-05-27 15:12:51 -06:00
|
|
|
bzero(dev, sizeof(struct drm_device));
|
2004-11-05 18:41:47 -07:00
|
|
|
radeon_configure(dev);
|
|
|
|
return drm_attach(nbdev, radeon_pciidlist);
|
|
|
|
}
|
|
|
|
|
|
|
|
static device_method_t radeon_methods[] = {
|
|
|
|
/* Device interface */
|
|
|
|
DEVMETHOD(device_probe, radeon_probe),
|
|
|
|
DEVMETHOD(device_attach, radeon_attach),
|
|
|
|
DEVMETHOD(device_detach, drm_detach),
|
|
|
|
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t radeon_driver = {
|
|
|
|
"drm",
|
|
|
|
radeon_methods,
|
2008-05-27 15:12:51 -06:00
|
|
|
sizeof(struct drm_device)
|
2004-11-05 18:41:47 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
extern devclass_t drm_devclass;
|
2005-12-29 19:17:05 -07:00
|
|
|
#if __FreeBSD_version >= 700010
|
|
|
|
DRIVER_MODULE(radeon, vgapci, radeon_driver, drm_devclass, 0, 0);
|
|
|
|
#else
|
2004-11-05 18:41:47 -07:00
|
|
|
DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0);
|
2005-12-29 19:17:05 -07:00
|
|
|
#endif
|
2004-11-05 18:41:47 -07:00
|
|
|
MODULE_DEPEND(radeon, drm, 1, 1, 1);
|
|
|
|
|
2004-11-06 16:02:07 -07:00
|
|
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
2005-06-06 00:45:41 -06:00
|
|
|
#ifdef _LKM
|
2003-04-23 18:46:03 -06:00
|
|
|
CFDRIVER_DECL(radeon, DV_TTY, NULL);
|
2005-06-06 00:45:41 -06:00
|
|
|
#else
|
2008-05-27 15:12:51 -06:00
|
|
|
CFATTACH_DECL(radeon, sizeof(struct drm_device), drm_probe, drm_attach,
|
|
|
|
drm_detach, drm_activate);
|
2005-06-06 00:45:41 -06:00
|
|
|
#endif
|
2003-04-23 18:46:03 -06:00
|
|
|
#endif /* __FreeBSD__ */
|