From 7af9d670371de868f0642148fe2d594bc9a7dea3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 26 Jun 2007 13:05:29 -0700 Subject: Initial XP10 code drop from XGI. See attachment 10246 on https://bugs.freedesktop.org/show_bug.cgi?id=5921 --- linux-core/xgi_drv.h | 364 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 364 insertions(+) create mode 100644 linux-core/xgi_drv.h (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h new file mode 100644 index 00000000..568a7af1 --- /dev/null +++ b/linux-core/xgi_drv.h @@ -0,0 +1,364 @@ + +/**************************************************************************** + * Copyright (C) 2003-2006 by XGI Technology, Taiwan. + * * + * 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 on 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: + * * + * 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL XGI AND/OR + * ITS SUPPLIERS 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. + ***************************************************************************/ + +#ifndef _XGI_DRV_H_ +#define _XGI_DRV_H_ + +#define XGI_MAJOR_VERSION 0 +#define XGI_MINOR_VERSION 7 +#define XGI_PATCHLEVEL 5 + +#define XGI_DRV_VERSION "0.7.5" + +#ifndef XGI_DRV_NAME +#define XGI_DRV_NAME "xgi" +#endif + +/* + * xgi reserved major device number, Set this to 0 to + * request dynamic major number allocation. + */ +#ifndef XGI_DEV_MAJOR +#define XGI_DEV_MAJOR 0 +#endif + +#ifndef XGI_MAX_DEVICES +#define XGI_MAX_DEVICES 1 +#endif + +/* Jong 06/06/2006 */ +/* #define XGI_DEBUG */ + +#ifndef PCI_VENDOR_ID_XGI +/* +#define PCI_VENDOR_ID_XGI 0x1023 +*/ +#define PCI_VENDOR_ID_XGI 0x18CA + +#endif + +#ifndef PCI_DEVICE_ID_XP5 +#define PCI_DEVICE_ID_XP5 0x2200 +#endif + +#ifndef PCI_DEVICE_ID_XG47 +#define PCI_DEVICE_ID_XG47 0x0047 +#endif + +/* Macros to make printk easier */ +#define XGI_ERROR(fmt, arg...) \ + printk(KERN_ERR "[" XGI_DRV_NAME ":%s] *ERROR* " fmt, __FUNCTION__, ##arg) + +#define XGI_MEM_ERROR(area, fmt, arg...) \ + printk(KERN_ERR "[" XGI_DRV_NAME ":%s] *ERROR* " fmt, __FUNCTION__, ##arg) + +/* #define XGI_DEBUG */ + +#ifdef XGI_DEBUG +#define XGI_INFO(fmt, arg...) \ + printk(KERN_ALERT "[" XGI_DRV_NAME ":%s] " fmt, __FUNCTION__, ##arg) +/* printk(KERN_INFO "[" XGI_DRV_NAME ":%s] " fmt, __FUNCTION__, ##arg) */ +#else +#define XGI_INFO(fmt, arg...) do { } while (0) +#endif + +/* device name length; must be atleast 8 */ +#define XGI_DEVICE_NAME_LENGTH 40 + +/* need a fake device number for control device; just to flag it for msgs */ +#define XGI_CONTROL_DEVICE_NUMBER 100 + +typedef struct { + U32 base; // pcie base is different from fb base + U32 size; + U8 *vbase; +} xgi_aperture_t; + +typedef struct xgi_screen_info_s { + U32 scrn_start; + U32 scrn_xres; + U32 scrn_yres; + U32 scrn_bpp; + U32 scrn_pitch; +} xgi_screen_info_t; + +typedef struct xgi_sarea_info_s { + U32 bus_addr; + U32 size; +} xgi_sarea_info_t; + +typedef struct xgi_info_s { + struct pci_dev *dev; + int flags; + int device_number; + int bus; /* PCI config info */ + int slot; + int vendor_id; + U32 device_id; + U8 revision_id; + + /* physical characteristics */ + xgi_aperture_t mmio; + xgi_aperture_t fb; + xgi_aperture_t pcie; + xgi_screen_info_t scrn_info; + xgi_sarea_info_t sarea_info; + + /* look up table parameters */ + U32 *lut_base; + U32 lutPageSize; + U32 lutPageOrder; + U32 isLUTInLFB; + U32 sdfbPageSize; + + U32 pcie_config; + U32 pcie_status; + U32 irq; + + atomic_t use_count; + + /* keep track of any pending bottom halfes */ + struct tasklet_struct tasklet; + + spinlock_t info_lock; + + struct semaphore info_sem; + struct semaphore fb_sem; + struct semaphore pcie_sem; +} xgi_info_t; + +typedef struct xgi_ioctl_post_vbios { + U32 bus; + U32 slot; +} xgi_ioctl_post_vbios_t; + +typedef enum xgi_mem_location_s +{ + NON_LOCAL = 0, + LOCAL = 1, + INVALID = 0x7fffffff +} xgi_mem_location_t; + +enum PcieOwner +{ + PCIE_2D = 0, + /* + PCIE_3D should not begin with 1, + 2D alloc pcie memory will use owner 1. + */ + PCIE_3D = 11,/*vetex buf*/ + PCIE_3D_CMDLIST = 12, + PCIE_3D_SCRATCHPAD = 13, + PCIE_3D_TEXTURE = 14, + PCIE_INVALID = 0x7fffffff +}; + +typedef struct xgi_mem_req_s { + xgi_mem_location_t location; + unsigned long size; + unsigned long is_front; + enum PcieOwner owner; + unsigned long pid; +} xgi_mem_req_t; + +typedef struct xgi_mem_alloc_s { + xgi_mem_location_t location; + unsigned long size; + unsigned long bus_addr; + unsigned long hw_addr; + unsigned long pid; +} xgi_mem_alloc_t; + +typedef struct xgi_chip_info_s { + U32 device_id; + char device_name[32]; + U32 vendor_id; + U32 curr_display_mode; //Singe, DualView(Contained), MHS + U32 fb_size; + U32 sarea_bus_addr; + U32 sarea_size; +} xgi_chip_info_t; + +typedef struct xgi_opengl_cmd_s { + U32 cmd; +} xgi_opengl_cmd_t; + +typedef struct xgi_mmio_info_s { + xgi_opengl_cmd_t cmd_head; + void *mmioBase; + int size; +} xgi_mmio_info_t; + +typedef enum { + BTYPE_2D = 0, + BTYPE_3D = 1, + BTYPE_FLIP = 2, + BTYPE_CTRL = 3, + BTYPE_NONE = 0x7fffffff +}BATCH_TYPE; + +typedef struct xgi_cmd_info_s { + BATCH_TYPE _firstBeginType; + U32 _firstBeginAddr; + U32 _firstSize; + U32 _curDebugID; + U32 _lastBeginAddr; + U32 _beginCount; +} xgi_cmd_info_t; + +typedef struct xgi_state_info_s { + U32 _fromState; + U32 _toState; +} xgi_state_info_t; + +typedef struct cpu_info_s { + U32 _eax; + U32 _ebx; + U32 _ecx; + U32 _edx; +} cpu_info_t; + +typedef struct xgi_mem_pid_s { + struct list_head list; + xgi_mem_location_t location; + unsigned long bus_addr; + unsigned long pid; +} xgi_mem_pid_t; + +/* + * Ioctl definitions + */ + +#define XGI_IOCTL_MAGIC 'x' /* use 'x' as magic number */ + +#define XGI_IOCTL_BASE 0 +#define XGI_ESC_DEVICE_INFO (XGI_IOCTL_BASE + 0) +#define XGI_ESC_POST_VBIOS (XGI_IOCTL_BASE + 1) + +#define XGI_ESC_FB_INIT (XGI_IOCTL_BASE + 2) +#define XGI_ESC_FB_ALLOC (XGI_IOCTL_BASE + 3) +#define XGI_ESC_FB_FREE (XGI_IOCTL_BASE + 4) +#define XGI_ESC_PCIE_INIT (XGI_IOCTL_BASE + 5) +#define XGI_ESC_PCIE_ALLOC (XGI_IOCTL_BASE + 6) +#define XGI_ESC_PCIE_FREE (XGI_IOCTL_BASE + 7) +#define XGI_ESC_SUBMIT_CMDLIST (XGI_IOCTL_BASE + 8) +#define XGI_ESC_PUT_SCREEN_INFO (XGI_IOCTL_BASE + 9) +#define XGI_ESC_GET_SCREEN_INFO (XGI_IOCTL_BASE + 10) +#define XGI_ESC_GE_RESET (XGI_IOCTL_BASE + 11) +#define XGI_ESC_SAREA_INFO (XGI_IOCTL_BASE + 12) +#define XGI_ESC_DUMP_REGISTER (XGI_IOCTL_BASE + 13) +#define XGI_ESC_DEBUG_INFO (XGI_IOCTL_BASE + 14) +#define XGI_ESC_TEST_RWINKERNEL (XGI_IOCTL_BASE + 16) +#define XGI_ESC_STATE_CHANGE (XGI_IOCTL_BASE + 17) +#define XGI_ESC_MMIO_INFO (XGI_IOCTL_BASE + 18) +#define XGI_ESC_PCIE_CHECK (XGI_IOCTL_BASE + 19) +#define XGI_ESC_CPUID (XGI_IOCTL_BASE + 20) +#define XGI_ESC_MEM_COLLECT (XGI_IOCTL_BASE + 21) + +#define XGI_IOCTL_DEVICE_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_DEVICE_INFO, xgi_chip_info_t) +#define XGI_IOCTL_POST_VBIOS _IO(XGI_IOCTL_MAGIC, XGI_ESC_POST_VBIOS) + +#define XGI_IOCTL_FB_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_FB_INIT) +#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, xgi_mem_req_t) +#define XGI_IOCTL_FB_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_FB_FREE, unsigned long) + +#define XGI_IOCTL_PCIE_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_INIT) +#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, xgi_mem_req_t) +#define XGI_IOCTL_PCIE_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_FREE, unsigned long) + +#define XGI_IOCTL_PUT_SCREEN_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PUT_SCREEN_INFO, xgi_screen_info_t) +#define XGI_IOCTL_GET_SCREEN_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_GET_SCREEN_INFO, xgi_screen_info_t) + +#define XGI_IOCTL_GE_RESET _IO(XGI_IOCTL_MAGIC, XGI_ESC_GE_RESET) +#define XGI_IOCTL_SAREA_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_SAREA_INFO, xgi_sarea_info_t) +#define XGI_IOCTL_DUMP_REGISTER _IO(XGI_IOCTL_MAGIC, XGI_ESC_DUMP_REGISTER) +#define XGI_IOCTL_DEBUG_INFO _IO(XGI_IOCTL_MAGIC, XGI_ESC_DEBUG_INFO) +#define XGI_IOCTL_MMIO_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_MMIO_INFO, xgi_mmio_info_t) + +#define XGI_IOCTL_SUBMIT_CMDLIST _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_SUBMIT_CMDLIST, xgi_cmd_info_t) +#define XGI_IOCTL_TEST_RWINKERNEL _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_TEST_RWINKERNEL, unsigned long) +#define XGI_IOCTL_STATE_CHANGE _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_STATE_CHANGE, xgi_state_info_t) + +#define XGI_IOCTL_PCIE_CHECK _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_CHECK) +#define XGI_IOCTL_CPUID _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_CPUID, cpu_info_t) +#define XGI_IOCTL_MAXNR 30 + +/* + * flags + */ +#define XGI_FLAG_OPEN 0x0001 +#define XGI_FLAG_NEEDS_POSTING 0x0002 +#define XGI_FLAG_WAS_POSTED 0x0004 +#define XGI_FLAG_CONTROL 0x0010 +#define XGI_FLAG_MAP_REGS_EARLY 0x0200 + +/* mmap(2) offsets */ + +#define IS_IO_OFFSET(info, offset, length) \ + (((offset) >= (info)->mmio.base) \ + && (((offset) + (length)) <= (info)->mmio.base + (info)->mmio.size)) + +/* Jong 06/14/2006 */ +/* (info)->fb.base is a base address for physical (bus) address space */ +/* what's the definition of offest? on physical (bus) address space or HW address space */ +/* Jong 06/15/2006; use HW address space */ +#define IS_FB_OFFSET(info, offset, length) \ + (((offset) >= 0) \ + && (((offset) + (length)) <= (info)->fb.size)) +#if 0 +#define IS_FB_OFFSET(info, offset, length) \ + (((offset) >= (info)->fb.base) \ + && (((offset) + (length)) <= (info)->fb.base + (info)->fb.size)) +#endif + +#define IS_PCIE_OFFSET(info, offset, length) \ + (((offset) >= (info)->pcie.base) \ + && (((offset) + (length)) <= (info)->pcie.base + (info)->pcie.size)) + +extern int xgi_fb_heap_init(xgi_info_t *info); +extern void xgi_fb_heap_cleanup(xgi_info_t *info); + +extern void xgi_fb_alloc(xgi_info_t *info, xgi_mem_req_t *req, xgi_mem_alloc_t *alloc); +extern void xgi_fb_free(xgi_info_t *info, unsigned long offset); +extern void xgi_mem_collect(xgi_info_t *info, unsigned int *pcnt); + +extern int xgi_pcie_heap_init(xgi_info_t *info); +extern void xgi_pcie_heap_cleanup(xgi_info_t *info); + +extern void xgi_pcie_alloc(xgi_info_t *info, unsigned long size, enum PcieOwner owner, xgi_mem_alloc_t *alloc); +extern void xgi_pcie_free(xgi_info_t *info, unsigned long offset); +extern void xgi_pcie_heap_check(void); +extern void *xgi_find_pcie_block(xgi_info_t *info, unsigned long address); +extern void *xgi_find_pcie_virt(xgi_info_t *info, unsigned long address); + +extern void xgi_read_pcie_mem(xgi_info_t *info, xgi_mem_req_t *req); +extern void xgi_write_pcie_mem(xgi_info_t *info, xgi_mem_req_t *req); + +extern void xgi_test_rwinkernel(xgi_info_t *info, unsigned long address); + +#endif -- cgit v1.2.3 From 434657a2582362367ba2a94f827511252001368f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 26 Jun 2007 13:10:30 -0700 Subject: dos2unix and Lindent --- linux-core/xgi_drv.h | 728 +++++++++++++++++++++++++-------------------------- 1 file changed, 364 insertions(+), 364 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 568a7af1..429719a7 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -1,364 +1,364 @@ - -/**************************************************************************** - * Copyright (C) 2003-2006 by XGI Technology, Taiwan. - * * - * 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 on 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: - * * - * 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL XGI AND/OR - * ITS SUPPLIERS 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. - ***************************************************************************/ - -#ifndef _XGI_DRV_H_ -#define _XGI_DRV_H_ - -#define XGI_MAJOR_VERSION 0 -#define XGI_MINOR_VERSION 7 -#define XGI_PATCHLEVEL 5 - -#define XGI_DRV_VERSION "0.7.5" - -#ifndef XGI_DRV_NAME -#define XGI_DRV_NAME "xgi" -#endif - -/* - * xgi reserved major device number, Set this to 0 to - * request dynamic major number allocation. - */ -#ifndef XGI_DEV_MAJOR -#define XGI_DEV_MAJOR 0 -#endif - -#ifndef XGI_MAX_DEVICES -#define XGI_MAX_DEVICES 1 -#endif - -/* Jong 06/06/2006 */ -/* #define XGI_DEBUG */ - -#ifndef PCI_VENDOR_ID_XGI -/* -#define PCI_VENDOR_ID_XGI 0x1023 -*/ -#define PCI_VENDOR_ID_XGI 0x18CA - -#endif - -#ifndef PCI_DEVICE_ID_XP5 -#define PCI_DEVICE_ID_XP5 0x2200 -#endif - -#ifndef PCI_DEVICE_ID_XG47 -#define PCI_DEVICE_ID_XG47 0x0047 -#endif - -/* Macros to make printk easier */ -#define XGI_ERROR(fmt, arg...) \ - printk(KERN_ERR "[" XGI_DRV_NAME ":%s] *ERROR* " fmt, __FUNCTION__, ##arg) - -#define XGI_MEM_ERROR(area, fmt, arg...) \ - printk(KERN_ERR "[" XGI_DRV_NAME ":%s] *ERROR* " fmt, __FUNCTION__, ##arg) - -/* #define XGI_DEBUG */ - -#ifdef XGI_DEBUG -#define XGI_INFO(fmt, arg...) \ - printk(KERN_ALERT "[" XGI_DRV_NAME ":%s] " fmt, __FUNCTION__, ##arg) -/* printk(KERN_INFO "[" XGI_DRV_NAME ":%s] " fmt, __FUNCTION__, ##arg) */ -#else -#define XGI_INFO(fmt, arg...) do { } while (0) -#endif - -/* device name length; must be atleast 8 */ -#define XGI_DEVICE_NAME_LENGTH 40 - -/* need a fake device number for control device; just to flag it for msgs */ -#define XGI_CONTROL_DEVICE_NUMBER 100 - -typedef struct { - U32 base; // pcie base is different from fb base - U32 size; - U8 *vbase; -} xgi_aperture_t; - -typedef struct xgi_screen_info_s { - U32 scrn_start; - U32 scrn_xres; - U32 scrn_yres; - U32 scrn_bpp; - U32 scrn_pitch; -} xgi_screen_info_t; - -typedef struct xgi_sarea_info_s { - U32 bus_addr; - U32 size; -} xgi_sarea_info_t; - -typedef struct xgi_info_s { - struct pci_dev *dev; - int flags; - int device_number; - int bus; /* PCI config info */ - int slot; - int vendor_id; - U32 device_id; - U8 revision_id; - - /* physical characteristics */ - xgi_aperture_t mmio; - xgi_aperture_t fb; - xgi_aperture_t pcie; - xgi_screen_info_t scrn_info; - xgi_sarea_info_t sarea_info; - - /* look up table parameters */ - U32 *lut_base; - U32 lutPageSize; - U32 lutPageOrder; - U32 isLUTInLFB; - U32 sdfbPageSize; - - U32 pcie_config; - U32 pcie_status; - U32 irq; - - atomic_t use_count; - - /* keep track of any pending bottom halfes */ - struct tasklet_struct tasklet; - - spinlock_t info_lock; - - struct semaphore info_sem; - struct semaphore fb_sem; - struct semaphore pcie_sem; -} xgi_info_t; - -typedef struct xgi_ioctl_post_vbios { - U32 bus; - U32 slot; -} xgi_ioctl_post_vbios_t; - -typedef enum xgi_mem_location_s -{ - NON_LOCAL = 0, - LOCAL = 1, - INVALID = 0x7fffffff -} xgi_mem_location_t; - -enum PcieOwner -{ - PCIE_2D = 0, - /* - PCIE_3D should not begin with 1, - 2D alloc pcie memory will use owner 1. - */ - PCIE_3D = 11,/*vetex buf*/ - PCIE_3D_CMDLIST = 12, - PCIE_3D_SCRATCHPAD = 13, - PCIE_3D_TEXTURE = 14, - PCIE_INVALID = 0x7fffffff -}; - -typedef struct xgi_mem_req_s { - xgi_mem_location_t location; - unsigned long size; - unsigned long is_front; - enum PcieOwner owner; - unsigned long pid; -} xgi_mem_req_t; - -typedef struct xgi_mem_alloc_s { - xgi_mem_location_t location; - unsigned long size; - unsigned long bus_addr; - unsigned long hw_addr; - unsigned long pid; -} xgi_mem_alloc_t; - -typedef struct xgi_chip_info_s { - U32 device_id; - char device_name[32]; - U32 vendor_id; - U32 curr_display_mode; //Singe, DualView(Contained), MHS - U32 fb_size; - U32 sarea_bus_addr; - U32 sarea_size; -} xgi_chip_info_t; - -typedef struct xgi_opengl_cmd_s { - U32 cmd; -} xgi_opengl_cmd_t; - -typedef struct xgi_mmio_info_s { - xgi_opengl_cmd_t cmd_head; - void *mmioBase; - int size; -} xgi_mmio_info_t; - -typedef enum { - BTYPE_2D = 0, - BTYPE_3D = 1, - BTYPE_FLIP = 2, - BTYPE_CTRL = 3, - BTYPE_NONE = 0x7fffffff -}BATCH_TYPE; - -typedef struct xgi_cmd_info_s { - BATCH_TYPE _firstBeginType; - U32 _firstBeginAddr; - U32 _firstSize; - U32 _curDebugID; - U32 _lastBeginAddr; - U32 _beginCount; -} xgi_cmd_info_t; - -typedef struct xgi_state_info_s { - U32 _fromState; - U32 _toState; -} xgi_state_info_t; - -typedef struct cpu_info_s { - U32 _eax; - U32 _ebx; - U32 _ecx; - U32 _edx; -} cpu_info_t; - -typedef struct xgi_mem_pid_s { - struct list_head list; - xgi_mem_location_t location; - unsigned long bus_addr; - unsigned long pid; -} xgi_mem_pid_t; - -/* - * Ioctl definitions - */ - -#define XGI_IOCTL_MAGIC 'x' /* use 'x' as magic number */ - -#define XGI_IOCTL_BASE 0 -#define XGI_ESC_DEVICE_INFO (XGI_IOCTL_BASE + 0) -#define XGI_ESC_POST_VBIOS (XGI_IOCTL_BASE + 1) - -#define XGI_ESC_FB_INIT (XGI_IOCTL_BASE + 2) -#define XGI_ESC_FB_ALLOC (XGI_IOCTL_BASE + 3) -#define XGI_ESC_FB_FREE (XGI_IOCTL_BASE + 4) -#define XGI_ESC_PCIE_INIT (XGI_IOCTL_BASE + 5) -#define XGI_ESC_PCIE_ALLOC (XGI_IOCTL_BASE + 6) -#define XGI_ESC_PCIE_FREE (XGI_IOCTL_BASE + 7) -#define XGI_ESC_SUBMIT_CMDLIST (XGI_IOCTL_BASE + 8) -#define XGI_ESC_PUT_SCREEN_INFO (XGI_IOCTL_BASE + 9) -#define XGI_ESC_GET_SCREEN_INFO (XGI_IOCTL_BASE + 10) -#define XGI_ESC_GE_RESET (XGI_IOCTL_BASE + 11) -#define XGI_ESC_SAREA_INFO (XGI_IOCTL_BASE + 12) -#define XGI_ESC_DUMP_REGISTER (XGI_IOCTL_BASE + 13) -#define XGI_ESC_DEBUG_INFO (XGI_IOCTL_BASE + 14) -#define XGI_ESC_TEST_RWINKERNEL (XGI_IOCTL_BASE + 16) -#define XGI_ESC_STATE_CHANGE (XGI_IOCTL_BASE + 17) -#define XGI_ESC_MMIO_INFO (XGI_IOCTL_BASE + 18) -#define XGI_ESC_PCIE_CHECK (XGI_IOCTL_BASE + 19) -#define XGI_ESC_CPUID (XGI_IOCTL_BASE + 20) -#define XGI_ESC_MEM_COLLECT (XGI_IOCTL_BASE + 21) - -#define XGI_IOCTL_DEVICE_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_DEVICE_INFO, xgi_chip_info_t) -#define XGI_IOCTL_POST_VBIOS _IO(XGI_IOCTL_MAGIC, XGI_ESC_POST_VBIOS) - -#define XGI_IOCTL_FB_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_FB_INIT) -#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, xgi_mem_req_t) -#define XGI_IOCTL_FB_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_FB_FREE, unsigned long) - -#define XGI_IOCTL_PCIE_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_INIT) -#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, xgi_mem_req_t) -#define XGI_IOCTL_PCIE_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_FREE, unsigned long) - -#define XGI_IOCTL_PUT_SCREEN_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PUT_SCREEN_INFO, xgi_screen_info_t) -#define XGI_IOCTL_GET_SCREEN_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_GET_SCREEN_INFO, xgi_screen_info_t) - -#define XGI_IOCTL_GE_RESET _IO(XGI_IOCTL_MAGIC, XGI_ESC_GE_RESET) -#define XGI_IOCTL_SAREA_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_SAREA_INFO, xgi_sarea_info_t) -#define XGI_IOCTL_DUMP_REGISTER _IO(XGI_IOCTL_MAGIC, XGI_ESC_DUMP_REGISTER) -#define XGI_IOCTL_DEBUG_INFO _IO(XGI_IOCTL_MAGIC, XGI_ESC_DEBUG_INFO) -#define XGI_IOCTL_MMIO_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_MMIO_INFO, xgi_mmio_info_t) - -#define XGI_IOCTL_SUBMIT_CMDLIST _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_SUBMIT_CMDLIST, xgi_cmd_info_t) -#define XGI_IOCTL_TEST_RWINKERNEL _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_TEST_RWINKERNEL, unsigned long) -#define XGI_IOCTL_STATE_CHANGE _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_STATE_CHANGE, xgi_state_info_t) - -#define XGI_IOCTL_PCIE_CHECK _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_CHECK) -#define XGI_IOCTL_CPUID _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_CPUID, cpu_info_t) -#define XGI_IOCTL_MAXNR 30 - -/* - * flags - */ -#define XGI_FLAG_OPEN 0x0001 -#define XGI_FLAG_NEEDS_POSTING 0x0002 -#define XGI_FLAG_WAS_POSTED 0x0004 -#define XGI_FLAG_CONTROL 0x0010 -#define XGI_FLAG_MAP_REGS_EARLY 0x0200 - -/* mmap(2) offsets */ - -#define IS_IO_OFFSET(info, offset, length) \ - (((offset) >= (info)->mmio.base) \ - && (((offset) + (length)) <= (info)->mmio.base + (info)->mmio.size)) - -/* Jong 06/14/2006 */ -/* (info)->fb.base is a base address for physical (bus) address space */ -/* what's the definition of offest? on physical (bus) address space or HW address space */ -/* Jong 06/15/2006; use HW address space */ -#define IS_FB_OFFSET(info, offset, length) \ - (((offset) >= 0) \ - && (((offset) + (length)) <= (info)->fb.size)) -#if 0 -#define IS_FB_OFFSET(info, offset, length) \ - (((offset) >= (info)->fb.base) \ - && (((offset) + (length)) <= (info)->fb.base + (info)->fb.size)) -#endif - -#define IS_PCIE_OFFSET(info, offset, length) \ - (((offset) >= (info)->pcie.base) \ - && (((offset) + (length)) <= (info)->pcie.base + (info)->pcie.size)) - -extern int xgi_fb_heap_init(xgi_info_t *info); -extern void xgi_fb_heap_cleanup(xgi_info_t *info); - -extern void xgi_fb_alloc(xgi_info_t *info, xgi_mem_req_t *req, xgi_mem_alloc_t *alloc); -extern void xgi_fb_free(xgi_info_t *info, unsigned long offset); -extern void xgi_mem_collect(xgi_info_t *info, unsigned int *pcnt); - -extern int xgi_pcie_heap_init(xgi_info_t *info); -extern void xgi_pcie_heap_cleanup(xgi_info_t *info); - -extern void xgi_pcie_alloc(xgi_info_t *info, unsigned long size, enum PcieOwner owner, xgi_mem_alloc_t *alloc); -extern void xgi_pcie_free(xgi_info_t *info, unsigned long offset); -extern void xgi_pcie_heap_check(void); -extern void *xgi_find_pcie_block(xgi_info_t *info, unsigned long address); -extern void *xgi_find_pcie_virt(xgi_info_t *info, unsigned long address); - -extern void xgi_read_pcie_mem(xgi_info_t *info, xgi_mem_req_t *req); -extern void xgi_write_pcie_mem(xgi_info_t *info, xgi_mem_req_t *req); - -extern void xgi_test_rwinkernel(xgi_info_t *info, unsigned long address); - -#endif + +/**************************************************************************** + * Copyright (C) 2003-2006 by XGI Technology, Taiwan. + * * + * 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 on 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: + * * + * 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL XGI AND/OR + * ITS SUPPLIERS 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. + ***************************************************************************/ + +#ifndef _XGI_DRV_H_ +#define _XGI_DRV_H_ + +#define XGI_MAJOR_VERSION 0 +#define XGI_MINOR_VERSION 7 +#define XGI_PATCHLEVEL 5 + +#define XGI_DRV_VERSION "0.7.5" + +#ifndef XGI_DRV_NAME +#define XGI_DRV_NAME "xgi" +#endif + +/* + * xgi reserved major device number, Set this to 0 to + * request dynamic major number allocation. + */ +#ifndef XGI_DEV_MAJOR +#define XGI_DEV_MAJOR 0 +#endif + +#ifndef XGI_MAX_DEVICES +#define XGI_MAX_DEVICES 1 +#endif + +/* Jong 06/06/2006 */ +/* #define XGI_DEBUG */ + +#ifndef PCI_VENDOR_ID_XGI +/* +#define PCI_VENDOR_ID_XGI 0x1023 +*/ +#define PCI_VENDOR_ID_XGI 0x18CA + +#endif + +#ifndef PCI_DEVICE_ID_XP5 +#define PCI_DEVICE_ID_XP5 0x2200 +#endif + +#ifndef PCI_DEVICE_ID_XG47 +#define PCI_DEVICE_ID_XG47 0x0047 +#endif + +/* Macros to make printk easier */ +#define XGI_ERROR(fmt, arg...) \ + printk(KERN_ERR "[" XGI_DRV_NAME ":%s] *ERROR* " fmt, __FUNCTION__, ##arg) + +#define XGI_MEM_ERROR(area, fmt, arg...) \ + printk(KERN_ERR "[" XGI_DRV_NAME ":%s] *ERROR* " fmt, __FUNCTION__, ##arg) + +/* #define XGI_DEBUG */ + +#ifdef XGI_DEBUG +#define XGI_INFO(fmt, arg...) \ + printk(KERN_ALERT "[" XGI_DRV_NAME ":%s] " fmt, __FUNCTION__, ##arg) +/* printk(KERN_INFO "[" XGI_DRV_NAME ":%s] " fmt, __FUNCTION__, ##arg) */ +#else +#define XGI_INFO(fmt, arg...) do { } while (0) +#endif + +/* device name length; must be atleast 8 */ +#define XGI_DEVICE_NAME_LENGTH 40 + +/* need a fake device number for control device; just to flag it for msgs */ +#define XGI_CONTROL_DEVICE_NUMBER 100 + +typedef struct { + U32 base; // pcie base is different from fb base + U32 size; + U8 *vbase; +} xgi_aperture_t; + +typedef struct xgi_screen_info_s { + U32 scrn_start; + U32 scrn_xres; + U32 scrn_yres; + U32 scrn_bpp; + U32 scrn_pitch; +} xgi_screen_info_t; + +typedef struct xgi_sarea_info_s { + U32 bus_addr; + U32 size; +} xgi_sarea_info_t; + +typedef struct xgi_info_s { + struct pci_dev *dev; + int flags; + int device_number; + int bus; /* PCI config info */ + int slot; + int vendor_id; + U32 device_id; + U8 revision_id; + + /* physical characteristics */ + xgi_aperture_t mmio; + xgi_aperture_t fb; + xgi_aperture_t pcie; + xgi_screen_info_t scrn_info; + xgi_sarea_info_t sarea_info; + + /* look up table parameters */ + U32 *lut_base; + U32 lutPageSize; + U32 lutPageOrder; + U32 isLUTInLFB; + U32 sdfbPageSize; + + U32 pcie_config; + U32 pcie_status; + U32 irq; + + atomic_t use_count; + + /* keep track of any pending bottom halfes */ + struct tasklet_struct tasklet; + + spinlock_t info_lock; + + struct semaphore info_sem; + struct semaphore fb_sem; + struct semaphore pcie_sem; +} xgi_info_t; + +typedef struct xgi_ioctl_post_vbios { + U32 bus; + U32 slot; +} xgi_ioctl_post_vbios_t; + +typedef enum xgi_mem_location_s { + NON_LOCAL = 0, + LOCAL = 1, + INVALID = 0x7fffffff +} xgi_mem_location_t; + +enum PcieOwner { + PCIE_2D = 0, + /* + PCIE_3D should not begin with 1, + 2D alloc pcie memory will use owner 1. + */ + PCIE_3D = 11, /*vetex buf */ + PCIE_3D_CMDLIST = 12, + PCIE_3D_SCRATCHPAD = 13, + PCIE_3D_TEXTURE = 14, + PCIE_INVALID = 0x7fffffff +}; + +typedef struct xgi_mem_req_s { + xgi_mem_location_t location; + unsigned long size; + unsigned long is_front; + enum PcieOwner owner; + unsigned long pid; +} xgi_mem_req_t; + +typedef struct xgi_mem_alloc_s { + xgi_mem_location_t location; + unsigned long size; + unsigned long bus_addr; + unsigned long hw_addr; + unsigned long pid; +} xgi_mem_alloc_t; + +typedef struct xgi_chip_info_s { + U32 device_id; + char device_name[32]; + U32 vendor_id; + U32 curr_display_mode; //Singe, DualView(Contained), MHS + U32 fb_size; + U32 sarea_bus_addr; + U32 sarea_size; +} xgi_chip_info_t; + +typedef struct xgi_opengl_cmd_s { + U32 cmd; +} xgi_opengl_cmd_t; + +typedef struct xgi_mmio_info_s { + xgi_opengl_cmd_t cmd_head; + void *mmioBase; + int size; +} xgi_mmio_info_t; + +typedef enum { + BTYPE_2D = 0, + BTYPE_3D = 1, + BTYPE_FLIP = 2, + BTYPE_CTRL = 3, + BTYPE_NONE = 0x7fffffff +} BATCH_TYPE; + +typedef struct xgi_cmd_info_s { + BATCH_TYPE _firstBeginType; + U32 _firstBeginAddr; + U32 _firstSize; + U32 _curDebugID; + U32 _lastBeginAddr; + U32 _beginCount; +} xgi_cmd_info_t; + +typedef struct xgi_state_info_s { + U32 _fromState; + U32 _toState; +} xgi_state_info_t; + +typedef struct cpu_info_s { + U32 _eax; + U32 _ebx; + U32 _ecx; + U32 _edx; +} cpu_info_t; + +typedef struct xgi_mem_pid_s { + struct list_head list; + xgi_mem_location_t location; + unsigned long bus_addr; + unsigned long pid; +} xgi_mem_pid_t; + +/* + * Ioctl definitions + */ + +#define XGI_IOCTL_MAGIC 'x' /* use 'x' as magic number */ + +#define XGI_IOCTL_BASE 0 +#define XGI_ESC_DEVICE_INFO (XGI_IOCTL_BASE + 0) +#define XGI_ESC_POST_VBIOS (XGI_IOCTL_BASE + 1) + +#define XGI_ESC_FB_INIT (XGI_IOCTL_BASE + 2) +#define XGI_ESC_FB_ALLOC (XGI_IOCTL_BASE + 3) +#define XGI_ESC_FB_FREE (XGI_IOCTL_BASE + 4) +#define XGI_ESC_PCIE_INIT (XGI_IOCTL_BASE + 5) +#define XGI_ESC_PCIE_ALLOC (XGI_IOCTL_BASE + 6) +#define XGI_ESC_PCIE_FREE (XGI_IOCTL_BASE + 7) +#define XGI_ESC_SUBMIT_CMDLIST (XGI_IOCTL_BASE + 8) +#define XGI_ESC_PUT_SCREEN_INFO (XGI_IOCTL_BASE + 9) +#define XGI_ESC_GET_SCREEN_INFO (XGI_IOCTL_BASE + 10) +#define XGI_ESC_GE_RESET (XGI_IOCTL_BASE + 11) +#define XGI_ESC_SAREA_INFO (XGI_IOCTL_BASE + 12) +#define XGI_ESC_DUMP_REGISTER (XGI_IOCTL_BASE + 13) +#define XGI_ESC_DEBUG_INFO (XGI_IOCTL_BASE + 14) +#define XGI_ESC_TEST_RWINKERNEL (XGI_IOCTL_BASE + 16) +#define XGI_ESC_STATE_CHANGE (XGI_IOCTL_BASE + 17) +#define XGI_ESC_MMIO_INFO (XGI_IOCTL_BASE + 18) +#define XGI_ESC_PCIE_CHECK (XGI_IOCTL_BASE + 19) +#define XGI_ESC_CPUID (XGI_IOCTL_BASE + 20) +#define XGI_ESC_MEM_COLLECT (XGI_IOCTL_BASE + 21) + +#define XGI_IOCTL_DEVICE_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_DEVICE_INFO, xgi_chip_info_t) +#define XGI_IOCTL_POST_VBIOS _IO(XGI_IOCTL_MAGIC, XGI_ESC_POST_VBIOS) + +#define XGI_IOCTL_FB_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_FB_INIT) +#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, xgi_mem_req_t) +#define XGI_IOCTL_FB_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_FB_FREE, unsigned long) + +#define XGI_IOCTL_PCIE_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_INIT) +#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, xgi_mem_req_t) +#define XGI_IOCTL_PCIE_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_FREE, unsigned long) + +#define XGI_IOCTL_PUT_SCREEN_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PUT_SCREEN_INFO, xgi_screen_info_t) +#define XGI_IOCTL_GET_SCREEN_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_GET_SCREEN_INFO, xgi_screen_info_t) + +#define XGI_IOCTL_GE_RESET _IO(XGI_IOCTL_MAGIC, XGI_ESC_GE_RESET) +#define XGI_IOCTL_SAREA_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_SAREA_INFO, xgi_sarea_info_t) +#define XGI_IOCTL_DUMP_REGISTER _IO(XGI_IOCTL_MAGIC, XGI_ESC_DUMP_REGISTER) +#define XGI_IOCTL_DEBUG_INFO _IO(XGI_IOCTL_MAGIC, XGI_ESC_DEBUG_INFO) +#define XGI_IOCTL_MMIO_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_MMIO_INFO, xgi_mmio_info_t) + +#define XGI_IOCTL_SUBMIT_CMDLIST _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_SUBMIT_CMDLIST, xgi_cmd_info_t) +#define XGI_IOCTL_TEST_RWINKERNEL _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_TEST_RWINKERNEL, unsigned long) +#define XGI_IOCTL_STATE_CHANGE _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_STATE_CHANGE, xgi_state_info_t) + +#define XGI_IOCTL_PCIE_CHECK _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_CHECK) +#define XGI_IOCTL_CPUID _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_CPUID, cpu_info_t) +#define XGI_IOCTL_MAXNR 30 + +/* + * flags + */ +#define XGI_FLAG_OPEN 0x0001 +#define XGI_FLAG_NEEDS_POSTING 0x0002 +#define XGI_FLAG_WAS_POSTED 0x0004 +#define XGI_FLAG_CONTROL 0x0010 +#define XGI_FLAG_MAP_REGS_EARLY 0x0200 + +/* mmap(2) offsets */ + +#define IS_IO_OFFSET(info, offset, length) \ + (((offset) >= (info)->mmio.base) \ + && (((offset) + (length)) <= (info)->mmio.base + (info)->mmio.size)) + +/* Jong 06/14/2006 */ +/* (info)->fb.base is a base address for physical (bus) address space */ +/* what's the definition of offest? on physical (bus) address space or HW address space */ +/* Jong 06/15/2006; use HW address space */ +#define IS_FB_OFFSET(info, offset, length) \ + (((offset) >= 0) \ + && (((offset) + (length)) <= (info)->fb.size)) +#if 0 +#define IS_FB_OFFSET(info, offset, length) \ + (((offset) >= (info)->fb.base) \ + && (((offset) + (length)) <= (info)->fb.base + (info)->fb.size)) +#endif + +#define IS_PCIE_OFFSET(info, offset, length) \ + (((offset) >= (info)->pcie.base) \ + && (((offset) + (length)) <= (info)->pcie.base + (info)->pcie.size)) + +extern int xgi_fb_heap_init(xgi_info_t * info); +extern void xgi_fb_heap_cleanup(xgi_info_t * info); + +extern void xgi_fb_alloc(xgi_info_t * info, xgi_mem_req_t * req, + xgi_mem_alloc_t * alloc); +extern void xgi_fb_free(xgi_info_t * info, unsigned long offset); +extern void xgi_mem_collect(xgi_info_t * info, unsigned int *pcnt); + +extern int xgi_pcie_heap_init(xgi_info_t * info); +extern void xgi_pcie_heap_cleanup(xgi_info_t * info); + +extern void xgi_pcie_alloc(xgi_info_t * info, unsigned long size, + enum PcieOwner owner, xgi_mem_alloc_t * alloc); +extern void xgi_pcie_free(xgi_info_t * info, unsigned long offset); +extern void xgi_pcie_heap_check(void); +extern void *xgi_find_pcie_block(xgi_info_t * info, unsigned long address); +extern void *xgi_find_pcie_virt(xgi_info_t * info, unsigned long address); + +extern void xgi_read_pcie_mem(xgi_info_t * info, xgi_mem_req_t * req); +extern void xgi_write_pcie_mem(xgi_info_t * info, xgi_mem_req_t * req); + +extern void xgi_test_rwinkernel(xgi_info_t * info, unsigned long address); + +#endif -- cgit v1.2.3 From 33b8476dfb0f9b5045103c3a9781ba82bcae4a9d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 29 Jun 2007 09:30:02 -0700 Subject: Fix return type of xgi_find_pcie_block. This function used to return 'void *', which was then cast to 'xgi_pcie_block_t *' at the only caller. I changed the return type to 'struct xgi_pcie_block_s *' and removed the explicit cast. --- linux-core/xgi_drv.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 429719a7..5d76b632 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -353,7 +353,8 @@ extern void xgi_pcie_alloc(xgi_info_t * info, unsigned long size, enum PcieOwner owner, xgi_mem_alloc_t * alloc); extern void xgi_pcie_free(xgi_info_t * info, unsigned long offset); extern void xgi_pcie_heap_check(void); -extern void *xgi_find_pcie_block(xgi_info_t * info, unsigned long address); +extern struct xgi_pcie_block_s *xgi_find_pcie_block(xgi_info_t * info, + unsigned long address); extern void *xgi_find_pcie_virt(xgi_info_t * info, unsigned long address); extern void xgi_read_pcie_mem(xgi_info_t * info, xgi_mem_req_t * req); -- cgit v1.2.3 From 88328d4ef007c781874aafedfef59aae0d21a37c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 29 Jun 2007 15:27:38 -0700 Subject: Eliminate structure typedefs Documentation/CodingStyle says that 'typedef struct foo foo_t' is evil. I tend to agree. Elminate all uses of such construct. --- linux-core/xgi_drv.h | 130 +++++++++++++++++++++++++-------------------------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 5d76b632..32ee5e81 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -93,26 +93,26 @@ /* need a fake device number for control device; just to flag it for msgs */ #define XGI_CONTROL_DEVICE_NUMBER 100 -typedef struct { +struct xgi_aperture { U32 base; // pcie base is different from fb base U32 size; U8 *vbase; -} xgi_aperture_t; +}; -typedef struct xgi_screen_info_s { +struct xgi_screen_info { U32 scrn_start; U32 scrn_xres; U32 scrn_yres; U32 scrn_bpp; U32 scrn_pitch; -} xgi_screen_info_t; +}; -typedef struct xgi_sarea_info_s { +struct xgi_sarea_info { U32 bus_addr; U32 size; -} xgi_sarea_info_t; +}; -typedef struct xgi_info_s { +struct xgi_info { struct pci_dev *dev; int flags; int device_number; @@ -123,11 +123,11 @@ typedef struct xgi_info_s { U8 revision_id; /* physical characteristics */ - xgi_aperture_t mmio; - xgi_aperture_t fb; - xgi_aperture_t pcie; - xgi_screen_info_t scrn_info; - xgi_sarea_info_t sarea_info; + struct xgi_aperture mmio; + struct xgi_aperture fb; + struct xgi_aperture pcie; + struct xgi_screen_info scrn_info; + struct xgi_sarea_info sarea_info; /* look up table parameters */ U32 *lut_base; @@ -150,18 +150,18 @@ typedef struct xgi_info_s { struct semaphore info_sem; struct semaphore fb_sem; struct semaphore pcie_sem; -} xgi_info_t; +}; -typedef struct xgi_ioctl_post_vbios { +struct xgi_ioctl_post_vbios { U32 bus; U32 slot; -} xgi_ioctl_post_vbios_t; +}; -typedef enum xgi_mem_location_s { +enum xgi_mem_location { NON_LOCAL = 0, LOCAL = 1, INVALID = 0x7fffffff -} xgi_mem_location_t; +}; enum PcieOwner { PCIE_2D = 0, @@ -176,23 +176,23 @@ enum PcieOwner { PCIE_INVALID = 0x7fffffff }; -typedef struct xgi_mem_req_s { - xgi_mem_location_t location; +struct xgi_mem_req { + enum xgi_mem_location location; unsigned long size; unsigned long is_front; enum PcieOwner owner; unsigned long pid; -} xgi_mem_req_t; +}; -typedef struct xgi_mem_alloc_s { - xgi_mem_location_t location; +struct xgi_mem_alloc { + enum xgi_mem_location location; unsigned long size; unsigned long bus_addr; unsigned long hw_addr; unsigned long pid; -} xgi_mem_alloc_t; +}; -typedef struct xgi_chip_info_s { +struct xgi_chip_info { U32 device_id; char device_name[32]; U32 vendor_id; @@ -200,17 +200,17 @@ typedef struct xgi_chip_info_s { U32 fb_size; U32 sarea_bus_addr; U32 sarea_size; -} xgi_chip_info_t; +}; -typedef struct xgi_opengl_cmd_s { +struct xgi_opengl_cmd { U32 cmd; -} xgi_opengl_cmd_t; +}; -typedef struct xgi_mmio_info_s { - xgi_opengl_cmd_t cmd_head; +struct xgi_mmio_info { + struct xgi_opengl_cmd cmd_head; void *mmioBase; int size; -} xgi_mmio_info_t; +}; typedef enum { BTYPE_2D = 0, @@ -220,33 +220,33 @@ typedef enum { BTYPE_NONE = 0x7fffffff } BATCH_TYPE; -typedef struct xgi_cmd_info_s { +struct xgi_cmd_info { BATCH_TYPE _firstBeginType; U32 _firstBeginAddr; U32 _firstSize; U32 _curDebugID; U32 _lastBeginAddr; U32 _beginCount; -} xgi_cmd_info_t; +}; -typedef struct xgi_state_info_s { +struct xgi_state_info { U32 _fromState; U32 _toState; -} xgi_state_info_t; +}; -typedef struct cpu_info_s { +struct cpu_info { U32 _eax; U32 _ebx; U32 _ecx; U32 _edx; -} cpu_info_t; +}; -typedef struct xgi_mem_pid_s { +struct xgi_mem_pid { struct list_head list; - xgi_mem_location_t location; + enum xgi_mem_location location; unsigned long bus_addr; unsigned long pid; -} xgi_mem_pid_t; +}; /* * Ioctl definitions @@ -278,32 +278,32 @@ typedef struct xgi_mem_pid_s { #define XGI_ESC_CPUID (XGI_IOCTL_BASE + 20) #define XGI_ESC_MEM_COLLECT (XGI_IOCTL_BASE + 21) -#define XGI_IOCTL_DEVICE_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_DEVICE_INFO, xgi_chip_info_t) +#define XGI_IOCTL_DEVICE_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_DEVICE_INFO, struct xgi_chip_info) #define XGI_IOCTL_POST_VBIOS _IO(XGI_IOCTL_MAGIC, XGI_ESC_POST_VBIOS) #define XGI_IOCTL_FB_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_FB_INIT) -#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, xgi_mem_req_t) +#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, struct xgi_mem_req) #define XGI_IOCTL_FB_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_FB_FREE, unsigned long) #define XGI_IOCTL_PCIE_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_INIT) -#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, xgi_mem_req_t) +#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, struct xgi_mem_req) #define XGI_IOCTL_PCIE_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_FREE, unsigned long) -#define XGI_IOCTL_PUT_SCREEN_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PUT_SCREEN_INFO, xgi_screen_info_t) -#define XGI_IOCTL_GET_SCREEN_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_GET_SCREEN_INFO, xgi_screen_info_t) +#define XGI_IOCTL_PUT_SCREEN_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PUT_SCREEN_INFO, struct xgi_screen_info) +#define XGI_IOCTL_GET_SCREEN_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_GET_SCREEN_INFO, struct xgi_screen_info) #define XGI_IOCTL_GE_RESET _IO(XGI_IOCTL_MAGIC, XGI_ESC_GE_RESET) -#define XGI_IOCTL_SAREA_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_SAREA_INFO, xgi_sarea_info_t) +#define XGI_IOCTL_SAREA_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_SAREA_INFO, struct xgi_sarea_info) #define XGI_IOCTL_DUMP_REGISTER _IO(XGI_IOCTL_MAGIC, XGI_ESC_DUMP_REGISTER) #define XGI_IOCTL_DEBUG_INFO _IO(XGI_IOCTL_MAGIC, XGI_ESC_DEBUG_INFO) -#define XGI_IOCTL_MMIO_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_MMIO_INFO, xgi_mmio_info_t) +#define XGI_IOCTL_MMIO_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_MMIO_INFO, struct xgi_mmio_info) -#define XGI_IOCTL_SUBMIT_CMDLIST _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_SUBMIT_CMDLIST, xgi_cmd_info_t) +#define XGI_IOCTL_SUBMIT_CMDLIST _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_SUBMIT_CMDLIST, struct xgi_cmd_info) #define XGI_IOCTL_TEST_RWINKERNEL _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_TEST_RWINKERNEL, unsigned long) -#define XGI_IOCTL_STATE_CHANGE _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_STATE_CHANGE, xgi_state_info_t) +#define XGI_IOCTL_STATE_CHANGE _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_STATE_CHANGE, struct xgi_state_info) #define XGI_IOCTL_PCIE_CHECK _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_CHECK) -#define XGI_IOCTL_CPUID _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_CPUID, cpu_info_t) +#define XGI_IOCTL_CPUID _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_CPUID, struct cpu_info) #define XGI_IOCTL_MAXNR 30 /* @@ -338,28 +338,28 @@ typedef struct xgi_mem_pid_s { (((offset) >= (info)->pcie.base) \ && (((offset) + (length)) <= (info)->pcie.base + (info)->pcie.size)) -extern int xgi_fb_heap_init(xgi_info_t * info); -extern void xgi_fb_heap_cleanup(xgi_info_t * info); +extern int xgi_fb_heap_init(struct xgi_info * info); +extern void xgi_fb_heap_cleanup(struct xgi_info * info); -extern void xgi_fb_alloc(xgi_info_t * info, xgi_mem_req_t * req, - xgi_mem_alloc_t * alloc); -extern void xgi_fb_free(xgi_info_t * info, unsigned long offset); -extern void xgi_mem_collect(xgi_info_t * info, unsigned int *pcnt); +extern void xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_req * req, + struct xgi_mem_alloc * alloc); +extern void xgi_fb_free(struct xgi_info * info, unsigned long offset); +extern void xgi_mem_collect(struct xgi_info * info, unsigned int *pcnt); -extern int xgi_pcie_heap_init(xgi_info_t * info); -extern void xgi_pcie_heap_cleanup(xgi_info_t * info); +extern int xgi_pcie_heap_init(struct xgi_info * info); +extern void xgi_pcie_heap_cleanup(struct xgi_info * info); -extern void xgi_pcie_alloc(xgi_info_t * info, unsigned long size, - enum PcieOwner owner, xgi_mem_alloc_t * alloc); -extern void xgi_pcie_free(xgi_info_t * info, unsigned long offset); +extern void xgi_pcie_alloc(struct xgi_info * info, unsigned long size, + enum PcieOwner owner, struct xgi_mem_alloc * alloc); +extern void xgi_pcie_free(struct xgi_info * info, unsigned long offset); extern void xgi_pcie_heap_check(void); -extern struct xgi_pcie_block_s *xgi_find_pcie_block(xgi_info_t * info, +extern struct xgi_pcie_block *xgi_find_pcie_block(struct xgi_info * info, unsigned long address); -extern void *xgi_find_pcie_virt(xgi_info_t * info, unsigned long address); +extern void *xgi_find_pcie_virt(struct xgi_info * info, unsigned long address); -extern void xgi_read_pcie_mem(xgi_info_t * info, xgi_mem_req_t * req); -extern void xgi_write_pcie_mem(xgi_info_t * info, xgi_mem_req_t * req); +extern void xgi_read_pcie_mem(struct xgi_info * info, struct xgi_mem_req * req); +extern void xgi_write_pcie_mem(struct xgi_info * info, struct xgi_mem_req * req); -extern void xgi_test_rwinkernel(xgi_info_t * info, unsigned long address); +extern void xgi_test_rwinkernel(struct xgi_info * info, unsigned long address); #endif -- cgit v1.2.3 From 406ded3816300f6b3e945c932c44350b22f43bd9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 29 Jun 2007 16:41:32 -0700 Subject: Replace U(8|16) with u(8|16). --- linux-core/xgi_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 32ee5e81..8431eb16 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -96,7 +96,7 @@ struct xgi_aperture { U32 base; // pcie base is different from fb base U32 size; - U8 *vbase; + u8 *vbase; }; struct xgi_screen_info { @@ -120,7 +120,7 @@ struct xgi_info { int slot; int vendor_id; U32 device_id; - U8 revision_id; + u8 revision_id; /* physical characteristics */ struct xgi_aperture mmio; -- cgit v1.2.3 From e206c4c59da0e81ed65796d543c311fc7e30b19a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 29 Jun 2007 21:00:50 -0700 Subject: Convert some PCI-e GART related variable to generic types. A few of the PCI-e GART related fields in struct xgi_info were hardcoded to u32. None of them need to be. Convert them to either unsigned int or bool. --- linux-core/xgi_drv.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 8431eb16..3cb6dc7f 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -131,10 +131,10 @@ struct xgi_info { /* look up table parameters */ U32 *lut_base; - U32 lutPageSize; - U32 lutPageOrder; - U32 isLUTInLFB; - U32 sdfbPageSize; + unsigned int lutPageSize; + unsigned int lutPageOrder; + bool isLUTInLFB; + unsigned int sdfbPageSize; U32 pcie_config; U32 pcie_status; -- cgit v1.2.3 From 49ccec1b0845ea14ab2cfd2f53704fe26e38fbef Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 29 Jun 2007 21:38:48 -0700 Subject: Convert xgi_mem_location enum values to less generic names. --- linux-core/xgi_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 3cb6dc7f..360e7120 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -158,9 +158,9 @@ struct xgi_ioctl_post_vbios { }; enum xgi_mem_location { - NON_LOCAL = 0, - LOCAL = 1, - INVALID = 0x7fffffff + XGI_MEMLOC_NON_LOCAL = 0, + XGI_MEMLOC_LOCAL = 1, + XGI_MEMLOC_INVALID = 0x7fffffff }; enum PcieOwner { -- cgit v1.2.3 From 86e75b7f7f64643c6ef2c0fef353b38753df8239 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Jul 2007 17:49:13 -0700 Subject: Remove XGI_IOCTL_CPUID and associated cruft. --- linux-core/xgi_drv.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 360e7120..248377aa 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -234,13 +234,6 @@ struct xgi_state_info { U32 _toState; }; -struct cpu_info { - U32 _eax; - U32 _ebx; - U32 _ecx; - U32 _edx; -}; - struct xgi_mem_pid { struct list_head list; enum xgi_mem_location location; @@ -275,8 +268,7 @@ struct xgi_mem_pid { #define XGI_ESC_STATE_CHANGE (XGI_IOCTL_BASE + 17) #define XGI_ESC_MMIO_INFO (XGI_IOCTL_BASE + 18) #define XGI_ESC_PCIE_CHECK (XGI_IOCTL_BASE + 19) -#define XGI_ESC_CPUID (XGI_IOCTL_BASE + 20) -#define XGI_ESC_MEM_COLLECT (XGI_IOCTL_BASE + 21) +#define XGI_ESC_MEM_COLLECT (XGI_IOCTL_BASE + 20) #define XGI_IOCTL_DEVICE_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_DEVICE_INFO, struct xgi_chip_info) #define XGI_IOCTL_POST_VBIOS _IO(XGI_IOCTL_MAGIC, XGI_ESC_POST_VBIOS) @@ -298,12 +290,11 @@ struct xgi_mem_pid { #define XGI_IOCTL_DEBUG_INFO _IO(XGI_IOCTL_MAGIC, XGI_ESC_DEBUG_INFO) #define XGI_IOCTL_MMIO_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_MMIO_INFO, struct xgi_mmio_info) -#define XGI_IOCTL_SUBMIT_CMDLIST _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_SUBMIT_CMDLIST, struct xgi_cmd_info) -#define XGI_IOCTL_TEST_RWINKERNEL _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_TEST_RWINKERNEL, unsigned long) +#define XGI_IOCTL_SUBMIT_CMDLIST _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_SUBMIT_CMDLIST, struct xgi_cmd_info) +#define XGI_IOCTL_TEST_RWINKERNEL _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_TEST_RWINKERNEL, unsigned long) #define XGI_IOCTL_STATE_CHANGE _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_STATE_CHANGE, struct xgi_state_info) #define XGI_IOCTL_PCIE_CHECK _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_CHECK) -#define XGI_IOCTL_CPUID _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_CPUID, struct cpu_info) #define XGI_IOCTL_MAXNR 30 /* -- cgit v1.2.3 From 2f2d8b9688743ac6367bf13c3c023310a257ceb7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 9 Jul 2007 15:59:09 -0700 Subject: Merge xgi_mem_req and xgi_mem_alloc into a single type. These two structures were used as the request and reply for certain ioctls. Having a different type for an ioctl's input and output is just wierd. In addition, each structure contained fields (e.g., pid) that had no business being there. This change requires updates to user-space. --- linux-core/xgi_drv.h | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 248377aa..361a1e96 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -177,19 +177,23 @@ enum PcieOwner { }; struct xgi_mem_req { - enum xgi_mem_location location; - unsigned long size; - unsigned long is_front; - enum PcieOwner owner; - unsigned long pid; }; struct xgi_mem_alloc { - enum xgi_mem_location location; - unsigned long size; + unsigned int location; + unsigned int size; + unsigned int is_front; + unsigned int owner; + + /** + * Address of the memory from the graphics hardware's point of view. + */ + u32 hw_addr; + + /** + * Physical address of the memory from the processor's point of view. + */ unsigned long bus_addr; - unsigned long hw_addr; - unsigned long pid; }; struct xgi_chip_info { @@ -274,11 +278,11 @@ struct xgi_mem_pid { #define XGI_IOCTL_POST_VBIOS _IO(XGI_IOCTL_MAGIC, XGI_ESC_POST_VBIOS) #define XGI_IOCTL_FB_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_FB_INIT) -#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, struct xgi_mem_req) +#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, struct xgi_mem_alloc) #define XGI_IOCTL_FB_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_FB_FREE, unsigned long) #define XGI_IOCTL_PCIE_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_INIT) -#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, struct xgi_mem_req) +#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, struct xgi_mem_alloc) #define XGI_IOCTL_PCIE_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_FREE, unsigned long) #define XGI_IOCTL_PUT_SCREEN_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PUT_SCREEN_INFO, struct xgi_screen_info) @@ -332,25 +336,22 @@ struct xgi_mem_pid { extern int xgi_fb_heap_init(struct xgi_info * info); extern void xgi_fb_heap_cleanup(struct xgi_info * info); -extern void xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_req * req, - struct xgi_mem_alloc * alloc); +extern void xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, + pid_t pid); extern void xgi_fb_free(struct xgi_info * info, unsigned long offset); extern void xgi_mem_collect(struct xgi_info * info, unsigned int *pcnt); extern int xgi_pcie_heap_init(struct xgi_info * info); extern void xgi_pcie_heap_cleanup(struct xgi_info * info); -extern void xgi_pcie_alloc(struct xgi_info * info, unsigned long size, - enum PcieOwner owner, struct xgi_mem_alloc * alloc); +extern void xgi_pcie_alloc(struct xgi_info * info, + struct xgi_mem_alloc * alloc, pid_t pid); extern void xgi_pcie_free(struct xgi_info * info, unsigned long offset); extern void xgi_pcie_heap_check(void); extern struct xgi_pcie_block *xgi_find_pcie_block(struct xgi_info * info, unsigned long address); extern void *xgi_find_pcie_virt(struct xgi_info * info, unsigned long address); -extern void xgi_read_pcie_mem(struct xgi_info * info, struct xgi_mem_req * req); -extern void xgi_write_pcie_mem(struct xgi_info * info, struct xgi_mem_req * req); - extern void xgi_test_rwinkernel(struct xgi_info * info, unsigned long address); #endif -- cgit v1.2.3 From a3f56dc3d0620633c7719a01e6e578661d65edfc Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 9 Jul 2007 16:07:27 -0700 Subject: Adjust the types of the fields of xgi_aperture. --- linux-core/xgi_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 361a1e96..6bd04cd9 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -94,9 +94,9 @@ #define XGI_CONTROL_DEVICE_NUMBER 100 struct xgi_aperture { - U32 base; // pcie base is different from fb base - U32 size; - u8 *vbase; + unsigned long base; + unsigned int size; + void *vbase; }; struct xgi_screen_info { -- cgit v1.2.3 From 7268b65d5ce804713c12b8fadc42f9a086cdfe14 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 9 Jul 2007 16:22:48 -0700 Subject: Correct types that are shared with user mode. --- linux-core/xgi_drv.h | 63 +++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 35 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 6bd04cd9..f1cfa44e 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -100,16 +100,16 @@ struct xgi_aperture { }; struct xgi_screen_info { - U32 scrn_start; - U32 scrn_xres; - U32 scrn_yres; - U32 scrn_bpp; - U32 scrn_pitch; + unsigned int scrn_start; + unsigned int scrn_xres; + unsigned int scrn_yres; + unsigned int scrn_bpp; + unsigned int scrn_pitch; }; struct xgi_sarea_info { - U32 bus_addr; - U32 size; + unsigned long bus_addr; + unsigned int size; }; struct xgi_info { @@ -153,8 +153,8 @@ struct xgi_info { }; struct xgi_ioctl_post_vbios { - U32 bus; - U32 slot; + unsigned int bus; + unsigned int slot; }; enum xgi_mem_location { @@ -176,9 +176,6 @@ enum PcieOwner { PCIE_INVALID = 0x7fffffff }; -struct xgi_mem_req { -}; - struct xgi_mem_alloc { unsigned int location; unsigned int size; @@ -197,45 +194,41 @@ struct xgi_mem_alloc { }; struct xgi_chip_info { - U32 device_id; - char device_name[32]; - U32 vendor_id; - U32 curr_display_mode; //Singe, DualView(Contained), MHS - U32 fb_size; - U32 sarea_bus_addr; - U32 sarea_size; -}; + u16 device_id; + u16 vendor_id; -struct xgi_opengl_cmd { - U32 cmd; + char device_name[32]; + unsigned int curr_display_mode; //Singe, DualView(Contained), MHS + unsigned int fb_size; + unsigned long sarea_bus_addr; + unsigned int sarea_size; }; struct xgi_mmio_info { - struct xgi_opengl_cmd cmd_head; - void *mmioBase; - int size; + unsigned long mmio_base; + unsigned int size; }; -typedef enum { +enum xgi_batch_type { BTYPE_2D = 0, BTYPE_3D = 1, BTYPE_FLIP = 2, BTYPE_CTRL = 3, BTYPE_NONE = 0x7fffffff -} BATCH_TYPE; +}; struct xgi_cmd_info { - BATCH_TYPE _firstBeginType; - U32 _firstBeginAddr; - U32 _firstSize; - U32 _curDebugID; - U32 _lastBeginAddr; - U32 _beginCount; + unsigned int _firstBeginType; + u32 _firstBeginAddr; + u32 _firstSize; + u32 _curDebugID; + u32 _lastBeginAddr; + unsigned int _beginCount; }; struct xgi_state_info { - U32 _fromState; - U32 _toState; + unsigned int _fromState; + unsigned int _toState; }; struct xgi_mem_pid { -- cgit v1.2.3 From 1f4e24b429789710f5d69fc78335f20c023569bb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 9 Jul 2007 16:33:14 -0700 Subject: Move types shared with user mode to xgi_drm.h. --- linux-core/xgi_drv.h | 131 +-------------------------------------------------- 1 file changed, 2 insertions(+), 129 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index f1cfa44e..803ed9c1 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -29,6 +29,8 @@ #ifndef _XGI_DRV_H_ #define _XGI_DRV_H_ +#include "xgi_drm.h" + #define XGI_MAJOR_VERSION 0 #define XGI_MINOR_VERSION 7 #define XGI_PATCHLEVEL 5 @@ -99,19 +101,6 @@ struct xgi_aperture { void *vbase; }; -struct xgi_screen_info { - unsigned int scrn_start; - unsigned int scrn_xres; - unsigned int scrn_yres; - unsigned int scrn_bpp; - unsigned int scrn_pitch; -}; - -struct xgi_sarea_info { - unsigned long bus_addr; - unsigned int size; -}; - struct xgi_info { struct pci_dev *dev; int flags; @@ -157,12 +146,6 @@ struct xgi_ioctl_post_vbios { unsigned int slot; }; -enum xgi_mem_location { - XGI_MEMLOC_NON_LOCAL = 0, - XGI_MEMLOC_LOCAL = 1, - XGI_MEMLOC_INVALID = 0x7fffffff -}; - enum PcieOwner { PCIE_2D = 0, /* @@ -176,61 +159,6 @@ enum PcieOwner { PCIE_INVALID = 0x7fffffff }; -struct xgi_mem_alloc { - unsigned int location; - unsigned int size; - unsigned int is_front; - unsigned int owner; - - /** - * Address of the memory from the graphics hardware's point of view. - */ - u32 hw_addr; - - /** - * Physical address of the memory from the processor's point of view. - */ - unsigned long bus_addr; -}; - -struct xgi_chip_info { - u16 device_id; - u16 vendor_id; - - char device_name[32]; - unsigned int curr_display_mode; //Singe, DualView(Contained), MHS - unsigned int fb_size; - unsigned long sarea_bus_addr; - unsigned int sarea_size; -}; - -struct xgi_mmio_info { - unsigned long mmio_base; - unsigned int size; -}; - -enum xgi_batch_type { - BTYPE_2D = 0, - BTYPE_3D = 1, - BTYPE_FLIP = 2, - BTYPE_CTRL = 3, - BTYPE_NONE = 0x7fffffff -}; - -struct xgi_cmd_info { - unsigned int _firstBeginType; - u32 _firstBeginAddr; - u32 _firstSize; - u32 _curDebugID; - u32 _lastBeginAddr; - unsigned int _beginCount; -}; - -struct xgi_state_info { - unsigned int _fromState; - unsigned int _toState; -}; - struct xgi_mem_pid { struct list_head list; enum xgi_mem_location location; @@ -238,61 +166,6 @@ struct xgi_mem_pid { unsigned long pid; }; -/* - * Ioctl definitions - */ - -#define XGI_IOCTL_MAGIC 'x' /* use 'x' as magic number */ - -#define XGI_IOCTL_BASE 0 -#define XGI_ESC_DEVICE_INFO (XGI_IOCTL_BASE + 0) -#define XGI_ESC_POST_VBIOS (XGI_IOCTL_BASE + 1) - -#define XGI_ESC_FB_INIT (XGI_IOCTL_BASE + 2) -#define XGI_ESC_FB_ALLOC (XGI_IOCTL_BASE + 3) -#define XGI_ESC_FB_FREE (XGI_IOCTL_BASE + 4) -#define XGI_ESC_PCIE_INIT (XGI_IOCTL_BASE + 5) -#define XGI_ESC_PCIE_ALLOC (XGI_IOCTL_BASE + 6) -#define XGI_ESC_PCIE_FREE (XGI_IOCTL_BASE + 7) -#define XGI_ESC_SUBMIT_CMDLIST (XGI_IOCTL_BASE + 8) -#define XGI_ESC_PUT_SCREEN_INFO (XGI_IOCTL_BASE + 9) -#define XGI_ESC_GET_SCREEN_INFO (XGI_IOCTL_BASE + 10) -#define XGI_ESC_GE_RESET (XGI_IOCTL_BASE + 11) -#define XGI_ESC_SAREA_INFO (XGI_IOCTL_BASE + 12) -#define XGI_ESC_DUMP_REGISTER (XGI_IOCTL_BASE + 13) -#define XGI_ESC_DEBUG_INFO (XGI_IOCTL_BASE + 14) -#define XGI_ESC_TEST_RWINKERNEL (XGI_IOCTL_BASE + 16) -#define XGI_ESC_STATE_CHANGE (XGI_IOCTL_BASE + 17) -#define XGI_ESC_MMIO_INFO (XGI_IOCTL_BASE + 18) -#define XGI_ESC_PCIE_CHECK (XGI_IOCTL_BASE + 19) -#define XGI_ESC_MEM_COLLECT (XGI_IOCTL_BASE + 20) - -#define XGI_IOCTL_DEVICE_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_DEVICE_INFO, struct xgi_chip_info) -#define XGI_IOCTL_POST_VBIOS _IO(XGI_IOCTL_MAGIC, XGI_ESC_POST_VBIOS) - -#define XGI_IOCTL_FB_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_FB_INIT) -#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, struct xgi_mem_alloc) -#define XGI_IOCTL_FB_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_FB_FREE, unsigned long) - -#define XGI_IOCTL_PCIE_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_INIT) -#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, struct xgi_mem_alloc) -#define XGI_IOCTL_PCIE_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_FREE, unsigned long) - -#define XGI_IOCTL_PUT_SCREEN_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PUT_SCREEN_INFO, struct xgi_screen_info) -#define XGI_IOCTL_GET_SCREEN_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_GET_SCREEN_INFO, struct xgi_screen_info) - -#define XGI_IOCTL_GE_RESET _IO(XGI_IOCTL_MAGIC, XGI_ESC_GE_RESET) -#define XGI_IOCTL_SAREA_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_SAREA_INFO, struct xgi_sarea_info) -#define XGI_IOCTL_DUMP_REGISTER _IO(XGI_IOCTL_MAGIC, XGI_ESC_DUMP_REGISTER) -#define XGI_IOCTL_DEBUG_INFO _IO(XGI_IOCTL_MAGIC, XGI_ESC_DEBUG_INFO) -#define XGI_IOCTL_MMIO_INFO _IOR(XGI_IOCTL_MAGIC, XGI_ESC_MMIO_INFO, struct xgi_mmio_info) - -#define XGI_IOCTL_SUBMIT_CMDLIST _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_SUBMIT_CMDLIST, struct xgi_cmd_info) -#define XGI_IOCTL_TEST_RWINKERNEL _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_TEST_RWINKERNEL, unsigned long) -#define XGI_IOCTL_STATE_CHANGE _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_STATE_CHANGE, struct xgi_state_info) - -#define XGI_IOCTL_PCIE_CHECK _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_CHECK) -#define XGI_IOCTL_MAXNR 30 /* * flags -- cgit v1.2.3 From 5c481d0a4284ec7311a47fbeab1680d007769668 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 9 Jul 2007 16:43:48 -0700 Subject: Eliminiate fields in xgi_info that are duplicates of fields in pci_dev. --- linux-core/xgi_drv.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 803ed9c1..efbbd647 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -105,11 +105,6 @@ struct xgi_info { struct pci_dev *dev; int flags; int device_number; - int bus; /* PCI config info */ - int slot; - int vendor_id; - U32 device_id; - u8 revision_id; /* physical characteristics */ struct xgi_aperture mmio; @@ -125,9 +120,8 @@ struct xgi_info { bool isLUTInLFB; unsigned int sdfbPageSize; - U32 pcie_config; - U32 pcie_status; - U32 irq; + u32 pcie_config; + u32 pcie_status; atomic_t use_count; -- cgit v1.2.3 From 76ca1e858fb8e1a65ea49c0c62350d7ca91044a2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 9 Jul 2007 18:54:25 -0700 Subject: Convert occurances of U32 to other types. Most occurances of U32 were converted to u32. These are cases where the data represents something that will be written to the hardware. Other cases were converted to 'unsigned int'. U32 was the last type in xgi_types.h, so that file is removed. --- linux-core/xgi_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index efbbd647..983ed0a9 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -114,7 +114,7 @@ struct xgi_info { struct xgi_sarea_info sarea_info; /* look up table parameters */ - U32 *lut_base; + u32 *lut_base; unsigned int lutPageSize; unsigned int lutPageOrder; bool isLUTInLFB; -- cgit v1.2.3 From 658ff2daf3d2a080da2d859f522a627aef841637 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Jul 2007 20:58:43 -0700 Subject: Eliminate several useless ioctls and associated cruft. The ioctlss XGI_ESC_DEVICE_INFO, XGI_ESC_MEM_COLLECT, XGI_ESC_PCIE_CHECK, XGI_ESC_GET_SCREEN_INFO, XGI_ESC_PUT_SCREEN_INFO, XGI_ESC_MMIO_INFO, and XGI_ESC_SAREA_INFO, are completely unnecessary. The will be doubly useless when the driver is converted to the DRM infrastructure. --- linux-core/xgi_drv.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 983ed0a9..382bb7a6 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -110,8 +110,6 @@ struct xgi_info { struct xgi_aperture mmio; struct xgi_aperture fb; struct xgi_aperture pcie; - struct xgi_screen_info scrn_info; - struct xgi_sarea_info sarea_info; /* look up table parameters */ u32 *lut_base; @@ -207,7 +205,6 @@ extern void xgi_pcie_heap_cleanup(struct xgi_info * info); extern void xgi_pcie_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, pid_t pid); extern void xgi_pcie_free(struct xgi_info * info, unsigned long offset); -extern void xgi_pcie_heap_check(void); extern struct xgi_pcie_block *xgi_find_pcie_block(struct xgi_info * info, unsigned long address); extern void *xgi_find_pcie_virt(struct xgi_info * info, unsigned long address); -- cgit v1.2.3 From 5ba94c2ab8be350fee495e5cfe94afb8f663956a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 19 Jul 2007 10:29:18 -0700 Subject: Initial pass at converting driver to DRM infrastructure. --- linux-core/xgi_drv.h | 205 ++++++++++++++++++--------------------------------- 1 file changed, 71 insertions(+), 134 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 382bb7a6..20965876 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -29,115 +29,69 @@ #ifndef _XGI_DRV_H_ #define _XGI_DRV_H_ -#include "xgi_drm.h" - -#define XGI_MAJOR_VERSION 0 -#define XGI_MINOR_VERSION 7 -#define XGI_PATCHLEVEL 5 - -#define XGI_DRV_VERSION "0.7.5" - -#ifndef XGI_DRV_NAME -#define XGI_DRV_NAME "xgi" -#endif - -/* - * xgi reserved major device number, Set this to 0 to - * request dynamic major number allocation. - */ -#ifndef XGI_DEV_MAJOR -#define XGI_DEV_MAJOR 0 -#endif - -#ifndef XGI_MAX_DEVICES -#define XGI_MAX_DEVICES 1 -#endif - -/* Jong 06/06/2006 */ -/* #define XGI_DEBUG */ +#include "drmP.h" +#include "drm.h" -#ifndef PCI_VENDOR_ID_XGI -/* -#define PCI_VENDOR_ID_XGI 0x1023 -*/ -#define PCI_VENDOR_ID_XGI 0x18CA +#define DRIVER_AUTHOR "Andrea Zhang " -#endif - -#ifndef PCI_DEVICE_ID_XP5 -#define PCI_DEVICE_ID_XP5 0x2200 -#endif - -#ifndef PCI_DEVICE_ID_XG47 -#define PCI_DEVICE_ID_XG47 0x0047 -#endif +#define DRIVER_NAME "xgi" +#define DRIVER_DESC "XGI XP5 / XP10 / XG47" +#define DRIVER_DATE "20070710" -/* Macros to make printk easier */ -#define XGI_ERROR(fmt, arg...) \ - printk(KERN_ERR "[" XGI_DRV_NAME ":%s] *ERROR* " fmt, __FUNCTION__, ##arg) +#define DRIVER_MAJOR 0 +#define DRIVER_MINOR 8 +#define DRIVER_PATCHLEVEL 0 -#define XGI_MEM_ERROR(area, fmt, arg...) \ - printk(KERN_ERR "[" XGI_DRV_NAME ":%s] *ERROR* " fmt, __FUNCTION__, ##arg) +#include "xgi_drm.h" -/* #define XGI_DEBUG */ +struct xgi_aperture { + dma_addr_t base; + unsigned int size; +}; -#ifdef XGI_DEBUG -#define XGI_INFO(fmt, arg...) \ - printk(KERN_ALERT "[" XGI_DRV_NAME ":%s] " fmt, __FUNCTION__, ##arg) -/* printk(KERN_INFO "[" XGI_DRV_NAME ":%s] " fmt, __FUNCTION__, ##arg) */ -#else -#define XGI_INFO(fmt, arg...) do { } while (0) -#endif +struct xgi_mem_block { + struct list_head list; + unsigned long offset; + unsigned long size; + DRMFILE filp; -/* device name length; must be atleast 8 */ -#define XGI_DEVICE_NAME_LENGTH 40 + unsigned int owner; +}; -/* need a fake device number for control device; just to flag it for msgs */ -#define XGI_CONTROL_DEVICE_NUMBER 100 +struct xgi_mem_heap { + struct list_head free_list; + struct list_head used_list; + struct list_head sort_list; + unsigned long max_freesize; -struct xgi_aperture { - unsigned long base; - unsigned int size; - void *vbase; + bool initialized; }; struct xgi_info { - struct pci_dev *dev; - int flags; - int device_number; + struct drm_device *dev; + + bool bootstrap_done; /* physical characteristics */ struct xgi_aperture mmio; struct xgi_aperture fb; struct xgi_aperture pcie; + struct drm_map *mmio_map; + struct drm_map *pcie_map; + struct drm_map *fb_map; + /* look up table parameters */ - u32 *lut_base; + struct drm_dma_handle *lut_handle; unsigned int lutPageSize; - unsigned int lutPageOrder; - bool isLUTInLFB; - unsigned int sdfbPageSize; - - u32 pcie_config; - u32 pcie_status; - - atomic_t use_count; - /* keep track of any pending bottom halfes */ - struct tasklet_struct tasklet; + struct xgi_mem_heap fb_heap; + struct xgi_mem_heap pcie_heap; - spinlock_t info_lock; - - struct semaphore info_sem; struct semaphore fb_sem; struct semaphore pcie_sem; }; -struct xgi_ioctl_post_vbios { - unsigned int bus; - unsigned int slot; -}; - enum PcieOwner { PCIE_2D = 0, /* @@ -151,64 +105,47 @@ enum PcieOwner { PCIE_INVALID = 0x7fffffff }; -struct xgi_mem_pid { - struct list_head list; - enum xgi_mem_location location; - unsigned long bus_addr; - unsigned long pid; -}; - - -/* - * flags - */ -#define XGI_FLAG_OPEN 0x0001 -#define XGI_FLAG_NEEDS_POSTING 0x0002 -#define XGI_FLAG_WAS_POSTED 0x0004 -#define XGI_FLAG_CONTROL 0x0010 -#define XGI_FLAG_MAP_REGS_EARLY 0x0200 - -/* mmap(2) offsets */ - -#define IS_IO_OFFSET(info, offset, length) \ - (((offset) >= (info)->mmio.base) \ - && (((offset) + (length)) <= (info)->mmio.base + (info)->mmio.size)) - -/* Jong 06/14/2006 */ -/* (info)->fb.base is a base address for physical (bus) address space */ -/* what's the definition of offest? on physical (bus) address space or HW address space */ -/* Jong 06/15/2006; use HW address space */ -#define IS_FB_OFFSET(info, offset, length) \ - (((offset) >= 0) \ - && (((offset) + (length)) <= (info)->fb.size)) -#if 0 -#define IS_FB_OFFSET(info, offset, length) \ - (((offset) >= (info)->fb.base) \ - && (((offset) + (length)) <= (info)->fb.base + (info)->fb.size)) -#endif -#define IS_PCIE_OFFSET(info, offset, length) \ - (((offset) >= (info)->pcie.base) \ - && (((offset) + (length)) <= (info)->pcie.base + (info)->pcie.size)) +extern struct kmem_cache *xgi_mem_block_cache; +extern struct xgi_mem_block *xgi_mem_alloc(struct xgi_mem_heap * heap, + unsigned long size, enum PcieOwner owner); +extern int xgi_mem_free(struct xgi_mem_heap * heap, unsigned long offset, + DRMFILE filp); +extern int xgi_mem_heap_init(struct xgi_mem_heap * heap, unsigned int start, + unsigned int end); +extern void xgi_mem_heap_cleanup(struct xgi_mem_heap * heap); extern int xgi_fb_heap_init(struct xgi_info * info); -extern void xgi_fb_heap_cleanup(struct xgi_info * info); -extern void xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, - pid_t pid); -extern void xgi_fb_free(struct xgi_info * info, unsigned long offset); -extern void xgi_mem_collect(struct xgi_info * info, unsigned int *pcnt); +extern int xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, + DRMFILE filp); + +extern int xgi_fb_free(struct xgi_info * info, unsigned long offset, + DRMFILE filp); extern int xgi_pcie_heap_init(struct xgi_info * info); -extern void xgi_pcie_heap_cleanup(struct xgi_info * info); +extern void xgi_pcie_lut_cleanup(struct xgi_info * info); + +extern int xgi_pcie_alloc(struct xgi_info * info, + struct xgi_mem_alloc * alloc, DRMFILE filp); + +extern int xgi_pcie_free(struct xgi_info * info, unsigned long offset, + DRMFILE filp); + +extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address); -extern void xgi_pcie_alloc(struct xgi_info * info, - struct xgi_mem_alloc * alloc, pid_t pid); -extern void xgi_pcie_free(struct xgi_info * info, unsigned long offset); -extern struct xgi_pcie_block *xgi_find_pcie_block(struct xgi_info * info, - unsigned long address); -extern void *xgi_find_pcie_virt(struct xgi_info * info, unsigned long address); +extern void xgi_pcie_free_all(struct xgi_info *, DRMFILE); +extern void xgi_fb_free_all(struct xgi_info *, DRMFILE); -extern void xgi_test_rwinkernel(struct xgi_info * info, unsigned long address); +extern int xgi_fb_alloc_ioctl(DRM_IOCTL_ARGS); +extern int xgi_fb_free_ioctl(DRM_IOCTL_ARGS); +extern int xgi_pcie_alloc_ioctl(DRM_IOCTL_ARGS); +extern int xgi_pcie_free_ioctl(DRM_IOCTL_ARGS); +extern int xgi_ge_reset_ioctl(DRM_IOCTL_ARGS); +extern int xgi_dump_register_ioctl(DRM_IOCTL_ARGS); +extern int xgi_restore_registers_ioctl(DRM_IOCTL_ARGS); +extern int xgi_submit_cmdlist_ioctl(DRM_IOCTL_ARGS); +extern int xgi_test_rwinkernel_ioctl(DRM_IOCTL_ARGS); +extern int xgi_state_change_ioctl(DRM_IOCTL_ARGS); #endif -- cgit v1.2.3 From 3265a61f895a1d35072984e9cdc71aad898647fa Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 21 Jul 2007 20:39:22 -0700 Subject: Make s_cmdring a field in the xgi_info structure instead of a global. --- linux-core/xgi_drv.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 20965876..0aab04d8 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -42,6 +42,7 @@ #define DRIVER_MINOR 8 #define DRIVER_PATCHLEVEL 0 +#include "xgi_cmdlist.h" #include "xgi_drm.h" struct xgi_aperture { @@ -90,6 +91,8 @@ struct xgi_info { struct semaphore fb_sem; struct semaphore pcie_sem; + + struct xgi_cmdring_info cmdring; }; enum PcieOwner { -- cgit v1.2.3 From 94203840fe53edaf1556d1a0a8a27773c24a7fc5 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 21 Jul 2007 23:00:01 -0700 Subject: Bump version. --- linux-core/xgi_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 0aab04d8..16102950 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -36,10 +36,10 @@ #define DRIVER_NAME "xgi" #define DRIVER_DESC "XGI XP5 / XP10 / XG47" -#define DRIVER_DATE "20070710" +#define DRIVER_DATE "20070721" #define DRIVER_MAJOR 0 -#define DRIVER_MINOR 8 +#define DRIVER_MINOR 9 #define DRIVER_PATCHLEVEL 0 #include "xgi_cmdlist.h" -- cgit v1.2.3 From 887cb31ee9ec04e45829500f095aa4a3bc1095ea Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 24 Jul 2007 13:27:44 -0700 Subject: Fix bug preventing X server from restarting. The core DRM lastclose routine automatically destroys all mappings and releases SG memory. XP10 DRM and DDX assumed this data stayed around until module unload. xgi_bootstrap was reworked to recreate all these mappings. In addition, the drm_addmap for the GART backing store was moved into the kernel. This causes a change to the ioctl protocol and a version bump. --- linux-core/xgi_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 16102950..ae5fe07e 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -36,10 +36,10 @@ #define DRIVER_NAME "xgi" #define DRIVER_DESC "XGI XP5 / XP10 / XG47" -#define DRIVER_DATE "20070721" +#define DRIVER_DATE "20070723" #define DRIVER_MAJOR 0 -#define DRIVER_MINOR 9 +#define DRIVER_MINOR 10 #define DRIVER_PATCHLEVEL 0 #include "xgi_cmdlist.h" -- cgit v1.2.3 From 8e64d2ae862d5fa02e23c68db6b55393e1f86005 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 24 Jul 2007 13:36:02 -0700 Subject: Fix license formatting. --- linux-core/xgi_drv.h | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index ae5fe07e..2061189a 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -1,29 +1,27 @@ - /**************************************************************************** - * Copyright (C) 2003-2006 by XGI Technology, Taiwan. - * * - * All Rights Reserved. * - * * + * Copyright (C) 2003-2006 by XGI Technology, Taiwan. + * + * 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 on 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: - * * - * 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL XGI AND/OR - * ITS SUPPLIERS 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. + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on 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: + * + * 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 NON-INFRINGEMENT. IN NO EVENT SHALL + * XGI AND/OR ITS SUPPLIERS 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. ***************************************************************************/ #ifndef _XGI_DRV_H_ -- cgit v1.2.3 From cd51f131389297f923798daef6c734ba93f4422b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 27 Jul 2007 15:45:59 -0700 Subject: Convert to new ioctl interface between core DRM and device-specific module. --- linux-core/xgi_drv.h | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 2061189a..8dec1fa1 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -52,7 +52,7 @@ struct xgi_mem_block { struct list_head list; unsigned long offset; unsigned long size; - DRMFILE filp; + struct drm_file * filp; unsigned int owner; }; @@ -111,7 +111,7 @@ extern struct kmem_cache *xgi_mem_block_cache; extern struct xgi_mem_block *xgi_mem_alloc(struct xgi_mem_heap * heap, unsigned long size, enum PcieOwner owner); extern int xgi_mem_free(struct xgi_mem_heap * heap, unsigned long offset, - DRMFILE filp); + struct drm_file * filp); extern int xgi_mem_heap_init(struct xgi_mem_heap * heap, unsigned int start, unsigned int end); extern void xgi_mem_heap_cleanup(struct xgi_mem_heap * heap); @@ -119,34 +119,44 @@ extern void xgi_mem_heap_cleanup(struct xgi_mem_heap * heap); extern int xgi_fb_heap_init(struct xgi_info * info); extern int xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, - DRMFILE filp); + struct drm_file * filp); extern int xgi_fb_free(struct xgi_info * info, unsigned long offset, - DRMFILE filp); + struct drm_file * filp); extern int xgi_pcie_heap_init(struct xgi_info * info); extern void xgi_pcie_lut_cleanup(struct xgi_info * info); extern int xgi_pcie_alloc(struct xgi_info * info, - struct xgi_mem_alloc * alloc, DRMFILE filp); + struct xgi_mem_alloc * alloc, struct drm_file * filp); extern int xgi_pcie_free(struct xgi_info * info, unsigned long offset, - DRMFILE filp); + struct drm_file * filp); extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address); -extern void xgi_pcie_free_all(struct xgi_info *, DRMFILE); -extern void xgi_fb_free_all(struct xgi_info *, DRMFILE); - -extern int xgi_fb_alloc_ioctl(DRM_IOCTL_ARGS); -extern int xgi_fb_free_ioctl(DRM_IOCTL_ARGS); -extern int xgi_pcie_alloc_ioctl(DRM_IOCTL_ARGS); -extern int xgi_pcie_free_ioctl(DRM_IOCTL_ARGS); -extern int xgi_ge_reset_ioctl(DRM_IOCTL_ARGS); -extern int xgi_dump_register_ioctl(DRM_IOCTL_ARGS); -extern int xgi_restore_registers_ioctl(DRM_IOCTL_ARGS); -extern int xgi_submit_cmdlist_ioctl(DRM_IOCTL_ARGS); -extern int xgi_test_rwinkernel_ioctl(DRM_IOCTL_ARGS); -extern int xgi_state_change_ioctl(DRM_IOCTL_ARGS); +extern void xgi_pcie_free_all(struct xgi_info *, struct drm_file *); +extern void xgi_fb_free_all(struct xgi_info *, struct drm_file *); + +extern int xgi_fb_alloc_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_fb_free_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_pcie_alloc_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_pcie_free_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_ge_reset_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_dump_register_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_restore_registers_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_submit_cmdlist(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_test_rwinkernel_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); +extern int xgi_state_change_ioctl(struct drm_device * dev, void * data, + struct drm_file * filp); #endif -- cgit v1.2.3 From 997a9a738ec26cf0ef2c7dee5e30bb53bd11bf6c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Aug 2007 15:31:34 -0700 Subject: Eliminate allocation "owner" usage. --- linux-core/xgi_drv.h | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 8dec1fa1..f771517d 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -34,11 +34,11 @@ #define DRIVER_NAME "xgi" #define DRIVER_DESC "XGI XP5 / XP10 / XG47" -#define DRIVER_DATE "20070723" +#define DRIVER_DATE "20070806" #define DRIVER_MAJOR 0 #define DRIVER_MINOR 10 -#define DRIVER_PATCHLEVEL 0 +#define DRIVER_PATCHLEVEL 1 #include "xgi_cmdlist.h" #include "xgi_drm.h" @@ -53,8 +53,6 @@ struct xgi_mem_block { unsigned long offset; unsigned long size; struct drm_file * filp; - - unsigned int owner; }; struct xgi_mem_heap { @@ -93,23 +91,9 @@ struct xgi_info { struct xgi_cmdring_info cmdring; }; -enum PcieOwner { - PCIE_2D = 0, - /* - PCIE_3D should not begin with 1, - 2D alloc pcie memory will use owner 1. - */ - PCIE_3D = 11, /*vetex buf */ - PCIE_3D_CMDLIST = 12, - PCIE_3D_SCRATCHPAD = 13, - PCIE_3D_TEXTURE = 14, - PCIE_INVALID = 0x7fffffff -}; - - extern struct kmem_cache *xgi_mem_block_cache; extern struct xgi_mem_block *xgi_mem_alloc(struct xgi_mem_heap * heap, - unsigned long size, enum PcieOwner owner); + unsigned long size); extern int xgi_mem_free(struct xgi_mem_heap * heap, unsigned long offset, struct drm_file * filp); extern int xgi_mem_heap_init(struct xgi_mem_heap * heap, unsigned int start, -- cgit v1.2.3 From 78e9c1a93d00097895bc77d9ac90da1945021804 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Aug 2007 15:37:56 -0700 Subject: Eliminate special-case handling of framebuffer (fake) allocation. --- linux-core/xgi_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index f771517d..8a144fda 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -38,7 +38,7 @@ #define DRIVER_MAJOR 0 #define DRIVER_MINOR 10 -#define DRIVER_PATCHLEVEL 1 +#define DRIVER_PATCHLEVEL 2 #include "xgi_cmdlist.h" #include "xgi_drm.h" -- cgit v1.2.3 From f96bff9e213a950ab910832908d30e732435e628 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Aug 2007 16:09:05 -0700 Subject: Unify infrastructure for allocating (not yet freeing) on-card / GART memory. --- linux-core/xgi_drv.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 8a144fda..48c4b42c 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -38,7 +38,7 @@ #define DRIVER_MAJOR 0 #define DRIVER_MINOR 10 -#define DRIVER_PATCHLEVEL 2 +#define DRIVER_PATCHLEVEL 3 #include "xgi_cmdlist.h" #include "xgi_drm.h" @@ -92,8 +92,6 @@ struct xgi_info { }; extern struct kmem_cache *xgi_mem_block_cache; -extern struct xgi_mem_block *xgi_mem_alloc(struct xgi_mem_heap * heap, - unsigned long size); extern int xgi_mem_free(struct xgi_mem_heap * heap, unsigned long offset, struct drm_file * filp); extern int xgi_mem_heap_init(struct xgi_mem_heap * heap, unsigned int start, @@ -102,7 +100,7 @@ extern void xgi_mem_heap_cleanup(struct xgi_mem_heap * heap); extern int xgi_fb_heap_init(struct xgi_info * info); -extern int xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, +extern int xgi_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, struct drm_file * filp); extern int xgi_fb_free(struct xgi_info * info, unsigned long offset, @@ -111,9 +109,6 @@ extern int xgi_fb_free(struct xgi_info * info, unsigned long offset, extern int xgi_pcie_heap_init(struct xgi_info * info); extern void xgi_pcie_lut_cleanup(struct xgi_info * info); -extern int xgi_pcie_alloc(struct xgi_info * info, - struct xgi_mem_alloc * alloc, struct drm_file * filp); - extern int xgi_pcie_free(struct xgi_info * info, unsigned long offset, struct drm_file * filp); -- cgit v1.2.3 From 90907c59152f628d6f0efea4927a06e547f4a3c7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Aug 2007 16:17:23 -0700 Subject: Replace per-heap semaphores with drm_device::struct_mutex. --- linux-core/xgi_drv.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 48c4b42c..384381c7 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -85,9 +85,6 @@ struct xgi_info { struct xgi_mem_heap fb_heap; struct xgi_mem_heap pcie_heap; - struct semaphore fb_sem; - struct semaphore pcie_sem; - struct xgi_cmdring_info cmdring; }; -- cgit v1.2.3 From f3072becda3a2d5fe587f20e155d4d4f9ace60a2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Aug 2007 16:35:07 -0700 Subject: Refactor xgi_(fb|pcie)_free_all into xgi_free_all. --- linux-core/xgi_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 384381c7..79276b70 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -38,7 +38,7 @@ #define DRIVER_MAJOR 0 #define DRIVER_MINOR 10 -#define DRIVER_PATCHLEVEL 3 +#define DRIVER_PATCHLEVEL 4 #include "xgi_cmdlist.h" #include "xgi_drm.h" @@ -111,8 +111,8 @@ extern int xgi_pcie_free(struct xgi_info * info, unsigned long offset, extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address); -extern void xgi_pcie_free_all(struct xgi_info *, struct drm_file *); -extern void xgi_fb_free_all(struct xgi_info *, struct drm_file *); +extern void xgi_free_all(struct xgi_info *, struct xgi_mem_heap *, + struct drm_file *); extern int xgi_fb_alloc_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); -- cgit v1.2.3 From f7ba02b7458823627097a2320bf9befa84fc9c76 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Aug 2007 17:27:15 -0700 Subject: Unify infrastructure for freeing on-card / GART memory. --- linux-core/xgi_drv.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 79276b70..a7740ceb 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -38,7 +38,7 @@ #define DRIVER_MAJOR 0 #define DRIVER_MINOR 10 -#define DRIVER_PATCHLEVEL 4 +#define DRIVER_PATCHLEVEL 5 #include "xgi_cmdlist.h" #include "xgi_drm.h" @@ -89,8 +89,6 @@ struct xgi_info { }; extern struct kmem_cache *xgi_mem_block_cache; -extern int xgi_mem_free(struct xgi_mem_heap * heap, unsigned long offset, - struct drm_file * filp); extern int xgi_mem_heap_init(struct xgi_mem_heap * heap, unsigned int start, unsigned int end); extern void xgi_mem_heap_cleanup(struct xgi_mem_heap * heap); @@ -100,15 +98,12 @@ extern int xgi_fb_heap_init(struct xgi_info * info); extern int xgi_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, struct drm_file * filp); -extern int xgi_fb_free(struct xgi_info * info, unsigned long offset, +extern int xgi_free(struct xgi_info * info, unsigned long index, struct drm_file * filp); extern int xgi_pcie_heap_init(struct xgi_info * info); extern void xgi_pcie_lut_cleanup(struct xgi_info * info); -extern int xgi_pcie_free(struct xgi_info * info, unsigned long offset, - struct drm_file * filp); - extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address); extern void xgi_free_all(struct xgi_info *, struct xgi_mem_heap *, -- cgit v1.2.3 From 25cb876f8513d02d4d189371eaa8b7b9a88e860d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 9 Aug 2007 15:23:13 -0700 Subject: Associate master file pointer with command list buffer. Pass the master's file pointer, as supplied to xgi_bootstrap, to xgi_cmdlist_initialize. Associate that pointer with the memory allocated for the command list buffer. By doing this the memory will be automatically cleaned up when the master closes the device. This allows the removal of some clean up code. --- linux-core/xgi_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index a7740ceb..9c0f5a28 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -34,11 +34,11 @@ #define DRIVER_NAME "xgi" #define DRIVER_DESC "XGI XP5 / XP10 / XG47" -#define DRIVER_DATE "20070806" +#define DRIVER_DATE "20070809" #define DRIVER_MAJOR 0 #define DRIVER_MINOR 10 -#define DRIVER_PATCHLEVEL 5 +#define DRIVER_PATCHLEVEL 6 #include "xgi_cmdlist.h" #include "xgi_drm.h" -- cgit v1.2.3 From aea6b4dea9708f66f5fc2068fe84407682570aca Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 9 Aug 2007 15:30:36 -0700 Subject: Unify alloc and free ioctls. The DRM_XGI_PCIE_ALLOC and DRM_XGI_FB_ALLOC ioctls (and the matching free ioctls) are unified to DRM_XGI_ALLOC. The desired memory region is selected by xgi_mem_alloc::location. The region is magically encoded in xgi_mem_alloc::index, which is used to release the memory. Bump to version 0.11.0. This update requires a new DDX. --- linux-core/xgi_drv.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 9c0f5a28..e56d00bb 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -37,8 +37,8 @@ #define DRIVER_DATE "20070809" #define DRIVER_MAJOR 0 -#define DRIVER_MINOR 10 -#define DRIVER_PATCHLEVEL 6 +#define DRIVER_MINOR 11 +#define DRIVER_PATCHLEVEL 0 #include "xgi_cmdlist.h" #include "xgi_drm.h" @@ -89,6 +89,8 @@ struct xgi_info { }; extern struct kmem_cache *xgi_mem_block_cache; +extern int xgi_mem_free(struct xgi_mem_heap * heap, unsigned long offset, + struct drm_file * filp); extern int xgi_mem_heap_init(struct xgi_mem_heap * heap, unsigned int start, unsigned int end); extern void xgi_mem_heap_cleanup(struct xgi_mem_heap * heap); @@ -109,13 +111,9 @@ extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address); extern void xgi_free_all(struct xgi_info *, struct xgi_mem_heap *, struct drm_file *); -extern int xgi_fb_alloc_ioctl(struct drm_device * dev, void * data, - struct drm_file * filp); -extern int xgi_fb_free_ioctl(struct drm_device * dev, void * data, - struct drm_file * filp); -extern int xgi_pcie_alloc_ioctl(struct drm_device * dev, void * data, +extern int xgi_alloc_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); -extern int xgi_pcie_free_ioctl(struct drm_device * dev, void * data, +extern int xgi_free_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); extern int xgi_ge_reset_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); -- cgit v1.2.3 From dbd4d0597ff32458bbe4347bdea0e4b9e55a14da Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 9 Aug 2007 16:01:14 -0700 Subject: Use sman memory manager instead of internal version. --- linux-core/xgi_drv.h | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index e56d00bb..6b209aa4 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -29,6 +29,7 @@ #include "drmP.h" #include "drm.h" +#include "drm_sman.h" #define DRIVER_AUTHOR "Andrea Zhang " @@ -38,7 +39,7 @@ #define DRIVER_MAJOR 0 #define DRIVER_MINOR 11 -#define DRIVER_PATCHLEVEL 0 +#define DRIVER_PATCHLEVEL 1 #include "xgi_cmdlist.h" #include "xgi_drm.h" @@ -48,22 +49,6 @@ struct xgi_aperture { unsigned int size; }; -struct xgi_mem_block { - struct list_head list; - unsigned long offset; - unsigned long size; - struct drm_file * filp; -}; - -struct xgi_mem_heap { - struct list_head free_list; - struct list_head used_list; - struct list_head sort_list; - unsigned long max_freesize; - - bool initialized; -}; - struct xgi_info { struct drm_device *dev; @@ -82,19 +67,13 @@ struct xgi_info { struct drm_dma_handle *lut_handle; unsigned int lutPageSize; - struct xgi_mem_heap fb_heap; - struct xgi_mem_heap pcie_heap; + struct drm_sman sman; + bool fb_heap_initialized; + bool pcie_heap_initialized; struct xgi_cmdring_info cmdring; }; -extern struct kmem_cache *xgi_mem_block_cache; -extern int xgi_mem_free(struct xgi_mem_heap * heap, unsigned long offset, - struct drm_file * filp); -extern int xgi_mem_heap_init(struct xgi_mem_heap * heap, unsigned int start, - unsigned int end); -extern void xgi_mem_heap_cleanup(struct xgi_mem_heap * heap); - extern int xgi_fb_heap_init(struct xgi_info * info); extern int xgi_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, @@ -108,9 +87,6 @@ extern void xgi_pcie_lut_cleanup(struct xgi_info * info); extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address); -extern void xgi_free_all(struct xgi_info *, struct xgi_mem_heap *, - struct drm_file *); - extern int xgi_alloc_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); extern int xgi_free_ioctl(struct drm_device * dev, void * data, -- cgit v1.2.3 From 6dd97099ea5c6dc7931c6b482eb5935f7dd9ed2d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 9 Aug 2007 16:20:44 -0700 Subject: Minor clean up of IRQ code. Much, much more to come. --- linux-core/xgi_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 6b209aa4..6afc4c6c 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -39,7 +39,7 @@ #define DRIVER_MAJOR 0 #define DRIVER_MINOR 11 -#define DRIVER_PATCHLEVEL 1 +#define DRIVER_PATCHLEVEL 2 #include "xgi_cmdlist.h" #include "xgi_drm.h" -- cgit v1.2.3 From 891714d8d732480af97fbc45562145a560b7999b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 14 Aug 2007 13:18:44 -0700 Subject: Clean up xgi_(en|dis)able_(mmio|ge) and move to xgi_misc.c. --- linux-core/xgi_drv.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 6afc4c6c..9f746de2 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -87,6 +87,11 @@ extern void xgi_pcie_lut_cleanup(struct xgi_info * info); extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address); +extern void xgi_enable_mmio(struct xgi_info * info); +extern void xgi_disable_mmio(struct xgi_info * info); +extern void xgi_enable_ge(struct xgi_info * info); +extern void xgi_disable_ge(struct xgi_info * info); + extern int xgi_alloc_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); extern int xgi_free_ioctl(struct drm_device * dev, void * data, -- cgit v1.2.3 From f563a50d145848ed296b63c63422caff80232ddf Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 14 Aug 2007 13:44:51 -0700 Subject: Eliminate unused / useless ioctls. --- linux-core/xgi_drv.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 9f746de2..194313cd 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -35,11 +35,11 @@ #define DRIVER_NAME "xgi" #define DRIVER_DESC "XGI XP5 / XP10 / XG47" -#define DRIVER_DATE "20070809" +#define DRIVER_DATE "20070814" #define DRIVER_MAJOR 0 -#define DRIVER_MINOR 11 -#define DRIVER_PATCHLEVEL 2 +#define DRIVER_MINOR 12 +#define DRIVER_PATCHLEVEL 0 #include "xgi_cmdlist.h" #include "xgi_drm.h" @@ -96,16 +96,8 @@ extern int xgi_alloc_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); extern int xgi_free_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); -extern int xgi_ge_reset_ioctl(struct drm_device * dev, void * data, - struct drm_file * filp); -extern int xgi_dump_register_ioctl(struct drm_device * dev, void * data, - struct drm_file * filp); -extern int xgi_restore_registers_ioctl(struct drm_device * dev, void * data, - struct drm_file * filp); extern int xgi_submit_cmdlist(struct drm_device * dev, void * data, struct drm_file * filp); -extern int xgi_test_rwinkernel_ioctl(struct drm_device * dev, void * data, - struct drm_file * filp); extern int xgi_state_change_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); -- cgit v1.2.3 From d8a800b63de09f41d482d2b3367e4da67ed0f92b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 15 Aug 2007 21:05:26 -0700 Subject: Implement fence support. --- linux-core/xgi_drv.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 194313cd..c815f63e 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -38,7 +38,7 @@ #define DRIVER_DATE "20070814" #define DRIVER_MAJOR 0 -#define DRIVER_MINOR 12 +#define DRIVER_MINOR 13 #define DRIVER_PATCHLEVEL 0 #include "xgi_cmdlist.h" @@ -72,6 +72,10 @@ struct xgi_info { bool pcie_heap_initialized; struct xgi_cmdring_info cmdring; + + spinlock_t fence_lock; + unsigned complete_sequence; + unsigned next_sequence; }; extern int xgi_fb_heap_init(struct xgi_info * info); @@ -92,6 +96,13 @@ extern void xgi_disable_mmio(struct xgi_info * info); extern void xgi_enable_ge(struct xgi_info * info); extern void xgi_disable_ge(struct xgi_info * info); +extern void xgi_poke_flush(struct drm_device * dev, uint32_t class); +extern int xgi_fence_emit_sequence(struct drm_device * dev, uint32_t class, + uint32_t flags, uint32_t * sequence, uint32_t * native_type); +extern void xgi_fence_handler(struct drm_device * dev); +extern int xgi_fence_has_irq(struct drm_device *dev, uint32_t class, + uint32_t flags); + extern int xgi_alloc_ioctl(struct drm_device * dev, void * data, struct drm_file * filp); extern int xgi_free_ioctl(struct drm_device * dev, void * data, -- cgit v1.2.3 From 2bcd5b5e330843e1e1a5f0a19105ecd33e76b00b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 29 Aug 2007 00:04:18 -0700 Subject: Use DRM_SPINLOCK / DRM_UNSPINLOCK macros. --- linux-core/xgi_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index c815f63e..d43a6b4e 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -73,7 +73,7 @@ struct xgi_info { struct xgi_cmdring_info cmdring; - spinlock_t fence_lock; + DRM_SPINTYPE fence_lock; unsigned complete_sequence; unsigned next_sequence; }; -- cgit v1.2.3 From 9c5b9d458bc618fb9d7d8590c866655e92f9cb0b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 29 Aug 2007 14:41:49 -0700 Subject: Use ati_pcigart for PCI-e GART table handling. --- linux-core/xgi_drv.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index d43a6b4e..f2768d1b 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -64,7 +64,7 @@ struct xgi_info { struct drm_map *fb_map; /* look up table parameters */ - struct drm_dma_handle *lut_handle; + struct ati_pcigart_info gart_info; unsigned int lutPageSize; struct drm_sman sman; @@ -87,7 +87,6 @@ extern int xgi_free(struct xgi_info * info, unsigned long index, struct drm_file * filp); extern int xgi_pcie_heap_init(struct xgi_info * info); -extern void xgi_pcie_lut_cleanup(struct xgi_info * info); extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address); -- cgit v1.2.3 From c597bd57eee3ea05a3b8c851615c7351d0b32fce Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 6 Sep 2007 15:20:52 -0700 Subject: Bump version to 1.0.0. --- linux-core/xgi_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index f2768d1b..88ade64d 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -35,10 +35,10 @@ #define DRIVER_NAME "xgi" #define DRIVER_DESC "XGI XP5 / XP10 / XG47" -#define DRIVER_DATE "20070814" +#define DRIVER_DATE "20070906" -#define DRIVER_MAJOR 0 -#define DRIVER_MINOR 13 +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 #define DRIVER_PATCHLEVEL 0 #include "xgi_cmdlist.h" -- cgit v1.2.3 From a3881ad2fef99aaf0a863609a847020ea822798c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 18 Sep 2007 11:03:49 -0700 Subject: Add ioc32 compat layer for XGI DRM. --- linux-core/xgi_drv.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'linux-core/xgi_drv.h') diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index 88ade64d..a68dc03b 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -35,10 +35,10 @@ #define DRIVER_NAME "xgi" #define DRIVER_DESC "XGI XP5 / XP10 / XG47" -#define DRIVER_DATE "20070906" +#define DRIVER_DATE "20070918" #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 +#define DRIVER_MINOR 1 #define DRIVER_PATCHLEVEL 0 #include "xgi_cmdlist.h" @@ -78,6 +78,9 @@ struct xgi_info { unsigned next_sequence; }; +extern long xgi_compat_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg); + extern int xgi_fb_heap_init(struct xgi_info * info); extern int xgi_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc, -- cgit v1.2.3