Commit a563a8c2 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

gma500: ioctl first pass

Go through the remaining ioctls and check they make sense
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8452c3ef
...@@ -73,10 +73,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist); ...@@ -73,10 +73,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
DRM_IO(DRM_PSB_KMS_OFF + DRM_COMMAND_BASE) DRM_IO(DRM_PSB_KMS_OFF + DRM_COMMAND_BASE)
#define DRM_IOCTL_PSB_KMS_ON \ #define DRM_IOCTL_PSB_KMS_ON \
DRM_IO(DRM_PSB_KMS_ON + DRM_COMMAND_BASE) DRM_IO(DRM_PSB_KMS_ON + DRM_COMMAND_BASE)
#define DRM_IOCTL_PSB_VT_LEAVE \
DRM_IO(DRM_PSB_VT_LEAVE + DRM_COMMAND_BASE)
#define DRM_IOCTL_PSB_VT_ENTER \
DRM_IO(DRM_PSB_VT_ENTER + DRM_COMMAND_BASE)
#define DRM_IOCTL_PSB_SIZES \ #define DRM_IOCTL_PSB_SIZES \
DRM_IOR(DRM_PSB_SIZES + DRM_COMMAND_BASE, \ DRM_IOR(DRM_PSB_SIZES + DRM_COMMAND_BASE, \
struct drm_psb_sizes_arg) struct drm_psb_sizes_arg)
...@@ -96,15 +92,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist); ...@@ -96,15 +92,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
#define DRM_IOCTL_PSB_REGISTER_RW \ #define DRM_IOCTL_PSB_REGISTER_RW \
DRM_IOWR(DRM_PSB_REGISTER_RW + DRM_COMMAND_BASE, \ DRM_IOWR(DRM_PSB_REGISTER_RW + DRM_COMMAND_BASE, \
struct drm_psb_register_rw_arg) struct drm_psb_register_rw_arg)
#define DRM_IOCTL_PSB_GTT_MAP \
DRM_IOWR(DRM_PSB_GTT_MAP + DRM_COMMAND_BASE, \
struct psb_gtt_mapping_arg)
#define DRM_IOCTL_PSB_GTT_UNMAP \
DRM_IOW(DRM_PSB_GTT_UNMAP + DRM_COMMAND_BASE, \
struct psb_gtt_mapping_arg)
#define DRM_IOCTL_PSB_UPDATE_GUARD \
DRM_IOWR(DRM_PSB_UPDATE_GUARD + DRM_COMMAND_BASE, \
uint32_t)
#define DRM_IOCTL_PSB_DPST \ #define DRM_IOCTL_PSB_DPST \
DRM_IOWR(DRM_PSB_DPST + DRM_COMMAND_BASE, \ DRM_IOWR(DRM_PSB_DPST + DRM_COMMAND_BASE, \
uint32_t) uint32_t)
...@@ -118,13 +105,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist); ...@@ -118,13 +105,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
DRM_IOWR(DRM_PSB_GET_PIPE_FROM_CRTC_ID + DRM_COMMAND_BASE, \ DRM_IOWR(DRM_PSB_GET_PIPE_FROM_CRTC_ID + DRM_COMMAND_BASE, \
struct drm_psb_get_pipe_from_crtc_id_arg) struct drm_psb_get_pipe_from_crtc_id_arg)
#define DRM_IOCTL_PSB_KMS_OFF DRM_IO(DRM_PSB_KMS_OFF + DRM_COMMAND_BASE)
#define DRM_IOCTL_PSB_KMS_ON DRM_IO(DRM_PSB_KMS_ON + DRM_COMMAND_BASE)
static int psb_vt_leave_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
static int psb_vt_enter_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
static int psb_sizes_ioctl(struct drm_device *dev, void *data, static int psb_sizes_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
static int psb_dc_state_ioctl(struct drm_device *dev, void * data, static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
...@@ -153,11 +133,6 @@ static struct drm_ioctl_desc psb_ioctls[] = { ...@@ -153,11 +133,6 @@ static struct drm_ioctl_desc psb_ioctls[] = {
PSB_IOCTL_DEF(DRM_IOCTL_PSB_KMS_ON, PSB_IOCTL_DEF(DRM_IOCTL_PSB_KMS_ON,
psbfb_kms_on_ioctl, psbfb_kms_on_ioctl,
DRM_ROOT_ONLY), DRM_ROOT_ONLY),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_VT_LEAVE, psb_vt_leave_ioctl,
DRM_ROOT_ONLY),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_VT_ENTER,
psb_vt_enter_ioctl,
DRM_ROOT_ONLY),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_SIZES, psb_sizes_ioctl, DRM_AUTH), PSB_IOCTL_DEF(DRM_IOCTL_PSB_SIZES, psb_sizes_ioctl, DRM_AUTH),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_DC_STATE, psb_dc_state_ioctl, DRM_AUTH), PSB_IOCTL_DEF(DRM_IOCTL_PSB_DC_STATE, psb_dc_state_ioctl, DRM_AUTH),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_ADB, psb_adb_ioctl, DRM_AUTH), PSB_IOCTL_DEF(DRM_IOCTL_PSB_ADB, psb_adb_ioctl, DRM_AUTH),
...@@ -167,12 +142,6 @@ static struct drm_ioctl_desc psb_ioctls[] = { ...@@ -167,12 +142,6 @@ static struct drm_ioctl_desc psb_ioctls[] = {
DRM_AUTH), DRM_AUTH),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_REGISTER_RW, psb_register_rw_ioctl, PSB_IOCTL_DEF(DRM_IOCTL_PSB_REGISTER_RW, psb_register_rw_ioctl,
DRM_AUTH), DRM_AUTH),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_GTT_MAP,
psb_gtt_map_meminfo_ioctl,
DRM_AUTH),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_GTT_UNMAP,
psb_gtt_unmap_meminfo_ioctl,
DRM_AUTH),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_DPST, psb_dpst_ioctl, DRM_AUTH), PSB_IOCTL_DEF(DRM_IOCTL_PSB_DPST, psb_dpst_ioctl, DRM_AUTH),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_GAMMA, psb_gamma_ioctl, DRM_AUTH), PSB_IOCTL_DEF(DRM_IOCTL_PSB_GAMMA, psb_gamma_ioctl, DRM_AUTH),
PSB_IOCTL_DEF(DRM_IOCTL_PSB_DPST_BL, psb_dpst_bl_ioctl, DRM_AUTH), PSB_IOCTL_DEF(DRM_IOCTL_PSB_DPST_BL, psb_dpst_bl_ioctl, DRM_AUTH),
...@@ -495,7 +464,6 @@ static int psb_do_init(struct drm_device *dev) ...@@ -495,7 +464,6 @@ static int psb_do_init(struct drm_device *dev)
psb_spank(dev_priv); psb_spank(dev_priv);
/* mmu_gatt ?? */ /* mmu_gatt ?? */
printk(KERN_INFO "TWOD base %08lX\n", (u32) pg->gatt_start);
PSB_WSGX32(pg->gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); PSB_WSGX32(pg->gatt_start, PSB_CR_BIF_TWOD_REQ_BASE);
return 0; return 0;
...@@ -721,18 +689,6 @@ int psb_driver_device_is_agp(struct drm_device *dev) ...@@ -721,18 +689,6 @@ int psb_driver_device_is_agp(struct drm_device *dev)
} }
static int psb_vt_leave_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
return 0;
}
static int psb_vt_enter_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
return 0;
}
static int psb_sizes_ioctl(struct drm_device *dev, void *data, static int psb_sizes_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
...@@ -840,7 +796,7 @@ static int psb_dpst_ioctl(struct drm_device *dev, void *data, ...@@ -840,7 +796,7 @@ static int psb_dpst_ioctl(struct drm_device *dev, void *data,
uint32_t reg; uint32_t reg;
if (!gma_power_begin(dev, 0)) if (!gma_power_begin(dev, 0))
return 0; return -EIO;
reg = PSB_RVDC32(PIPEASRC); reg = PSB_RVDC32(PIPEASRC);
...@@ -1368,28 +1324,13 @@ static unsigned int psb_poll(struct file *filp, ...@@ -1368,28 +1324,13 @@ static unsigned int psb_poll(struct file *filp,
return POLLIN | POLLRDNORM; return POLLIN | POLLRDNORM;
} }
/* Not sure what we will need yet - in the PVR driver this disappears into
a tangle of abstracted handlers and per process crap */
struct psb_priv {
int dummy;
};
static int psb_driver_open(struct drm_device *dev, struct drm_file *priv) static int psb_driver_open(struct drm_device *dev, struct drm_file *priv)
{ {
struct psb_priv *psb = kzalloc(sizeof(struct psb_priv), GFP_KERNEL);
if (psb == NULL)
return -ENOMEM;
priv->driver_priv = psb;
DRM_DEBUG("\n");
/*return PVRSRVOpen(dev, priv);*/
return 0; return 0;
} }
static void psb_driver_close(struct drm_device *dev, struct drm_file *priv) static void psb_driver_close(struct drm_device *dev, struct drm_file *priv)
{ {
kfree(priv->driver_priv);
priv->driver_priv = NULL;
} }
static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd, static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd,
......
...@@ -884,106 +884,3 @@ int psb_gtt_unmap_meminfo(struct drm_device *dev, void * hKernelMemInfo) ...@@ -884,106 +884,3 @@ int psb_gtt_unmap_meminfo(struct drm_device *dev, void * hKernelMemInfo)
return 0; return 0;
} }
int psb_gtt_map_meminfo_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct psb_gtt_mapping_arg *arg
= (struct psb_gtt_mapping_arg *)data;
uint32_t *offset_pages = &arg->offset_pages;
DRM_DEBUG("\n");
return psb_gtt_map_meminfo(dev, arg->hKernelMemInfo, offset_pages);
}
int psb_gtt_unmap_meminfo_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct psb_gtt_mapping_arg *arg
= (struct psb_gtt_mapping_arg *)data;
DRM_DEBUG("\n");
return psb_gtt_unmap_meminfo(dev, arg->hKernelMemInfo);
}
int psb_gtt_map_pvr_memory(struct drm_device *dev, unsigned int hHandle,
unsigned int ui32TaskId, dma_addr_t *pPages,
unsigned int ui32PagesNum, unsigned int *ui32Offset)
{
struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_gtt_mm *mm = dev_priv->gtt_mm;
struct psb_gtt *pg = dev_priv->pg;
uint32_t size, pages, offset_pages;
struct drm_mm_node *node = NULL;
struct psb_gtt_mem_mapping *mapping = NULL;
int ret;
size = ui32PagesNum * PAGE_SIZE;
pages = 0;
/*alloc memory in TT apeture*/
ret = psb_gtt_mm_alloc_mem(mm, ui32PagesNum, 0, &node);
if (ret) {
DRM_DEBUG("alloc TT memory error\n");
goto failed_pages_alloc;
}
/*update psb_gtt_mm*/
ret = psb_gtt_add_node(mm,
(u32)ui32TaskId,
(u32)hHandle,
node,
&mapping);
if (ret) {
DRM_DEBUG("add_node failed");
goto failed_add_node;
}
node = mapping->node;
offset_pages = node->start;
DRM_DEBUG("get free node for %ld pages, offset %ld pages",
pages, offset_pages);
/*update gtt*/
psb_gtt_insert_phys_addresses(pg, pPages, (unsigned)offset_pages,
(unsigned)ui32PagesNum, 0);
*ui32Offset = offset_pages;
return 0;
failed_add_node:
psb_gtt_mm_free_mem(mm, node);
failed_pages_alloc:
return ret;
}
int psb_gtt_unmap_pvr_memory(struct drm_device *dev, unsigned int hHandle,
unsigned int ui32TaskId)
{
struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_gtt_mm *mm = dev_priv->gtt_mm;
struct psb_gtt *pg = dev_priv->pg;
uint32_t pages, offset_pages;
struct drm_mm_node *node;
int ret;
ret = psb_gtt_remove_node(mm, (u32)ui32TaskId, (u32)hHandle, &node);
if (ret) {
printk(KERN_ERR "remove node failed\n");
return ret;
}
/*remove gtt entries*/
offset_pages = node->start;
pages = node->size;
psb_gtt_remove_pages(pg, offset_pages, pages, 0, 0, 1);
/*free tt node*/
psb_gtt_mm_free_mem(mm, node);
return 0;
}
...@@ -87,15 +87,4 @@ extern int psb_gtt_unmap_meminfo_ioctl(struct drm_device *dev, void *data, ...@@ -87,15 +87,4 @@ extern int psb_gtt_unmap_meminfo_ioctl(struct drm_device *dev, void *data,
extern int psb_gtt_mm_init(struct psb_gtt *pg); extern int psb_gtt_mm_init(struct psb_gtt *pg);
extern void psb_gtt_mm_takedown(void); extern void psb_gtt_mm_takedown(void);
extern int psb_gtt_map_pvr_memory(struct drm_device *dev,
unsigned int hHandle,
unsigned int ui32TaskId,
dma_addr_t *pPages,
unsigned int ui32PagesNum,
unsigned int *ui32Offset);
extern int psb_gtt_unmap_pvr_memory(struct drm_device *dev,
unsigned int hHandle,
unsigned int ui32TaskId);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment