Add stub {get,set}param ioctls.

main
Ben Skeggs 2006-08-30 16:55:02 +10:00
parent 3cfab681b3
commit 24dddc2754
4 changed files with 54 additions and 0 deletions

View File

@ -79,6 +79,18 @@ typedef struct drm_nouveau_mem_free {
}
drm_nouveau_mem_free_t;
typedef struct drm_nouveau_getparam {
unsigned int param;
unsigned int value;
}
drm_nouveau_getparam_t;
typedef struct drm_nouveau_setparam {
unsigned int param;
unsigned int value;
}
drm_nouveau_setparam_t;
enum nouveau_card_type {
NV_UNKNOWN =0,
NV_01 =1,
@ -114,6 +126,8 @@ drm_nouveau_sarea_t;
#define DRM_NOUVEAU_DMA_OBJECT_INIT 0x03 // We don't want this eventually..
#define DRM_NOUVEAU_MEM_ALLOC 0x04
#define DRM_NOUVEAU_MEM_FREE 0x05
#define DRM_NOUVEAU_GETPARAM 0x06
#define DRM_NOUVEAU_SETPARAM 0x07
#endif /* __NOUVEAU_DRM_H__ */

View File

@ -131,6 +131,8 @@ extern void nouveau_preclose(drm_device_t * dev, DRMFILE filp);
extern int nouveau_load(struct drm_device *dev, unsigned long flags);
extern int nouveau_firstopen(struct drm_device *dev);
extern int nouveau_unload(struct drm_device *dev);
extern int nouveau_ioctl_getparam(DRM_IOCTL_ARGS);
extern int nouveau_ioctl_setparam(DRM_IOCTL_ARGS);
/* nouveau_mem.c */
extern uint64_t nouveau_mem_fb_amount(struct drm_device *dev);

View File

@ -263,6 +263,8 @@ drm_ioctl_desc_t nouveau_ioctls[] = {
[DRM_IOCTL_NR(DRM_NOUVEAU_DMA_OBJECT_INIT)] = {nouveau_ioctl_dma_object_init, DRM_AUTH},
[DRM_IOCTL_NR(DRM_NOUVEAU_MEM_ALLOC)] = {nouveau_ioctl_mem_alloc, DRM_AUTH},
[DRM_IOCTL_NR(DRM_NOUVEAU_MEM_FREE)] = {nouveau_ioctl_mem_free, DRM_AUTH},
[DRM_IOCTL_NR(DRM_NOUVEAU_GETPARAM)] = {nouveau_ioctl_getparam, DRM_AUTH},
[DRM_IOCTL_NR(DRM_NOUVEAU_SETPARAM)] = {nouveau_ioctl_setparam, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
};
int nouveau_max_ioctl = DRM_ARRAY_SIZE(nouveau_ioctls);

View File

@ -132,3 +132,39 @@ int nouveau_unload(struct drm_device *dev)
return 0;
}
int nouveau_ioctl_getparam(DRM_IOCTL_ARGS)
{
DRM_DEVICE;
drm_nouveau_getparam_t getparam;
DRM_COPY_FROM_USER_IOCTL(getparam, (drm_nouveau_getparam_t __user *)data,
sizeof(getparam));
switch (getparam.param) {
default:
DRM_ERROR("unknown parameter %d\n", getparam.param);
return DRM_ERR(EINVAL);
}
DRM_COPY_TO_USER_IOCTL((drm_nouveau_getparam_t __user *)data, getparam,
sizeof(getparam));
return 0;
}
int nouveau_ioctl_setparam(DRM_IOCTL_ARGS)
{
DRM_DEVICE;
drm_nouveau_setparam_t setparam;
DRM_COPY_FROM_USER_IOCTL(setparam, (drm_nouveau_setparam_t __user *)data,
sizeof(setparam));
switch (setparam.param) {
default:
DRM_ERROR("unknown parameter %d\n", setparam.param);
return DRM_ERR(EINVAL);
}
return 0;
}