/*
*/
/*
* drm_drv.h -- Generic driver template -*- linux-c -*-
* Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
*/
/*
* Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* 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,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* 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
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Rickard E. (Rik) Faith <faith@valinux.com>
* Gareth Hughes <gareth@valinux.com>
*
*/
#include "drmP.h"
#include "drm.h"
#include "drm_sarea.h"
int drm_debug_flag = 0;
void
{
}
void
drm_init_ioctl_arrays(void)
{
}
static const char *
{
int i = 0;
}
}
return ((char *)NULL);
}
static int
{
int i;
int retval;
/* prebuild the SAREA */
if (retval != 0) {
DRM_ERROR("firstopen: failed to prebuild SAREA");
return (retval);
}
if (drm_device_is_agp(dev))
DRM_ERROR("couldn't initialize AGP");
return (EIO);
}
}
if (retval != 0) {
DRM_ERROR("drm_firstopen: driver-specific firstopen failed");
return (retval);
}
i = drm_dma_setup(dev);
if (i != 0)
return (i);
}
for (i = 0; i < DRM_HASH_SIZE; i++) {
}
dev->irq_enabled = 0;
dev->context_flag = 0;
dev->last_context = 0;
dev->if_version = 0;
return (0);
}
/* Free resources associated with the DRM on the last close. */
static int
{
int i;
if (dev->irq_enabled)
(void) drm_irq_uninstall(dev);
dev->unique_len = 0;
}
/* Clear pid list */
for (i = 0; i < DRM_HASH_SIZE; i++) {
}
}
/* Clear AGP information */
/*
* Remove AGP resources, but leave dev->agp
* intact until drm_cleanup is called.
*/
(void) drm_agp_unbind_memory(
}
(void) drm_agp_do_release(dev);
}
}
/* Clean up maps that weren't set up by the driver. */
if (!map->kernel_owned)
}
}
return (0);
}
static int
{
int retcode;
if (retcode != 0) {
DRM_ERROR("drm_load: failed\n");
goto error;
}
}
if (retcode != 0) {
DRM_ERROR("drm_load: Cannot allocate memory for ctx bitmap");
goto error;
}
if (drm_init_kstats(dev)) {
DRM_ERROR("drm_attach => drm_load: init kstats error");
goto error;
}
DRM_INFO("!drm: Initialized %s %d.%d.%d %s ",
return (0);
DRM_LOCK();
(void) drm_lastclose(dev);
DRM_UNLOCK();
return (retcode);
}
/* called when cleanup this module */
static void
{
DRM_LOCK();
(void) drm_lastclose(dev);
DRM_UNLOCK();
}
}
/*ARGSUSED*/
int
{
int retcode;
if (!retcode) {
DRM_LOCK();
if (!dev->open_count ++)
DRM_UNLOCK();
}
return (retcode);
}
/*ARGSUSED*/
int
{
int retcode = 0;
DRM_LOCK();
if (!mp) {
DRM_UNLOCK();
DRM_ERROR("drm_close: can't find authenticator");
return (EACCES);
}
goto done;
/*
* Begin inline drm_release
*/
DRM_DEBUG("drm_close :pid = %d , open_count = %d",
DRM_DEBUG("Process %d dead, freeing lock for context %d",
DRM_ERROR("drm_close: "
"retake lock not implemented yet");
}
done:
if (--dev->open_count == 0) {
}
DRM_UNLOCK();
return (retcode);
}
int
{
}
int
{
return (DDI_SUCCESS);
}
static int
{
DRM_ERROR("drm_get_businfo: get irq error");
return (DDI_FAILURE);
}
/* XXX Fix domain number (alpha hoses) */
dev->pci_domain = 0;
DRM_ERROR("drm_get_businfo: get bus slot func error ");
return (DDI_FAILURE);
}
DRM_DEBUG("drm_get_businfo: pci bus: %d, pci slot :%d pci func %d",
return (DDI_SUCCESS);
}
int
{
const char *s = NULL;
if (s != NULL) {
DRM_ERROR("drm_probe: drm get bus info error");
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
return (DDI_FAILURE);
}