/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* bos720 src/bos/kernext/lft/inc/sys/display.h 1.47                      */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1993,1994              */
/* 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                                                     */
/* @(#)11       1.47  src/bos/kernext/lft/inc/sys/display.h, sysxdisp, bos720 4/19/02 12:04:42 */

/*
 * KSR - keyboard send/receive mode (character)
 * MOM - monitor mode
 * VDD - virtual display driver
 * VT  - virtual terminal
*/

/*
 * NB: Anyone including this header file must include sys/intr.h
 * beforehand in order to define struct intr.
 */

#ifndef _H_DISPLAY
#define _H_DISPLAY 1

#define MAXDMABUFS 4

#include <sys/xmem.h>
#include <sys/rcm_win.h>
#include <sys/aixgsc.h>
#include <sys/rcm.h>
#include <sys/pwr_mgr.h>


struct dma_bufs {			/*************************************/
	uint  bus_addr;		/* byte offset of base of dma area   */
	uint  length;			/* length in bytes of dma area	     */
};					/*************************************/


struct _bmr {				/*************************************/
	int	auth_mask;		/* Used for MCA adapters only	     */
					/* authorization mask to allow access*/
	caddr_t bus_mem_start_ram;	/* byte offset of base of dma area   */
	caddr_t bus_mem_end_ram;	/* byte offset of base of dma area   */
};					/*************************************/


					/***********************************/
struct	display_info {			/* display info for the LFT & RCM  */
	uint  font_width;		/* width  of the char in pixels    */
	uint  font_height;		/* height of the char in pixels    */
	uint  bits_per_pel;		/* # bits in each pixel value	   */
	uint  adapter_status;		/* adapter status as follows:	   */
					/* :1=1 if color monitor	   */
					/* :1=1 if the adapter's VLT is    */
					/*	modifiable		   */
					/* :1=1 set to 0 by the device	   */
					/*	driver if the adapter is   */
					/*	is working properly	   */
					/* :29	reserved		   */
	uint  apa_blink;		/* :1=1 APA device, 0=A/N device   */
					/* :1=1 blink supported 	   */
					/* :30	reserved		   */
	uint  screen_width_pel;	/* width of the screen in pixels   */
	uint  screen_height_pel;	/* height of the screen in pixels  */
	uint  screen_width_mm; 	/* width of screen in mm	   */
	uint  screen_height_mm;	/* height of screen in mm	   */
	uint  colors_total;		/* total # colors available	   */
	uint  colors_active;		/* # colors that can be displayed  */
					/*   simultaneously		   */
	uint  colors_fg;		/* # foreground colors that can be */
					/*   displayed simultaneously	   */
	uint  colors_bg;		/* # background colors that can be */
					/*   displayed simultaneously	   */
	uint  color_table[16]; 	/* ksr default colors		   */
	int   reserved1;		/* reserved			   */
	int   reserved2;		/* reserved			   */
};					/***********************************/

struct font_data;
struct vtmstruc;

struct phys_displays {			/***********************************/
	struct {			/* data to set up interrupt call   */
	    struct intr intr;		/* at init time (i_init)	   */
	    long intr_args[4];		/*				   */
	} interrupt_data;		/***********************************/
	struct phys_displays *same_level; /* other interrupts on same level*/
	struct phys_displays *next;	/* ptr to next minor number data   */
        struct _gscDev       *pGSC;     /* device struct used by rcm       */
	dev_t devno;			/* Device number of this adapter   */
	struct lft 	*lftanchor;	/* lft subsystem		   */
	int dds_length;		/* length in bytes		   */
	char *odmdds;			/* ptr to define device structure  */
	struct display_info display_info; /* display information	   */
	uchar disp_devid[4];		/* device information		   */
					/* [1] = 04=display device	   */
					/* [2] = 21=reserved 22=reserved   */
					/*	 25=reserved 27=reserved   */
					/*	 29=reserved		   */
					/* [3] = 00=functional		   */
					/* [4] = 01-04=adapter instance    */
	uchar usage;			/* number of VT's using real screen*/
					/*   used to prevent deletion of   */
					/*   real screen from configuration*/
					/*   if any VT is using it.	   */
	uchar open_cnt; 		/* Open flag for display	   */
	uchar display_mode;		/* Actual state of the display,    */
					/* not the virtual terminal:	   */
					/* KSR_MODE or MOM_MODE (see vt.h) */
	uchar dma_characteristics;	/* Attributes related to DMA ops   */
#	define DMA_SLAVE_DEV	1	/* Device is bus slave, ow. master */
	struct font_data *default_font; /* Pointer to the default font for */
					/*   this display		   */
	struct vtmstruc	*visible_vt;	/* Pointer to current vt active or */
					/*   pseudo-active on THIS display */
					/***********************************/
					/* DMA Data Areas		   */
					/***********************************/
	int  dma_chan_id;		/* channel id returned from d_init */
	struct dma_bufs 		/* DMA buffer structure 	   */
		d_dma_area[MAXDMABUFS]; /*				   */
					/***********************************/
					/* Rendering Context Manager Areas */
					/***********************************/
	rcmProcPtr cur_rcm;		/* Pointer to current rcm on this  */
					/* display			   */
	int num_domains;		/* number of domains		   */
	int dwa_device; 		/* supports direct window access   */
	struct _bmr			/* bus memory ranges		   */
		busmemr[MAX_DOMAINS];	/*				   */
	uint io_range; 		/* Used for MCA adapter only!      */
					/* low limit in high short	   */
					/* high limit in low short	   */
					/* to match IOCC register	   */
	uint *free_area;		/* area free for usage in a device */
					/*   dependent manner by the VDD   */
					/*   for this real screen.	   */

#ifndef __64BIT_KERNEL
#define RCM_ACC_METHOD_1	(0L)	/* MCA and SGA bus adapters	   */
#endif
#define RCM_ACC_METHOD_2	(1L)	/* 60X and PCI bus adapters        */
	uint access_method;		/* Access method flags 		   */
#ifndef __64BIT_KERNEL
#define RCM_RUBY_NO_MAP		(1L)	/* Tells RCM to not map the space  */
#endif
	uint access_flags;		/* Misc flags (used for Ruby now)  */
        uint reserved13[13];

	int current_dpm_phase;         /* current phase of DPM this display is in */
                                        /* full-on=1, standby=2, suspend=3, off=4  */
#define	DPMS_ON		0x1
#define	DPMS_STANDBY	0x2
#define	DPMS_SUSPEND	0x3
#define	DPMS_OFF	0x4

	int		NumAddrRanges;
	rcmAddrRange	*AddrRange;
	int reserved4;

	int (*reserved7)();

					/***********************************/
					/* VDD Function Pointers	   */
					/***********************************/


	int (*vttpwrphase)();		/* power management phase change    */
                                        /* function.  It's device dependent */

	int (*vttact)();		/* Activate the display 	   */
	int (*vttcfl)();		/* Move lines around		   */
	int (*vttclr)();		/* Clear a box on screen	   */
	int (*vttcpl)();		/* Copy a part of the line	   */
	int (*vttdact)();		/* Mark the terminal as being	   */
					/*   deactivated		   */
	int (*vttddf)();		/* Device dependent functions	   */
					/*   i.e. Pacing, context support  */
	int (*vttdefc)();		/* Change the cursor shape	   */
	int (*vttdma)();		/* Issue dma operation		   */
	int (*vttdma_setup)();		/*  Setup dma			   */
	int (*vttterm)();		/* Free any resources used	   */
					/*   by this VT 		   */
	int (*vttinit)();		/* setup new logical terminal	   */
	int (*vttmovc)();		/* Move the cursor to the	   */
					/*   position indicated 	   */
	int (*vttrds)();		/* Read a line segment		   */
	int (*vtttext)();		/* Write a string of chars	   */
	int (*vttscr)();		/* Scroll text on the VT	   */
	int (*vttsetm)();		/* Set mode to KSR or MOM	   */
	int (*vttstct)();		/* Change color mappings	   */

	int (*reserved5)();		/* Despite its name, this field is */
					/* used for kdb debug		   */
	int (*bind_draw_read_windows)();
					/***********************************/
					/* RCM Function Pointers	   */
					/***********************************/
	int (*make_gp)();		/*  Make a graphics process	   */
	int (*unmake_gp)();		/*  Unmake a graphics process	   */
	int (*state_change)();		/*  State change handler invoked   */
	int (*update_read_win_geom)();
	int (*create_rcx)();		/*  Create a hardware context	   */
	int (*delete_rcx)();		/*  Delete a hardware context	   */
#ifdef __64BIT_KERNEL
	int (*reserved21)();		/*				   */
	int (*reserved22)();		/*				   */
	int (*reserved23)();		/*				   */
	int (*reserved24)();		/*				   */
#else
	int (*create_rcxp)();		/*  Create a context part	   */
	int (*delete_rcxp)();		/*  Delete a context part	   */
	int (*associate_rcxp)();	/*  Link a part to a context	   */
	int (*disassociate_rcxp)();	/*  Unlink a part from a context   */
#endif
	int (*create_win_geom)();	/*  Create a window on the screen  */
	int (*delete_win_geom)();	/*  Delete a window on the screen  */
	int (*update_win_geom)();	/*  Update a window on the screen  */
#ifdef __64BIT_KERNEL
	int (*reserved25)();		/*				   */
	int (*reserved26)();		/*				   */
	int (*reserved27)();		/*				   */
#else
	int (*create_win_attr)();	/*  Create a window on the screen  */
	int (*delete_win_attr)();	/*  Delete a window on the screen  */
	int (*update_win_attr)();	/*  Update a window on the screen  */
#endif
	int (*bind_window)();		/*  Update a window bound to rcx   */
	int (*start_switch)();		/*  Start a context switch	   */
					/*  Note: This routine runs on	   */
					/*  the interrupt level 	   */
	int (*end_switch)();		/*  Finish the context switch	   */
					/*  started by start_switch()	   */
#ifdef __64BIT_KERNEL
	int (*reserved28)();		/*				   */
	int (*reserved29)();		/*				   */
	int (*reserved30)();		/*				   */
	int (*reserved31)();	 	/*				   */
#else
	int (*check_dev)();		/*  Check if this address beints  */
					/*  to this device.		   */
					/*  Note: this is run on interrupt */
					/*  level.			   */
	int (*async_mask)();		/* Set async events reporting	   */
	int (*sync_mask)();		/* Set sync events reporting	   */
	int (*enable_event)();		/* Turns adapter function on	   */
					/* without reports to application  */
#endif
	int (*create_thread)();		/* Make a graphics thread	   */
	int (*delete_thread)();		/* Delete a graphics thread	   */
	void (*give_up_time_slice)();	/* Relinquish remaining time	   */
#ifdef __64BIT_KERNEL
	int (*reserved32)();		/*				   */
#else
	int (*diag_svc)();		/* Diagnostics Services (DMA)	   */
#endif
	int (*dev_init)();		/* Device dep. initialization      */
#ifdef __64BIT_KERNEL
	int (*reserved33)();		/*				   */
#else
	int (*dev_term)();		/* Device dep. cleanup  	   */
#endif
					/***********************************/

                                        /***********************************/
                                        /* Font Support Function Pointers  */
                                        /***********************************/

#ifdef __64BIT_KERNEL
        int (*reserved34)();
#else
        int (*pinned_font_ready)();
#endif
	int (*vttddf_fast)();		/* fast ddf functions              */

        ushort bus_type;                /* indicates what type of bus      */
#ifndef __64BIT_KERNEL
#       define  DISP_BUS_MCA    0x8000  /* Microchannel                    */
#       define  DISP_BUS_SGA    0x4000  /* currently not used              */
#       define  DISP_BUS_PPC    0x2000  /* processor bus                   */
#	define  DISP_PLANAR	0x0800  /* planar registers		   */
#endif
#       define  DISP_BUS_PCI    0x1000  /* PCI bus                         */

        ushort flags;                   /* physical display flags          */

#       define GS_DD_DOES_AS_ATT        (1L << 0) /* no as_att() by RCM    */
						  /* not currently used    */

#	define GS_BUS_AUTH_CONTROL	(1L << 1) /* Request bus access ctrl */

#       define GS_HAS_INTERRUPT_HANDLER (1L << 2) /* 1 after i_init()      */
                                                  /* 0 after i_clear()     */
						  /* not currently used    */
#       define GS_DD_SUPPORTS_MP        (1L << 3)
	uint	reserved11[5];		/* not used			   */
        int             ear;            /* image for EAR reg (xferdata) if !0 */
	uint	spares[18];		/* not used - for future development */
};

#endif /* _h_DISPLAY */
