/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* bos720 src/bos/kernext/rcm/inc/sys/rcm.h 1.31.2.46 */ /* */ /* Licensed Materials - Property of IBM */ /* */ /* COPYRIGHT International Business Machines Corp. 1989,2006 */ /* All Rights Reserved */ /* */ /* US Government Users Restricted Rights - Use, duplication or */ /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /* */ /* IBM_PROLOG_END_TAG */ /* @(#)85 1.31.2.46 src/bos/kernext/rcm/inc/sys/rcm.h, rcm, bos720 6/30/06 10:25:21 */ #ifndef _H_RCX #define _H_RCX #include /* system configuration */ #include /* exception structures */ #include /* state change structure */ #include #include /* Simple_lock structure */ #ifdef _RCM #include /* display bus access control */ #endif #include /* gscdma structure */ #include /* RCM window geom structures */ #define MAX_DOMAINS 5 #define RCM_INTR_LVL INTCLASS0 #ifndef __64BIT_KERNEL /* ----------------------------------------------------------------- I/O STUFF -------------------------------------------------------------- */ typedef ulong authMask; #endif /* ----------------------------------------------------------------- POINTER TYPE DEFINITIONS -------------------------------------------------------------- */ typedef struct _gscCom *gscComPtr; typedef struct _gscComProc *gscComProcPtr; typedef struct _gscComThr *gscComThrPtr; typedef struct _gscDev *gscDevPtr; typedef struct _devDomain *devDomainPtr; typedef struct _rcmProc *rcmProcPtr; typedef struct _rcmThread *rcmThreadPtr; typedef struct _rcx *rcxPtr; typedef struct _rcmWG *rcmWGPtr; #ifndef __64BIT_KERNEL typedef struct _rcmWA *rcmWAPtr; typedef struct _rcxp *rcxpPtr; typedef struct _rcxph *rcxphPtr; typedef struct _rcmCm *rcmCmPtr; #endif typedef struct _rcmTrace *rcmTracePtr; /* ----------------------------------------------------------------- EVENTS GRAPHICS PROCESSES CAN WAIT ON -------------------------------------------------------------- */ #define RCX_WAIT_EVENT 0x80000000 /* event to wait on and post for */ /* heavy context switches */ #ifndef __64BIT_KERNEL /* ----------------------------------------------------------------- COLORMAP LIST ENTRY DECLARATION -------------------------------------------------------------- */ typedef struct _rcmCm { int hwd_map; /* Actual hardware map number - assigned by Server. */ rcmCmPtr nxtCm; int unused[2]; } rcmCm; /* ---------------------------------------------------------------- Event Info data ---------------------------------------------------------------*/ typedef struct _eventInfo { pid_t gPid; /* Process id for this call */ eventMasks masks; /* Event type masks */ eventReport lastEvent; /* Last sync event that occurred */ eventArrayPtr pArray; /* event array */ genericPtr pData; /* pointer to event buffer */ genericPtr buffer_ptr; /* pointer to event buffer */ int bufleft,numhits; /* event buffer length */ int length; /* event buffer length */ int wait; /* Wait flag forsync event processing */ int unused[2]; } eventInfo; #endif /* ----------------------------------------------------------------- GSC COMMON STRUCTURE ANCHOR This anchor structure is static. It provides an anchor point for the dynamically allocated GSC common structure, a static lock word used to control the basic open/close/ioctl/resource allocation functions. There is a structure to define the state change handler to the system. The state change handler is always active whenever the RCM is configured. -------------------------------------------------------------- */ typedef struct _comAnchor { Simple_lock rlock; /* a lock for serializing access to the anchor and RCM common structure */ gscComPtr pCom; /* pointer to the RCM common structure */ int unused[2]; struct proch state_chng; /* to register state chg handler */ } comAnchor; #define apCom comAnc.pCom /* shorthand for RCM Common pointer */ extern comAnchor comAnc; /* ----------------------------------------------------------------- GSC COMMON STRUCTURE This structure serves as the anchor point for all other RCM structures. It also contains the structures with which to register RCM "hooks" to kernel services (fault handler, state change handler). It also contains the HSC information. -------------------------------------------------------------- */ struct query_context_rslt { rcxPtr prcx; int lock; }; typedef struct _gscCom { struct uexcepth except; /* structure for exception handler; catches graphics faults */ gscDevPtr pDevList; /* head of linked list of devices */ gscComProcPtr pProcList; /* head of linked list of graphics process common structures */ #ifndef __64BIT_KERNEL struct _rcxp *pRcxParts; /* linked list of context parts */ #endif void *rcmker_handle; /* pointer to rcm kernel structure */ gscComThrPtr pThreadList; /* head of linked list of graphics thread common structures */ Simple_lock fault_lock; /* used to sync with gp_fault */ Simple_lock revoke_lock; /* used for SMP revoke_display */ #ifdef _RCM struct busprt_iomem * volatile revoke_parm; #else void *dummy; #endif int unused[4]; struct callbacks { int (*give_up_timeslice)(devDomainPtr, rcmProcPtr); int (*guard_domain)(devDomainPtr, void *); int (*unguard_domain)(devDomainPtr); #ifndef __64BIT_KERNEL int (*put_on_fault_list)(rcxPtr); int (*block_graphics_process)(devDomainPtr, rcmProcPtr); int (*unblock_graphics_process)(devDomainPtr, rcmProcPtr); int (*make_cur_and_guard_dom)(rcxPtr); #endif int (*make_kpproc)(gscDevPtr, rcmProcPtr *); int (*unmake_kpproc)(gscDevPtr, rcmProcPtr); struct query_context_rslt (*query_context)(devDomainPtr, char *, int); int (*swap_buffer)(devDomainPtr, rcmProcPtr); int (*query_domain_lock)(devDomainPtr, rcmThreadPtr); int (*make_rcx_current)(rcxPtr); int (*grant_thread_access)(devDomainPtr, rcmThreadPtr); int (*revoke_thread_access)(devDomainPtr, rcmThreadPtr); } *rcm_callback; } gscCom; /* ----------------------------------------------------------------- GSC COMMON PROCESS STRUCTURE A common process structure exists for every process that becomes a graphics process (gp). The gp also has a device process structure for every device for which it becomes a gp. -------------------------------------------------------------- */ /* maximum number of displays */ #define RCM_MAX_DEV 8 /* maximum total number of domains for bus type DISP_BUS_PCI */ /* note: POWER4 and beyond do not use hardware bats. On these */ /* processors, the kernel limits the number of attaches to 4 */ /* in the 32 bit kernel and 8 in the 64 bit kernel. */ #ifdef __64BIT_KERNEL #define NOT_POWER_4_AND_BEYOND \ (POWER_620|POWER_630|POWER_A35|POWER_RS64II|POWER_RS64III) #define MAX_BATS (__power_set(NOT_POWER_4_AND_BEYOND) ? 4 : 8) #else #define MAX_BATS 4 #endif #define MAX_BUSMEM_KEYS 7 /* maximum no. of bus memory access keys */ /* There are 7 keys, 1 to 7 inclusively */ #define FIRST_BUSMEM_KEY_VAL 1 /* keys must be 1 or greater */ /* * Bus memory access key allocation control database entry. */ struct busmem_key { short key; /* available value (must be between 1 and 7 inclusively */ short spare; /* put to use if we ever need it */ gscDevPtr owner; /* owning dev structure */ int unused[2]; }; #define RCM_MAX_USR_BUFFER 8 /* max number of list headers */ typedef struct _rcm_uaddr_t /* structure for 60-bit addrs */ { vmhandle_t srval; /* now unused */ caddr_t eaddr; /* effective addr */ int unused[2]; } rcm_uaddr_t ; typedef struct usrbuf /* for recording shared mem attach */ { struct usrbuf *next; caddr_t start; /* effective addr */ int length; int unused[3]; struct xmem xmemusr; /* for cross mem attach */ } usrbuf_t ; struct segreg_range { uint start; uint length; uint end; }; struct segreg { struct segreg *next; /* cproc link */ vmhandle_t srval; int usage; caddr_t segment; uint num_ranges; uint num_ranges_alloc; struct segreg_range *ranges; int unused[3]; }; typedef struct _gscComProc { gscComProcPtr pNext; /* pointer to next proc */ pid_t pid; /* process id */ tid_t tid; /* thread id */ int count; /* number of cproc_init calls active */ uint flags; /* flag word */ #ifndef __64BIT_KERNEL struct busmem_key *pBusKey; /* pointer to gp leader bus mem protect key database */ #endif struct segreg *pSegreg; /* list of seg regs assigned to process */ struct usrbuf **pusrbufhdr; /* points to usr buffer headers */ int threads[RCM_MAX_DEV]; /* # threads per device */ int unused[6]; } gscComProc; #define COMPROC_SIGNALLED (1L << 0) /* SIGTERM sent already */ typedef struct _gscComThr { gscComThrPtr pNext; /* pointer to next common thread */ pid_t pid; /* process id */ tid_t tid; /* thread id */ int count; /* number of dev dependent thread structs */ int num_bats; /* number of bats set up for this thread */ uint flags; /* flag word */ int unused[4]; } gscComThr; #ifndef __64BIT_KERNEL #define COMTHR_FUNNELLED (1L << 0) /* was previously funnelled */ #endif /* ----------------------------------------------------------------- RCM ADAPTER DOMAIN STRUCTURE -------------------------------------------------------------- */ typedef struct _devDomain { void *rcmker_handle; gscDevPtr pDev; /* pointer to device structure */ int domain; /* number of the domain */ #ifndef __64BIT_KERNEL ulong auth; /* Used for MCA adapters only! */ /* authorization mask used to allow */ /* process access to bus memory for */ /* domain */ #ifdef _RCM ioRange range; /* Used for MCA adapters only! */ /* bus I/O range for domain */ #else /**//* sizeof (ioRange) MUST == 4 or we are broken! */ ulong dummy; /* nonRCM doesn't need this */ #endif #endif uint flags; int kproc; /* nonzero for Heavy Switch kproc */ int unused[10]; } devDomain; /* ----------------------------------------------------------------- GSC DEVICE STRUCTURE -------------------------------------------------------------- */ struct phys_displays; typedef struct _gscDev { struct _gscDevHead { Simple_lock lock; /* device lock */ gscDevPtr pNext; /* link to next device */ uint flags; /* flags */ gscComPtr pCom; /* pointer back to gsc common */ #ifndef __64BIT_KERNEL int dma_sleep; /* list of processes sleeping */ #endif rcm_wg_hash_table_t *wg_hash_table; /* win geom hash table */ tid_t sync_sleep; /* for leaders syncing with clients */ uint window_count ; /* Running count of windows defined */ rcmProcPtr pProc; /* linked list of graphics process structures */ #ifndef __64BIT_KERNEL rcmCmPtr pCm; /* pointer to color map linked list */ #endif struct phys_displays *display; /* display information for this vt */ char *vttld; /* pointer to virtual term private data */ int num_domains; /* number of domains */ int count; /* number of dev_init calls active */ char rcmtrace_ID[8]; /* trace ID characters */ rcmTracePtr rcmtrace; /* pointer to trace control block */ struct usrbuf **pusrbufhdr; /* point to leader shared mem records */ pid_t leader_pid; /* pid of graphics process leader */ tid_t leader_tid; /* tid of graphics process leader */ int fault_type; /* set by make-gp for rcmswitch */ int timerclass; /* assigned by rcm for timeslice mgmt */ Simple_lock gp_lock; /* lock for (un)make_gp */ int unmake_count; /* count of threads doing unmake_gp */ tid_t make_sleep; /* sleep word for make_gp */ int unused[11]; } devHead; devDomain domain[1]; /* array of domain structures for adapter */ } gscDev; /* device flags */ #define DEV_RESERVED 0x8 /* device reserved for exclusive access by single process */ #define DEV_SIGNAL_SENT 0x20 /* unmake of leader has sent sig */ #define DEV_HAS_LEADER 0x40 /* set when leader is defined */ /* ----------------------------------------------------------------- RCM PROCESS STRUCTURE -------------------------------------------------------------- */ #ifdef _RCM struct rcmbusprot { struct rcmbusprot *next; int domain; int unused[2]; struct busprt_iomem busProt; }; #endif struct procRange { struct segreg *segreg; uint range_id; uint offset; int domain; uint length; }; typedef struct _rcmProc { struct _rcmProcHead { rcmProcPtr pNext; /* pointer to next process block */ gscComProcPtr pCproc; /* pointer to common process */ pid_t pid; /* process id */ #ifndef __64BIT_KERNEL /* * Note that the tid field is kept here only for backwards * compatability, as some older device drivers access it. Any * device drivers which support mp should not access this field. * If necessary, they can access the corresponding field in the * thread structure. */ tid_t tid; /* thread id */ #endif rcxPtr pRcx; /* linked list of rendering contexts */ #ifndef __64BIT_KERNEL rcmWAPtr pWA; /* linked list of window attribute */ /* structures */ eventInfo *pEvents; /* pointer to event information */ #endif gscDevPtr pGSC ; /* aixgsc device structure */ #ifndef __64BIT_KERNEL struct _gscdma gscdma; /* DMA control structure */ #define DMA_SW_WRITE_PROTECT 0x80 /* coordinate with aixgsc.h */ struct _gscdma_ext { /* for addressing segs to unpin */ vmhandle_t sw_seg; /* seg reg content */ vmhandle_t sw_Useg; /* scratch for seg comput */ } gscdma_ext[MAX_SUBAREAS]; struct xmem xmemdma[MAX_SUBAREAS]; /* array of cross-memory structures */ #endif genericPtr pPriv; /* pointer to device private data */ uint flags; /* process flags */ uint srval; /* segment register value */ struct segreg *pSegreg; /* pointer to specific segreg pkt */ rcmThreadPtr pThread; /* linked list of threads */ #ifndef __64BIT_KERNEL struct _partList { struct _partList *pNext; /* next entry or NULL */ rcxpPtr pRcxp; /* part pointer used */ int unused[2]; } *pParts; #endif int num_ranges; #ifndef __64BIT_KERNEL ulong offset; #endif struct procRange *range; /* MAX_DOMAINS == 5 */ Simple_lock rcx_delete; int count[MAX_DOMAINS]; /* # threads using domain */ void *rcmker_handle[MAX_DOMAINS]; int unused[10]; } procHead; /*----------------------------------------------------------------------- The following set of pDomainCur pointers specify the context that the user has declared as "current" (meaning "to be used") for each physical domain on the adapter. These pDomainCur pointers are set with the gsc_set_rcx aixgsc system call. When an adapter domain is loaded with a context for a process, the rcm will use the context that the process has marked as "current" for that physical domain. These pointers DO NOT imply that the contexts are currently on the physical domains of the adapter. Note that, in order to support mp, this information has really been moved into the thread structure, but unfortunately, some older device drivers access this field here in the process structure, so we need to keep a copy here. Of course, it will only be guaranteed to be accurate for a single-threaded graphics process. Device drivers which support mp should never access this field in the process structure, they should only access the corresponding field in the thread structure. *-----------------------------------------------------------------------*/ rcxPtr pDomainCur[1]; } rcmProc; /* process flags */ #ifndef __64BIT_KERNEL #define PROC_DMA_IN_PROGRESS (1L << 0) /* DMA operation in progress */ #endif #define PROC_GP_LEADER (1L << 3) /* lead gp on device */ #define PROC_KPROC (1L << 5) /* Kernel process struct */ #define PROC_MP_MODEL_2 (1L << 6) /* Proc is using MP model 2 */ /* ----------------------------------------------------------------- RCM THREAD STRUCTURE -------------------------------------------------------------- */ typedef struct _rcmThread { rcmThreadPtr pNext; /* pointer to next thread */ gscComThrPtr pCthr; /* pointer to common thread */ rcmProcPtr pProc; /* pointer to process */ tid_t tid; /* thread id */ int priority; /* graphics thread priority */ genericPtr pPriv; /* pointer to device private data */ uint flags; /* thread flags? TBD */ #ifdef _RCM struct rcmbusprot *pRcmbusprot; /* list of bus protect pkts per dom */ #else /**//* this depends on all pointers being the same size or we are broken! */ void *dummy; /* nonrcm doesn't need this */ #endif /* See comment in proc structure */ rcxPtr pDomainCur[MAX_DOMAINS]; void *rcmker_handle[MAX_DOMAINS]; int unused[10]; } rcmThread; /* thread flags */ #define THREAD_SP (1L << 0) /* Special Purpose thread */ /* ----------------------------------------------------------------- RCM RENDERING CONTEXT STRUCTURE -------------------------------------------------------------- */ typedef struct _rcx { rcxPtr pNext; /* pointer to next rcx for process */ void *rcmker_handle; rcmProcPtr pProc; /* process pointer */ rcmThreadPtr pThread; /* thread which has rcx active */ genericPtr pData; /* pointer to device dependent rcx */ /* structure */ int domain; /* domain number */ devDomainPtr pDomain; /* pointer to domain array entry */ rcmWGPtr pWG; /* ptr to associated window geometry */ #ifndef __64BIT_KERNEL rcmWAPtr pWA; /* ptr to associated window */ /* attributes */ #endif rcxPtr pLinkWG; /* pointer to next rcx in list */ /* using WG */ #ifndef __64BIT_KERNEL rcxPtr pLinkWA; /* pointer to next rcx in list */ /* using WA */ rcxphPtr pRcxph; /* ptr to associated rcx parts list */ #endif uint flags; /* flags */ uint set_count; /* synchronize set(s) and delete */ rcmWGPtr pReadWG; /* ptr to associated read win geom */ rcxPtr pLinkReadWG; /* ptr to next rcx in read WG list */ int unused[9]; } rcx; /* rcx flags */ #define RCX_NULL 0x400 /* this is a null context */ #define RCX_DELETED 0x800 /* rcx is being deleted */ #define RCX_LOCK_HELD 0x1000 /* ----------------------------------------------------------------- RCM WINDOW GEOMETRY STRUCTURE -------------------------------------------------------------- */ typedef struct _rcmWG { rcmWGPtr pNext; /* linked list of win */ /* geometry */ rcxPtr pHead; /* head of linked list of */ /* rcx referencing this wg */ rcmProcPtr pProc; /* owning process */ genericPtr pPriv; /* pointer to device */ /* dependent private data */ uint flags; #ifndef __64BIT_KERNEL rcmWAPtr pLastWA; /* last bound window attr */ #endif rcxPtr pReadHead; /* head of linked list of rcx */ /* bound for reading */ int unused[6]; gWinGeomAttributes wg; /* kernel's copy of */ /* creator's window geometry */ } rcmWG; /* window flags */ #define WG_CHANGED 0x00000001 #define WG_DELETED 0x00000002 #ifndef __64BIT_KERNEL /* ----------------------------------------------------------------- RCM WINDOW ATTRIBUTE STRUCTURE -------------------------------------------------------------- */ typedef struct _rcmWA { rcmWAPtr pNext; /* linked list of win */ /* attributes */ rcxPtr pHead; /* head of linked list of */ /* rcx referencing this wa */ genericPtr pPriv; /* pointer to device */ /* dependent private data */ ulong flags; int unused[2]; gWindowAttributes wa; /* kernel's copy of */ /* creator's win attributes */ } rcmWA; /* window attribute flags */ #define WA_CHANGED 0x00000001 #define WA_DELETED 0x00000002 /* ----------------------------------------------------------------- RCM RENDERING CONTEXT PART STRUCTURE -------------------------------------------------------------- */ typedef int global_ID; typedef struct _rcxp { rcxpPtr pNext; /* pointer to next rcxp */ global_ID glob_id; /* global id */ int priority; /* part priority */ int users; /* use count */ genericPtr pData; /* pointer to device dependent rcxp */ /* structure */ int length; /* length of data */ time_t timestamp; /* when "deleted" */ struct xmem xmemd; /* xmem descriptor */ ulong flags; /* flags */ int unused[2]; } rcxp; typedef struct _rcxp *RCXP_handle; typedef struct _rcxph { rcxphPtr pNext; /* pointer to next rcxp header */ rcxphPtr pPrev; /* pointer to previous rcxp header */ rcxpPtr pRcxp; /* pointer to rcx part */ ulong flags; /* flags */ int unused[2]; } rcxph; /* rcxph flags */ #define RCXPH_READY 0x1 #define RCXPH_CURRENT 0x2 #define RCXPH_KERNEL 0x4 #endif /* !64BIT_KERNEL */ /* ----------------------------------------------------------------- RCM TRACE STRUCTURE -------------------------------------------------------------- */ struct _ptrace_entry; typedef struct _rcmTrace { struct _ptrace_entry *performance_trace_table; int ptt_ndx; /* next entry to do in above table */ int ptt_size; /* number of entries in table */ char *perf_trace_flags; /* trace selection buffer */ struct xmem xmemdesc_flags; /* cross-mem descriptor of flags */ struct xmem xmemdesc_table; /* cross-mem descriptor of table */ pid_t pid; /* process id of owning process */ int unused[2]; } rcmTrace; /* ----------------------------------------------------------------- RCM ADDR ARRAY STRUCTURE -------------------------------------------------------------- */ typedef struct _rcmAddrRange { #ifndef __64BIT_KERNEL long long PhysAddr; #endif uint RangeLength; uint AddrRangeID; #define RCM_SWITCHABLE_DOMAIN (1L << 0) /* domain switchable? */ #define RCM_IO_ADDR_RANGE (1L << 1) /* memory mapped I/O */ #define RCM_MEM_ADDR_RANGE (0L << 1) /* bus memory */ uint flags; /* Supported values for bus_type */ /* DISP_BUS_PPC 0x2000 processor bus */ /* DISP_BUS_PCI 0x1000 PCI bus */ /* DISP_PLANAR 0x0800 planar registers */ ushort bus_type; /* use #define's in display.h */ int resource; vmhandle_t srval; /* used internally */ uint busprot_type; /* used internally */ long long BusAddr; uint bus_id; uint unused[6]; } rcmAddrRange; #endif /* _H_RCX */