diff options
Diffstat (limited to 'drivers/mxc/amd-gpu/include/api')
-rw-r--r-- | drivers/mxc/amd-gpu/include/api/gsl_displayapi.h | 86 | ||||
-rw-r--r-- | drivers/mxc/amd-gpu/include/api/gsl_klibapi.h | 135 | ||||
-rw-r--r-- | drivers/mxc/amd-gpu/include/api/gsl_libapi.h | 142 | ||||
-rw-r--r-- | drivers/mxc/amd-gpu/include/api/gsl_pm4types.h | 157 | ||||
-rw-r--r-- | drivers/mxc/amd-gpu/include/api/gsl_properties.h | 94 | ||||
-rw-r--r-- | drivers/mxc/amd-gpu/include/api/gsl_types.h | 479 | ||||
-rw-r--r-- | drivers/mxc/amd-gpu/include/api/gsl_utils.h | 43 |
7 files changed, 1136 insertions, 0 deletions
diff --git a/drivers/mxc/amd-gpu/include/api/gsl_displayapi.h b/drivers/mxc/amd-gpu/include/api/gsl_displayapi.h new file mode 100644 index 000000000000..7ec10b0c2556 --- /dev/null +++ b/drivers/mxc/amd-gpu/include/api/gsl_displayapi.h @@ -0,0 +1,86 @@ +/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora Forum nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __GSL_DISPLAYAPI_H +#define __GSL_DISPLAYAPI_H + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +////////////////////////////////////////////////////////////////////////////// +// entrypoints +////////////////////////////////////////////////////////////////////////////// +#ifdef __GSLDISPLAY_EXPORTS +#define DISP_API OS_DLLEXPORT +#else +#define DISP_API OS_DLLIMPORT +#endif // __GSLDISPLAY_EXPORTS + + +////////////////////////////////////////////////////////////////////////////// +// defines +////////////////////////////////////////////////////////////////////////////// +#define GSL_DISPLAY_PANEL_TOSHIBA_640x480 0 +#define GSL_DISPLAY_PANEL_HITACHI_240x320 1 +#define GSL_DISPLAY_PANEL_DEFAULT GSL_DISPLAY_PANEL_TOSHIBA_640x480 + + +////////////////////////////////////////////////////////////////////////////// +// types +////////////////////////////////////////////////////////////////////////////// +typedef int gsl_display_id_t; +typedef int gsl_surface_id_t; + +typedef struct _gsl_displaymode_t { + int panel_id; + int width; + int height; + int bpp; + int orientation; + int frequency; +} gsl_displaymode_t; + + +////////////////////////////////////////////////////////////////////////////// +// prototypes +////////////////////////////////////////////////////////////////////////////// +DISP_API gsl_display_id_t gsl_display_open(gsl_devhandle_t devhandle, int panel_id); +DISP_API int gsl_display_close(gsl_display_id_t display_id); +DISP_API int gsl_display_getcount(void); +DISP_API int gsl_display_setmode(gsl_display_id_t display_id, gsl_displaymode_t displaymode); +DISP_API int gsl_display_getmode(gsl_display_id_t display_id, gsl_displaymode_t *displaymode); +DISP_API gsl_surface_id_t gsl_display_setsurface(gsl_display_id_t display_id, void *buffer); +DISP_API int gsl_display_getactivesurface(gsl_display_id_t display_id, void **buffer); +DISP_API int gsl_display_flipsurface(gsl_display_id_t display_id, gsl_surface_id_t surface_id); + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // __GSL_DISPLAYAPI_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_klibapi.h b/drivers/mxc/amd-gpu/include/api/gsl_klibapi.h new file mode 100644 index 000000000000..8476f5a95969 --- /dev/null +++ b/drivers/mxc/amd-gpu/include/api/gsl_klibapi.h @@ -0,0 +1,135 @@ +/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora Forum nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __GSL_KLIBAPI_H +#define __GSL_KLIBAPI_H + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#include "gsl_types.h" +#include "gsl_properties.h" + + +////////////////////////////////////////////////////////////////////////////// +// entrypoints +////////////////////////////////////////////////////////////////////////////// +#ifdef __KGSLLIB_EXPORTS +#define KGSL_API OS_DLLEXPORT +#else +#ifdef __KERNEL_MODE__ +#define KGSL_API extern +#else +#define KGSL_API OS_DLLIMPORT +#endif +#endif // __KGSLLIB_EXPORTS + + +////////////////////////////////////////////////////////////////////////////// +// version control +////////////////////////////////////////////////////////////////////////////// +#define KGSLLIB_NAME "AMD GSL Kernel Library" +#define KGSLLIB_VERSION "0.1" + + +////////////////////////////////////////////////////////////////////////////// +// library API +////////////////////////////////////////////////////////////////////////////// +KGSL_API int kgsl_driver_init(void); +KGSL_API int kgsl_driver_close(void); +KGSL_API int kgsl_driver_entry(gsl_flags_t flags); +KGSL_API int kgsl_driver_exit(void); +KGSL_API int kgsl_driver_destroy(unsigned int pid); + + +//////////////////////////////////////////////////////////////////////////// +// device API +//////////////////////////////////////////////////////////////////////////// +KGSL_API int kgsl_device_start(gsl_deviceid_t device_id, gsl_flags_t flags); +KGSL_API int kgsl_device_stop(gsl_deviceid_t device_id); +KGSL_API int kgsl_device_idle(gsl_deviceid_t device_id, unsigned int timeout); +KGSL_API int kgsl_device_getproperty(gsl_deviceid_t device_id, gsl_property_type_t type, void *value, unsigned int sizebytes); +KGSL_API int kgsl_device_setproperty(gsl_deviceid_t device_id, gsl_property_type_t type, void *value, unsigned int sizebytes); +KGSL_API int kgsl_device_regread(gsl_deviceid_t device_id, unsigned int offsetwords, unsigned int *value); +KGSL_API int kgsl_device_regwrite(gsl_deviceid_t device_id, unsigned int offsetwords, unsigned int value); +KGSL_API int kgsl_device_waitirq(gsl_deviceid_t device_id, gsl_intrid_t intr_id, unsigned int *count, unsigned int timeout); + + +//////////////////////////////////////////////////////////////////////////// +// command API +//////////////////////////////////////////////////////////////////////////// +KGSL_API int kgsl_cmdstream_issueibcmds(gsl_deviceid_t device_id, int drawctxt_index, gpuaddr_t ibaddr, int sizedwords, gsl_timestamp_t *timestamp, gsl_flags_t flags); +KGSL_API gsl_timestamp_t kgsl_cmdstream_readtimestamp(gsl_deviceid_t device_id, gsl_timestamp_type_t type); +KGSL_API int kgsl_cmdstream_freememontimestamp(gsl_deviceid_t device_id, gsl_memdesc_t *memdesc, gsl_timestamp_t timestamp, gsl_timestamp_type_t type); +KGSL_API int kgsl_cmdstream_waittimestamp(gsl_deviceid_t device_id, gsl_timestamp_t timestamp, unsigned int timeout); +KGSL_API int kgsl_cmdwindow_write(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned int addr, unsigned int data); +KGSL_API int kgsl_add_timestamp(gsl_deviceid_t device_id, gsl_timestamp_t *timestamp); +KGSL_API int kgsl_cmdstream_check_timestamp(gsl_deviceid_t device_id, gsl_timestamp_t timestamp); + +//////////////////////////////////////////////////////////////////////////// +// context API +//////////////////////////////////////////////////////////////////////////// +KGSL_API int kgsl_context_create(gsl_deviceid_t device_id, gsl_context_type_t type, unsigned int *drawctxt_id, gsl_flags_t flags); +KGSL_API int kgsl_context_destroy(gsl_deviceid_t device_id, unsigned int drawctxt_id); +KGSL_API int kgsl_drawctxt_bind_gmem_shadow(gsl_deviceid_t device_id, unsigned int drawctxt_id, const gsl_rect_t* gmem_rect, unsigned int shadow_x, unsigned int shadow_y, const gsl_buffer_desc_t* shadow_buffer, unsigned int buffer_id); + + +//////////////////////////////////////////////////////////////////////////// +// sharedmem API +//////////////////////////////////////////////////////////////////////////// +KGSL_API int kgsl_sharedmem_alloc(gsl_deviceid_t device_id, gsl_flags_t flags, int sizebytes, gsl_memdesc_t *memdesc); +KGSL_API int kgsl_sharedmem_free(gsl_memdesc_t *memdesc); +KGSL_API int kgsl_sharedmem_read(const gsl_memdesc_t *memdesc, void *dst, unsigned int offsetbytes, unsigned int sizebytes, unsigned int touserspace); +KGSL_API int kgsl_sharedmem_write(const gsl_memdesc_t *memdesc, unsigned int offsetbytes, void *src, unsigned int sizebytes, unsigned int fromuserspace); +KGSL_API int kgsl_sharedmem_set(const gsl_memdesc_t *memdesc, unsigned int offsetbytes, unsigned int value, unsigned int sizebytes); +KGSL_API unsigned int kgsl_sharedmem_largestfreeblock(gsl_deviceid_t device_id, gsl_flags_t flags); +KGSL_API int kgsl_sharedmem_map(gsl_deviceid_t device_id, gsl_flags_t flags, const gsl_scatterlist_t *scatterlist, gsl_memdesc_t *memdesc); +KGSL_API int kgsl_sharedmem_unmap(gsl_memdesc_t *memdesc); +KGSL_API int kgsl_sharedmem_getmap(const gsl_memdesc_t *memdesc, gsl_scatterlist_t *scatterlist); +KGSL_API int kgsl_sharedmem_cacheoperation(const gsl_memdesc_t *memdesc, unsigned int offsetbytes, unsigned int sizebytes, unsigned int operation); +KGSL_API int kgsl_sharedmem_fromhostpointer(gsl_deviceid_t device_id, gsl_memdesc_t *memdesc, void* hostptr); + + +//////////////////////////////////////////////////////////////////////////// +// interrupt API +//////////////////////////////////////////////////////////////////////////// +KGSL_API void kgsl_intr_isr(void); + + +//////////////////////////////////////////////////////////////////////////// +// TB dump API +//////////////////////////////////////////////////////////////////////////// +KGSL_API int kgsl_tbdump_waitirq(void); +KGSL_API int kgsl_tbdump_exportbmp(const void* addr, unsigned int format, unsigned int stride, unsigned int width, unsigned int height); + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // __GSL_KLIBAPI_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_libapi.h b/drivers/mxc/amd-gpu/include/api/gsl_libapi.h new file mode 100644 index 000000000000..7a5be862f3ee --- /dev/null +++ b/drivers/mxc/amd-gpu/include/api/gsl_libapi.h @@ -0,0 +1,142 @@ +/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora Forum nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __GSL_LIBAPI_H +#define __GSL_LIBAPI_H + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#include "gsl_types.h" + +////////////////////////////////////////////////////////////////////////////// +// entrypoints +////////////////////////////////////////////////////////////////////////////// +#ifdef __GSLLIB_EXPORTS +#define GSL_API OS_DLLEXPORT +#else +#define GSL_API OS_DLLIMPORT +#endif // __GSLLIB_EXPORTS + + +////////////////////////////////////////////////////////////////////////////// +// defines +////////////////////////////////////////////////////////////////////////////// +#define GSLLIB_NAME "AMD GSL User Library" +#define GSLLIB_VERSION "0.1" + + +////////////////////////////////////////////////////////////////////////////// +// libary API +////////////////////////////////////////////////////////////////////////////// +GSL_API int gsl_library_open(gsl_flags_t flags); +GSL_API int gsl_library_close(void); + + +//////////////////////////////////////////////////////////////////////////// +// device API +//////////////////////////////////////////////////////////////////////////// +GSL_API gsl_devhandle_t gsl_device_open(gsl_deviceid_t device_id, gsl_flags_t flags); +GSL_API int gsl_device_close(gsl_devhandle_t devhandle); +GSL_API int gsl_device_idle(gsl_devhandle_t devhandle, unsigned int timeout); +GSL_API int gsl_device_getcount(void); +GSL_API int gsl_device_getinfo(gsl_devhandle_t devhandle, gsl_devinfo_t *devinfo); +GSL_API int gsl_device_setpowerstate(gsl_devhandle_t devhandle, gsl_flags_t flags); +GSL_API int gsl_device_setdmistate(gsl_devhandle_t devhandle, gsl_flags_t flags); +GSL_API int gsl_device_waitirq(gsl_devhandle_t devhandle, gsl_intrid_t intr_id, unsigned int *count, unsigned int timeout); +GSL_API int gsl_device_waittimestamp(gsl_devhandle_t devhandle, gsl_timestamp_t timestamp, unsigned int timeout); +GSL_API int gsl_device_addtimestamp(gsl_devhandle_t devhandle, gsl_timestamp_t *timestamp); + +////////////////////////////////////////////////////////////////////////////// +// direct register API +////////////////////////////////////////////////////////////////////////////// +GSL_API int gsl_register_read(gsl_devhandle_t devhandle, unsigned int offsetwords, unsigned int *data); + + +////////////////////////////////////////////////////////////////////////////// +// command API +////////////////////////////////////////////////////////////////////////////// +GSL_API int gsl_cp_issueibcommands(gsl_devhandle_t devhandle, gsl_ctxthandle_t ctxthandle, gpuaddr_t ibaddr, unsigned int sizewords, gsl_timestamp_t *timestamp, gsl_flags_t flags); +GSL_API gsl_timestamp_t gsl_cp_readtimestamp(gsl_devhandle_t devhandle, gsl_timestamp_type_t type); +GSL_API int gsl_cp_checktimestamp(gsl_devhandle_t devhandle, gsl_timestamp_t timestamp, gsl_timestamp_type_t type); +GSL_API int gsl_cp_freememontimestamp(gsl_devhandle_t devhandle, gsl_memdesc_t *memdesc, gsl_timestamp_t timestamp, gsl_timestamp_type_t type); +GSL_API int gsl_v3_issuecommand(gsl_devhandle_t devhandle, gsl_cmdwindow_t target, unsigned int addr, unsigned int data); + + +////////////////////////////////////////////////////////////////////////////// +// context API +////////////////////////////////////////////////////////////////////////////// +GSL_API gsl_ctxthandle_t gsl_context_create(gsl_devhandle_t devhandle, gsl_context_type_t type, gsl_flags_t flags); +GSL_API int gsl_context_destroy(gsl_devhandle_t devhandle, gsl_ctxthandle_t ctxthandle); +GSL_API int gsl_context_bind_gmem_shadow(gsl_devhandle_t devhandle, gsl_ctxthandle_t ctxthandle, const gsl_rect_t* gmem_rect, unsigned int shadow_x, unsigned int shadow_y, const gsl_buffer_desc_t* shadow_buffer, unsigned int buffer_id); + + + +////////////////////////////////////////////////////////////////////////////// +// sharedmem API +////////////////////////////////////////////////////////////////////////////// +GSL_API int gsl_memory_alloc(gsl_deviceid_t device_id, unsigned int sizebytes, gsl_flags_t flags, gsl_memdesc_t *memdesc); +GSL_API int gsl_memory_free(gsl_memdesc_t *memdesc); +GSL_API int gsl_memory_read(const gsl_memdesc_t *memdesc, void *dst, unsigned int sizebytes, unsigned int offsetbytes); +GSL_API int gsl_memory_write(const gsl_memdesc_t *memdesc, void *src, unsigned int sizebytes, unsigned int offsetbytes); +GSL_API int gsl_memory_write_multiple(const gsl_memdesc_t *memdesc, void *src, unsigned int srcstridebytes, unsigned int dststridebytes, unsigned int blocksizebytes, unsigned int numblocks, unsigned int offsetbytes); +GSL_API unsigned int gsl_memory_getlargestfreeblock(gsl_deviceid_t device_id, gsl_flags_t flags); +GSL_API int gsl_memory_set(const gsl_memdesc_t *memdesc, unsigned int offsetbytes, unsigned int value, unsigned int sizebytes); +GSL_API int gsl_memory_cacheoperation(const gsl_memdesc_t *memdesc, unsigned int offsetbytes, unsigned int sizebytes, unsigned int operation); +GSL_API int gsl_memory_fromhostpointer(gsl_deviceid_t device_id, gsl_memdesc_t *memdesc, void* hostptr); + +#ifdef _DIRECT_MAPPED +GSL_API unsigned int gsl_sharedmem_gethostaddr(const gsl_memdesc_t *memdesc); +#endif // _DIRECT_MAPPED + +////////////////////////////////////////////////////////////////////////////// +// address translation API +////////////////////////////////////////////////////////////////////////////// +GSL_API int gsl_translate_physaddr(void* virtAddr, unsigned int* physAddr); + + +////////////////////////////////////////////////////////////////////////////// +// TB dump API +////////////////////////////////////////////////////////////////////////////// +GSL_API int gsl_tbdump_waitirq(); +GSL_API int gsl_tbdump_exportbmp(const void* addr, unsigned int format, unsigned int stride, unsigned int width, unsigned int height); + +////////////////////////////////////////////////////////////////////////////// +// OS specific APIs - need to go into their own gsl_libapi_platform.h file +////////////////////////////////////////////////////////////////////////////// +#ifdef WM7 +GSL_API int gsl_kos_wm7_surfobjfromhbitmap(HBITMAP hbitmap, SURFOBJ *surfobj); +#endif // WM7 + + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // __GSL_LIBAPI_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_pm4types.h b/drivers/mxc/amd-gpu/include/api/gsl_pm4types.h new file mode 100644 index 000000000000..891c7b645ad6 --- /dev/null +++ b/drivers/mxc/amd-gpu/include/api/gsl_pm4types.h @@ -0,0 +1,157 @@ +/* Copyright (c) 2002,2007-2009, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __GSL_PM4TYPES_H +#define __GSL_PM4TYPES_H + + +////////////////////////////////////////////////////////////////////////////// +// packet mask +////////////////////////////////////////////////////////////////////////////// +#define PM4_PKT_MASK 0xc0000000 + + +////////////////////////////////////////////////////////////////////////////// +// packet types +////////////////////////////////////////////////////////////////////////////// +#define PM4_TYPE0_PKT ((unsigned int)0 << 30) +#define PM4_TYPE1_PKT ((unsigned int)1 << 30) +#define PM4_TYPE2_PKT ((unsigned int)2 << 30) +#define PM4_TYPE3_PKT ((unsigned int)3 << 30) + + +////////////////////////////////////////////////////////////////////////////// +// type3 packets +////////////////////////////////////////////////////////////////////////////// +#define PM4_ME_INIT 0x48 // initialize CP's micro-engine + +#define PM4_NOP 0x10 // skip N 32-bit words to get to the next packet + +#define PM4_INDIRECT_BUFFER 0x3f // indirect buffer dispatch. prefetch parser uses this packet type to determine whether to pre-fetch the IB +#define PM4_INDIRECT_BUFFER_PFD 0x37 // indirect buffer dispatch. same as IB, but init is pipelined + +#define PM4_WAIT_FOR_IDLE 0x26 // wait for the IDLE state of the engine +#define PM4_WAIT_REG_MEM 0x3c // wait until a register or memory location is a specific value +#define PM4_WAIT_REG_EQ 0x52 // wait until a register location is equal to a specific value +#define PM4_WAT_REG_GTE 0x53 // wait until a register location is >= a specific value +#define PM4_WAIT_UNTIL_READ 0x5c // wait until a read completes +#define PM4_WAIT_IB_PFD_COMPLETE 0x5d // wait until all base/size writes from an IB_PFD packet have completed + +#define PM4_REG_RMW 0x21 // register read/modify/write +#define PM4_REG_TO_MEM 0x3e // reads register in chip and writes to memory +#define PM4_MEM_WRITE 0x3d // write N 32-bit words to memory +#define PM4_MEM_WRITE_CNTR 0x4f // write CP_PROG_COUNTER value to memory +#define PM4_COND_EXEC 0x44 // conditional execution of a sequence of packets +#define PM4_COND_WRITE 0x45 // conditional write to memory or register + +#define PM4_EVENT_WRITE 0x46 // generate an event that creates a write to memory when completed +#define PM4_EVENT_WRITE_SHD 0x58 // generate a VS|PS_done event +#define PM4_EVENT_WRITE_CFL 0x59 // generate a cache flush done event +#define PM4_EVENT_WRITE_ZPD 0x5b // generate a z_pass done event + +#define PM4_DRAW_INDX 0x22 // initiate fetch of index buffer and draw +#define PM4_DRAW_INDX_2 0x36 // draw using supplied indices in packet +#define PM4_DRAW_INDX_BIN 0x34 // initiate fetch of index buffer and binIDs and draw +#define PM4_DRAW_INDX_2_BIN 0x35 // initiate fetch of bin IDs and draw using supplied indices + +#define PM4_VIZ_QUERY 0x23 // begin/end initiator for viz query extent processing +#define PM4_SET_STATE 0x25 // fetch state sub-blocks and initiate shader code DMAs +#define PM4_SET_CONSTANT 0x2d // load constant into chip and to memory +#define PM4_IM_LOAD 0x27 // load sequencer instruction memory (pointer-based) +#define PM4_IM_LOAD_IMMEDIATE 0x2b // load sequencer instruction memory (code embedded in packet) +#define PM4_LOAD_CONSTANT_CONTEXT 0x2e // load constants from a location in memory +#define PM4_INVALIDATE_STATE 0x3b // selective invalidation of state pointers + +#define PM4_SET_SHADER_BASES 0x4A // dynamically changes shader instruction memory partition +#define PM4_SET_BIN_BASE_OFFSET 0x4B // program an offset that will added to the BIN_BASE value of the 3D_DRAW_INDX_BIN packet +#define PM4_SET_BIN_MASK 0x50 // sets the 64-bit BIN_MASK register in the PFP +#define PM4_SET_BIN_SELECT 0x51 // sets the 64-bit BIN_SELECT register in the PFP + +#define PM4_CONTEXT_UPDATE 0x5e // updates the current context, if needed +#define PM4_INTERRUPT 0x40 // generate interrupt from the command stream + +#define PM4_IM_STORE 0x2c // copy sequencer instruction memory to system memory + + +////////////////////////////////////////////////////////////////////////////// +// packet header building macros +////////////////////////////////////////////////////////////////////////////// +#define pm4_type0_packet(regindx, cnt) (PM4_TYPE0_PKT | (((cnt)-1) << 16) | ((regindx) & 0x7FFF)) +#define pm4_type0_packet_for_sameregister(regindx, cnt) (PM4_TYPE0_PKT | (((cnt)-1) << 16) | ((1 << 15) | ((regindx) & 0x7FFF)) +#define pm4_type1_packet(reg0, reg1) (PM4_TYPE1_PKT | ((reg1) << 12) | (reg0)) +#define pm4_type3_packet(opcode, cnt) (PM4_TYPE3_PKT | (((cnt)-1) << 16) | (((opcode) & 0xFF) << 8)) +#define pm4_predicated_type3_packet(opcode, cnt) (PM4_TYPE3_PKT | (((cnt)-1) << 16) | (((opcode) & 0xFF) << 8) | 0x1)) +#define pm4_nop_packet(cnt) (PM4_TYPE3_PKT | (((cnt)-1) << 16) | (PM4_NOP << 8)) + + +////////////////////////////////////////////////////////////////////////////// +// packet headers +////////////////////////////////////////////////////////////////////////////// +#define PM4_HDR_ME_INIT pm4_type3_packet(PM4_ME_INIT, 18) +#define PM4_HDR_INDIRECT_BUFFER_PFD pm4_type3_packet(PM4_INDIRECT_BUFFER_PFD, 2) +#define PM4_HDR_INDIRECT_BUFFER pm4_type3_packet(PM4_INDIRECT_BUFFER, 2) + + +////////////////////////////////////////////////////////////////////////////// +// types +////////////////////////////////////////////////////////////////////////////// + +// ----------------------- +// pm4 type0 packet header +// ----------------------- +typedef struct __pm4_type0 +{ + unsigned int base_index :15; + unsigned int one_reg_wr :1; + unsigned int count :14; + unsigned int type :2; +} pm4_type0; + +// ----------------------- +// pm4 type2 packet header +// ----------------------- +typedef struct __pm4_type2 +{ + unsigned int reserved :30; + unsigned int type :2; +} pm4_type2; + +// ----------------------- +// pm4 type3 packet header +// ----------------------- +typedef struct __pm4_type3 +{ + unsigned int predicate :1; + unsigned int reserved1 :7; + unsigned int it_opcode :7; + unsigned int reserved2 :1; + unsigned int count :14; + unsigned int type :2; +} pm4_type3; + +#endif // __GSL_PM4TYPES_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_properties.h b/drivers/mxc/amd-gpu/include/api/gsl_properties.h new file mode 100644 index 000000000000..520761fe3490 --- /dev/null +++ b/drivers/mxc/amd-gpu/include/api/gsl_properties.h @@ -0,0 +1,94 @@ +/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora Forum nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __GSL_PROPERTIES_H +#define __GSL_PROPERTIES_H + + +////////////////////////////////////////////////////////////////////////////// +// types +////////////////////////////////////////////////////////////////////////////// + +// -------------- +// property types +// -------------- +typedef enum _gsl_property_type_t +{ + GSL_PROP_DEVICE_INFO = 0x00000001, + GSL_PROP_DEVICE_SHADOW = 0x00000002, + GSL_PROP_DEVICE_POWER = 0x00000003, + GSL_PROP_SHMEM = 0x00000004, + GSL_PROP_SHMEM_APERTURES = 0x00000005, + GSL_PROP_DEVICE_DMI = 0x00000006 +} gsl_property_type_t; + +// ----------------- +// aperture property +// ----------------- +typedef struct _gsl_apertureprop_t { + unsigned int gpuaddr; + unsigned int hostaddr; +} gsl_apertureprop_t; + +// -------------- +// shmem property +// -------------- +typedef struct _gsl_shmemprop_t { + int numapertures; + unsigned int aperture_mask; + unsigned int aperture_shift; + gsl_apertureprop_t *aperture; +} gsl_shmemprop_t; + +// ----------------------------- +// device shadow memory property +// ----------------------------- +typedef struct _gsl_shadowprop_t { + unsigned int hostaddr; + unsigned int size; + gsl_flags_t flags; +} gsl_shadowprop_t; + +// --------------------- +// device power property +// --------------------- +typedef struct _gsl_powerprop_t { + unsigned int value; + gsl_flags_t flags; +} gsl_powerprop_t; + + +// --------------------- +// device DMI property +// --------------------- +typedef struct _gsl_dmiprop_t { + unsigned int value; + gsl_flags_t flags; +} gsl_dmiprop_t; + +#endif // __GSL_PROPERTIES_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_types.h b/drivers/mxc/amd-gpu/include/api/gsl_types.h new file mode 100644 index 000000000000..310c1a9f5d00 --- /dev/null +++ b/drivers/mxc/amd-gpu/include/api/gsl_types.h @@ -0,0 +1,479 @@ +/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora Forum nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __GSL_TYPES_H +#define __GSL_TYPES_H + +#include "stddef.h" + + +////////////////////////////////////////////////////////////////////////////// +// status +////////////////////////////////////////////////////////////////////////////// +#define GSL_SUCCESS OS_SUCCESS +#define GSL_FAILURE OS_FAILURE +#define GSL_FAILURE_SYSTEMERROR OS_FAILURE_SYSTEMERROR +#define GSL_FAILURE_DEVICEERROR OS_FAILURE_DEVICEERROR +#define GSL_FAILURE_OUTOFMEM OS_FAILURE_OUTOFMEM +#define GSL_FAILURE_BADPARAM OS_FAILURE_BADPARAM +#define GSL_FAILURE_OFFSETINVALID OS_FAILURE_OFFSETINVALID +#define GSL_FAILURE_NOTSUPPORTED OS_FAILURE_NOTSUPPORTED +#define GSL_FAILURE_NOMOREAVAILABLE OS_FAILURE_NOMOREAVAILABLE +#define GSL_FAILURE_NOTINITIALIZED OS_FAILURE_NOTINITIALIZED +#define GSL_FAILURE_ALREADYINITIALIZED OS_FAILURE_ALREADYINITIALIZED +#define GSL_FAILURE_TIMEOUT OS_FAILURE_TIMEOUT + + +////////////////////////////////////////////////////////////////////////////// +// memory allocation flags +////////////////////////////////////////////////////////////////////////////// +#define GSL_MEMFLAGS_ANY 0x00000000 // dont care + +#define GSL_MEMFLAGS_CHANNELANY 0x00000000 +#define GSL_MEMFLAGS_CHANNEL1 0x00000000 +#define GSL_MEMFLAGS_CHANNEL2 0x00000001 +#define GSL_MEMFLAGS_CHANNEL3 0x00000002 +#define GSL_MEMFLAGS_CHANNEL4 0x00000003 + +#define GSL_MEMFLAGS_BANKANY 0x00000000 +#define GSL_MEMFLAGS_BANK1 0x00000010 +#define GSL_MEMFLAGS_BANK2 0x00000020 +#define GSL_MEMFLAGS_BANK3 0x00000040 +#define GSL_MEMFLAGS_BANK4 0x00000080 + +#define GSL_MEMFLAGS_DIRANY 0x00000000 +#define GSL_MEMFLAGS_DIRTOP 0x00000100 +#define GSL_MEMFLAGS_DIRBOT 0x00000200 + +#define GSL_MEMFLAGS_APERTUREANY 0x00000000 +#define GSL_MEMFLAGS_EMEM 0x00000000 +#define GSL_MEMFLAGS_CONPHYS 0x00001000 + +#define GSL_MEMFLAGS_ALIGNANY 0x00000000 // minimum alignment is 32 bytes +#define GSL_MEMFLAGS_ALIGN32 0x00000000 +#define GSL_MEMFLAGS_ALIGN64 0x00060000 +#define GSL_MEMFLAGS_ALIGN128 0x00070000 +#define GSL_MEMFLAGS_ALIGN256 0x00080000 +#define GSL_MEMFLAGS_ALIGN512 0x00090000 +#define GSL_MEMFLAGS_ALIGN1K 0x000A0000 +#define GSL_MEMFLAGS_ALIGN2K 0x000B0000 +#define GSL_MEMFLAGS_ALIGN4K 0x000C0000 +#define GSL_MEMFLAGS_ALIGN8K 0x000D0000 +#define GSL_MEMFLAGS_ALIGN16K 0x000E0000 +#define GSL_MEMFLAGS_ALIGN32K 0x000F0000 +#define GSL_MEMFLAGS_ALIGN64K 0x00100000 +#define GSL_MEMFLAGS_ALIGNPAGE GSL_MEMFLAGS_ALIGN4K + +#define GSL_MEMFLAGS_GPUREADWRITE 0x00000000 +#define GSL_MEMFLAGS_GPUREADONLY 0x01000000 +#define GSL_MEMFLAGS_GPUWRITEONLY 0x02000000 +#define GSL_MEMFLAGS_GPUNOACCESS 0x04000000 + +#define GSL_MEMFLAGS_FORCEPAGESIZE 0x40000000 +#define GSL_MEMFLAGS_STRICTREQUEST 0x80000000 // fail the alloc if the flags cannot be honored + +#define GSL_MEMFLAGS_CHANNEL_MASK 0x0000000F +#define GSL_MEMFLAGS_BANK_MASK 0x000000F0 +#define GSL_MEMFLAGS_DIR_MASK 0x00000F00 +#define GSL_MEMFLAGS_APERTURE_MASK 0x0000F000 +#define GSL_MEMFLAGS_ALIGN_MASK 0x00FF0000 +#define GSL_MEMFLAGS_GPUAP_MASK 0x0F000000 + +#define GSL_MEMFLAGS_CHANNEL_SHIFT 0 +#define GSL_MEMFLAGS_BANK_SHIFT 4 +#define GSL_MEMFLAGS_DIR_SHIFT 8 +#define GSL_MEMFLAGS_APERTURE_SHIFT 12 +#define GSL_MEMFLAGS_ALIGN_SHIFT 16 +#define GSL_MEMFLAGS_GPUAP_SHIFT 24 + + +////////////////////////////////////////////////////////////////////////////// +// debug flags +////////////////////////////////////////////////////////////////////////////// +#define GSL_DBGFLAGS_ALL 0xFFFFFFFF +#define GSL_DBGFLAGS_DEVICE 0x00000001 +#define GSL_DBGFLAGS_CTXT 0x00000002 +#define GSL_DBGFLAGS_MEMMGR 0x00000004 +#define GSL_DBGFLAGS_MMU 0x00000008 +#define GSL_DBGFLAGS_POWER 0x00000010 +#define GSL_DBGFLAGS_IRQ 0x00000020 +#define GSL_DBGFLAGS_BIST 0x00000040 +#define GSL_DBGFLAGS_PM4 0x00000080 +#define GSL_DBGFLAGS_PM4MEM 0x00000100 +#define GSL_DBGFLAGS_PM4CHECK 0x00000200 +#define GSL_DBGFLAGS_DUMPX 0x00000400 +#define GSL_DBGFLAGS_DUMPX_WITHOUT_IFH 0x00000800 +#define GSL_DBGFLAGS_IFH 0x00001000 +#define GSL_DBGFLAGS_NULL 0x00002000 + + +////////////////////////////////////////////////////////////////////////////// +// generic flag values +////////////////////////////////////////////////////////////////////////////// +#define GSL_FLAGS_NORMALMODE 0x00000000 +#define GSL_FLAGS_SAFEMODE 0x00000001 +#define GSL_FLAGS_INITIALIZED0 0x00000002 +#define GSL_FLAGS_INITIALIZED 0x00000004 +#define GSL_FLAGS_STARTED 0x00000008 +#define GSL_FLAGS_ACTIVE 0x00000010 +#define GSL_FLAGS_RESERVED0 0x00000020 +#define GSL_FLAGS_RESERVED1 0x00000040 +#define GSL_FLAGS_RESERVED2 0x00000080 + + +////////////////////////////////////////////////////////////////////////////// +// power flags +////////////////////////////////////////////////////////////////////////////// +#define GSL_PWRFLAGS_POWER_OFF 0x00000001 +#define GSL_PWRFLAGS_POWER_ON 0x00000002 +#define GSL_PWRFLAGS_CLK_ON 0x00000004 +#define GSL_PWRFLAGS_CLK_OFF 0x00000008 +#define GSL_PWRFLAGS_OVERRIDE_ON 0x00000010 +#define GSL_PWRFLAGS_OVERRIDE_OFF 0x00000020 + +////////////////////////////////////////////////////////////////////////////// +// DMI flags +////////////////////////////////////////////////////////////////////////////// +#define GSL_DMIFLAGS_ENABLE_SINGLE 0x00000001 // Single buffered DMI +#define GSL_DMIFLAGS_ENABLE_DOUBLE 0x00000002 // Double buffered DMI +#define GSL_DMIFLAGS_ENABLE_TRIPLE 0x00000004 // Triple buffered DMI +#define GSL_DMIFLAGS_DISABLE 0x00000008 +#define GSL_DMIFLAGS_NEXT_BUFFER 0x00000010 + +////////////////////////////////////////////////////////////////////////////// +// cache flags +////////////////////////////////////////////////////////////////////////////// +#define GSL_CACHEFLAGS_CLEAN 0x00000001 /* flush cache */ +#define GSL_CACHEFLAGS_INVALIDATE 0x00000002 /* invalidate cache */ +#define GSL_CACHEFLAGS_WRITECLEAN 0x00000004 /* flush write cache */ + + +////////////////////////////////////////////////////////////////////////////// +// context +////////////////////////////////////////////////////////////////////////////// +#define GSL_CONTEXT_MAX 20 +#define GSL_CONTEXT_NONE 0 +#define GSL_CONTEXT_SAVE_GMEM 1 +#define GSL_CONTEXT_NO_GMEM_ALLOC 2 + + +////////////////////////////////////////////////////////////////////////////// +// other +////////////////////////////////////////////////////////////////////////////// +#define GSL_TIMEOUT_NONE 0 +#define GSL_TIMEOUT_DEFAULT 0xFFFFFFFF + +#ifdef _LINUX +#define GSL_PAGESIZE PAGE_SIZE +#define GSL_PAGESIZE_SHIFT PAGE_SHIFT +#else +#define GSL_PAGESIZE 0x1000 +#define GSL_PAGESIZE_SHIFT 12 +#endif + +////////////////////////////////////////////////////////////////////////////// +// types +////////////////////////////////////////////////////////////////////////////// +typedef unsigned int gsl_devhandle_t; +typedef unsigned int gsl_ctxthandle_t; +typedef int gsl_timestamp_t; +typedef unsigned int gsl_flags_t; +typedef unsigned int gpuaddr_t; + +// --------- +// device id +// --------- +typedef enum _gsl_deviceid_t +{ + GSL_DEVICE_ANY = 0, + GSL_DEVICE_YAMATO = 1, + GSL_DEVICE_G12 = 2, + GSL_DEVICE_MAX = 2, + + GSL_DEVICE_FOOBAR = 0x7FFFFFFF +} gsl_deviceid_t; + +// ---------------- +// chip revision id +// ---------------- +// +// coreid:8 majorrev:8 minorrev:8 patch:8 +// +// coreid = 0x00 = YAMATO_DX +// coreid = 0x80 = G12 +// + +#define COREID(x) ((((unsigned int)x & 0xFF) << 24)) +#define MAJORID(x) ((((unsigned int)x & 0xFF) << 16)) +#define MINORID(x) ((((unsigned int)x & 0xFF) << 8)) +#define PATCHID(x) ((((unsigned int)x & 0xFF) << 0)) + +typedef enum _gsl_chipid_t +{ + GSL_CHIPID_YAMATODX_REV13 = (COREID(0x00) | MAJORID(0x01) | MINORID(0x03) | PATCHID(0x00)), + GSL_CHIPID_YAMATODX_REV14 = (COREID(0x00) | MAJORID(0x01) | MINORID(0x04) | PATCHID(0x00)), + GSL_CHIPID_YAMATODX_REV20 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x00) | PATCHID(0x00)), + GSL_CHIPID_YAMATODX_REV21 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x01) | PATCHID(0x00)), + GSL_CHIPID_YAMATODX_REV211 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x01) | PATCHID(0x01)), + GSL_CHIPID_YAMATODX_REV22 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x02) | PATCHID(0x00)), + GSL_CHIPID_YAMATODX_REV23 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x03) | PATCHID(0x00)), + GSL_CHIPID_YAMATODX_REV231 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x03) | PATCHID(0x01)), + GSL_CHIPID_YAMATODX_REV24 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x04) | PATCHID(0x00)), + GSL_CHIPID_YAMATODX_REV25 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x05) | PATCHID(0x00)), + GSL_CHIPID_YAMATODX_REV251 = (COREID(0x00) | MAJORID(0x02) | MINORID(0x05) | PATCHID(0x01)), + GSL_CHIPID_G12_REV00 = (int)(COREID(0x80) | MAJORID(0x00) | MINORID(0x00) | PATCHID(0x00)), + GSL_CHIPID_ERROR = (int)0xFFFFFFFF + +} gsl_chipid_t; + +#undef COREID +#undef MAJORID +#undef MINORID +#undef PATCHID + +// ----------- +// device info +// ----------- +typedef struct _gsl_devinfo_t { + + gsl_deviceid_t device_id; // ID of this device + gsl_chipid_t chip_id; + int mmu_enabled; // mmu address translation enabled + unsigned int gmem_gpubaseaddr; + void * gmem_hostbaseaddr; // if gmem_hostbaseaddr is NULL, we would know its not mapped into mmio space + unsigned int gmem_sizebytes; + unsigned int high_precision; /* mx50 z160 has higher gradient/texture precision */ + +} gsl_devinfo_t; + +// ------------------- +// device memory store +// ------------------- +typedef struct _gsl_devmemstore_t { + volatile unsigned int soptimestamp; + unsigned int sbz; + volatile unsigned int eoptimestamp; + unsigned int sbz2; +} gsl_devmemstore_t; + +#define GSL_DEVICE_MEMSTORE_OFFSET(field) offsetof(gsl_devmemstore_t, field) + +// ----------- +// aperture id +// ----------- +typedef enum _gsl_apertureid_t +{ + GSL_APERTURE_EMEM = (GSL_MEMFLAGS_EMEM), + GSL_APERTURE_PHYS = (GSL_MEMFLAGS_CONPHYS >> GSL_MEMFLAGS_APERTURE_SHIFT), + GSL_APERTURE_MMU = (GSL_APERTURE_EMEM | 0x10000000), + GSL_APERTURE_MAX = 2, + + GSL_APERTURE_FOOBAR = 0x7FFFFFFF +} gsl_apertureid_t; + +// ---------- +// channel id +// ---------- +typedef enum _gsl_channelid_t +{ + GSL_CHANNEL_1 = (GSL_MEMFLAGS_CHANNEL1 >> GSL_MEMFLAGS_CHANNEL_SHIFT), + GSL_CHANNEL_2 = (GSL_MEMFLAGS_CHANNEL2 >> GSL_MEMFLAGS_CHANNEL_SHIFT), + GSL_CHANNEL_3 = (GSL_MEMFLAGS_CHANNEL3 >> GSL_MEMFLAGS_CHANNEL_SHIFT), + GSL_CHANNEL_4 = (GSL_MEMFLAGS_CHANNEL4 >> GSL_MEMFLAGS_CHANNEL_SHIFT), + GSL_CHANNEL_MAX = 4, + + GSL_CHANNEL_FOOBAR = 0x7FFFFFFF +} gsl_channelid_t; + +// ---------------------- +// page access permission +// ---------------------- +typedef enum _gsl_ap_t +{ + GSL_AP_NULL = 0x0, + GSL_AP_R = 0x1, + GSL_AP_W = 0x2, + GSL_AP_RW = 0x3, + GSL_AP_X = 0x4, + GSL_AP_RWX = 0x5, + GSL_AP_MAX = 0x6, + + GSL_AP_FOOBAR = 0x7FFFFFFF +} gsl_ap_t; + +// ------------- +// memory region +// ------------- +typedef struct _gsl_memregion_t { + unsigned char *mmio_virt_base; + unsigned int mmio_phys_base; + gpuaddr_t gpu_base; + unsigned int sizebytes; +} gsl_memregion_t; + +// ------------------------ +// shared memory allocation +// ------------------------ +typedef struct _gsl_memdesc_t { + void *hostptr; + gpuaddr_t gpuaddr; + int size; + unsigned int priv; // private + unsigned int priv2; // private + +} gsl_memdesc_t; + +// --------------------------------- +// physical page scatter/gatter list +// --------------------------------- +typedef struct _gsl_scatterlist_t { + int contiguous; // flag whether pages on the list are physically contiguous + unsigned int num; + unsigned int *pages; +} gsl_scatterlist_t; + +// -------------- +// mem free queue +// -------------- +// +// this could be compressed down into the just the memdesc for the node +// +typedef struct _gsl_memnode_t { + gsl_timestamp_t timestamp; + gsl_memdesc_t memdesc; + unsigned int pid; + struct _gsl_memnode_t *next; +} gsl_memnode_t; + +typedef struct _gsl_memqueue_t { + gsl_memnode_t *head; + gsl_memnode_t *tail; +} gsl_memqueue_t; + +// ------------ +// timestamp id +// ------------ +typedef enum _gsl_timestamp_type_t +{ + GSL_TIMESTAMP_CONSUMED = 1, // start-of-pipeline timestamp + GSL_TIMESTAMP_RETIRED = 2, // end-of-pipeline timestamp + GSL_TIMESTAMP_MAX = 2, + + GSL_TIMESTAMP_FOOBAR = 0x7FFFFFFF +} gsl_timestamp_type_t; + +// ------------ +// context type +// ------------ +typedef enum _gsl_context_type_t +{ + GSL_CONTEXT_TYPE_GENERIC = 1, + GSL_CONTEXT_TYPE_OPENGL = 2, + GSL_CONTEXT_TYPE_OPENVG = 3, + + GSL_CONTEXT_TYPE_FOOBAR = 0x7FFFFFFF +} gsl_context_type_t; + +// --------- +// rectangle +// --------- +typedef struct _gsl_rect_t { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; +} gsl_rect_t; + +// ----------------------- +// pixel buffer descriptor +// ----------------------- +typedef struct _gsl_buffer_desc_t { + gsl_memdesc_t data; + unsigned int stride_bytes; + unsigned int bpp; + unsigned int enabled; +} gsl_buffer_desc_t; + +// --------------------- +// command window target +// --------------------- +typedef enum _gsl_cmdwindow_t +{ + GSL_CMDWINDOW_MIN = 0x00000000, + GSL_CMDWINDOW_2D = 0x00000000, + GSL_CMDWINDOW_3D = 0x00000001, // legacy + GSL_CMDWINDOW_MMU = 0x00000002, + GSL_CMDWINDOW_ARBITER = 0x000000FF, + GSL_CMDWINDOW_MAX = 0x000000FF, + + GSL_CMDWINDOW_FOOBAR = 0x7FFFFFFF +} gsl_cmdwindow_t; + +// ------------ +// interrupt id +// ------------ +typedef enum _gsl_intrid_t +{ + GSL_INTR_YDX_MH_AXI_READ_ERROR = 0, + GSL_INTR_YDX_MH_AXI_WRITE_ERROR, + GSL_INTR_YDX_MH_MMU_PAGE_FAULT, + + GSL_INTR_YDX_CP_SW_INT, + GSL_INTR_YDX_CP_T0_PACKET_IN_IB, + GSL_INTR_YDX_CP_OPCODE_ERROR, + GSL_INTR_YDX_CP_PROTECTED_MODE_ERROR, + GSL_INTR_YDX_CP_RESERVED_BIT_ERROR, + GSL_INTR_YDX_CP_IB_ERROR, + GSL_INTR_YDX_CP_IB2_INT, + GSL_INTR_YDX_CP_IB1_INT, + GSL_INTR_YDX_CP_RING_BUFFER, + + GSL_INTR_YDX_RBBM_READ_ERROR, + GSL_INTR_YDX_RBBM_DISPLAY_UPDATE, + GSL_INTR_YDX_RBBM_GUI_IDLE, + + GSL_INTR_YDX_SQ_PS_WATCHDOG, + GSL_INTR_YDX_SQ_VS_WATCHDOG, + + GSL_INTR_G12_MH, + GSL_INTR_G12_G2D, + GSL_INTR_G12_FIFO, +#ifndef _Z180 + GSL_INTR_G12_FBC, +#endif // _Z180 + + GSL_INTR_G12_MH_AXI_READ_ERROR, + GSL_INTR_G12_MH_AXI_WRITE_ERROR, + GSL_INTR_G12_MH_MMU_PAGE_FAULT, + + GSL_INTR_COUNT, + + GSL_INTR_FOOBAR = 0x7FFFFFFF +} gsl_intrid_t; + +#endif // __GSL_TYPES_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_utils.h b/drivers/mxc/amd-gpu/include/api/gsl_utils.h new file mode 100644 index 000000000000..1078b634173d --- /dev/null +++ b/drivers/mxc/amd-gpu/include/api/gsl_utils.h @@ -0,0 +1,43 @@ +/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Code Aurora Forum nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __GSL_UTILS_H +#define __GSL_UTILS_H + + +////////////////////////////////////////////////////////////////////////////// +// macros +////////////////////////////////////////////////////////////////////////////// +#define GSL_QUADPOW2_TO_SIZEBYTES(quadpow2) (8 << (quadpow2)) +#define GSL_QUADPOW2_TO_SIZEDWORDS(quadpow2) (2 << (quadpow2)) +#define GSL_POW2TEST(size) ((size) && !((size) & ((size) - 1))) +#define GSL_POW2ALIGN_DOWN(addr, alignsize) ((addr) & ~((alignsize) - 1)); +#define GSL_POW2ALIGN_UP(addr, alignsize) (((addr) + ((alignsize) - 1)) & ~((alignsize) - 1)) + + +#endif // __GSL_UTILS_H |