/*
*/
/*
* Copyright (c) 2012 Intel Corporation. All rights reserved.
*/
/**
* \file drm_pci.h
* \brief PCI consistent, DMA-accessible memory functions.
*
* \author Eric Anholt <anholt@FreeBSD.org>
*/
/*-
* Copyright 2003 Eric Anholt.
* 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 THE
* AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR 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.
*/
/**********************************************************************/
/** \name PCI memory */
/*@{*/
#include "drmP.h"
#include <vm/seg_kmem.h>
typedef struct drm_pci_resource {
unsigned long offset;
unsigned long size;
void
{
/*
* During AGP mapping initialization, we map AGP aperture
* into kernel space. So, when we access the memory which
* managed by agp gart in kernel space, we have to go
* through two-level address translation: kernel virtual
* address --> aperture address --> physical address. For
* improving this, here in opensourced code, agp_remap()
* gets invoking to dispose the mapping between agp aperture
* and kernel space, and directly map the actual physical
* memory which is allocated to agp gart to kernel space.
* After that, access to physical memory managed by agp gart
* hardware in kernel space doesn't go through agp hardware,
* it will be: kernel virtual ---> physical address.
* Obviously, it is more efficient. But in Solaris operating
* system, the ioctl AGPIOC_ALLOCATE of agpgart driver does
* not return physical address. We are unable to create the
* direct mapping between kernel space and agp memory. So,
* we remove the calling to agp_remap().
*/
DRM_DEBUG("drm_core_ioremap: skipping agp_remap\n");
} else {
}
}
void
{
} else {
/*
* Refer to the comments in drm_core_ioremap() where we removed
* the calling to agp_remap(), correspondingly, we remove the
* calling to agp_remap_free(dev, map);
*/
DRM_DEBUG("drm_core_ioremap: skipping agp_remap_free\n");
}
}
/*
* pci_alloc_consistent()
*/
DMA_ATTR_V0, /* version */
0, /* addr_lo */
0xffffffff, /* addr_hi */
0xffffffff, /* count_max */
4096, /* alignment */
0xfff, /* burstsize */
1, /* minxfer */
0xffffffff, /* maxxfer */
0xffffffff, /* seg */
1, /* sgllen */
4, /* granular */
DDI_DMA_FLAGERR, /* flags */
};
};
void *
{
/* allocate continous physical memory for hw status page */
DRM_ERROR("ddi_dma_alloc_handle() failed");
goto err3;
}
DRM_ERROR("ddi_dma_mem_alloc() failed\n");
goto err2;
}
DRM_ERROR("ddi_dma_addr_bind_handle() failed");
goto err1;
}
goto err1;
}
if (count == 1)
return (dmah);
err1:
err2:
err3:
return (NULL);
}
void
{
}
int
{
int length;
if (ddi_getlongprop(
DRM_ERROR("do_get_pci_res: ddi_getlongprop failed!\n");
return (EFAULT);
}
return (0);
}
unsigned long
{
int ret;
if (ret != 0) {
DRM_ERROR("drm_get_resource_start: ioctl failed");
return (0);
}
}
unsigned long
{
int ret;
if (ret != 0) {
DRM_ERROR("drm_get_resource_len: ioctl failed");
return (0);
}
}