| 
 | 
In almost all cases, code from one platform applies to the other environments. The major exception is that AIX 5L cannot handle the int10 accesses of Video BIOS and so must code adapter-specific information into the driver's C code that is handled through grafinfo files on SVR5 and SCO OpenServer 5.
To port your SVR5 NFB X server driver to AIX 5L:
   #ifdef _IBM_LFT
   extern ddxScreenInfo xxxScreenInfo;
   ddxScreenInfo *
   xxxEntryFunc() {
           return (&xxxScreenInfo);
   }
   
   extern int nfbCreateAdapter( ScreenPtr pScreen, int argc, char **argv,
           grafData * );
   extern Bool nfbddxCloseScreen(int num, ScreenPtr pScreen);
   
   #endif	/*	_IBM_LFT	*/
          if (xxxGeneration != serverGeneration) {
                   xxxGeneration = serverGeneration;
                   xxxScreenPrivateIndex = AllocateScreenPrivateIndex();
                   if ( xxxScreenPrivateIndex < 0 )
                           return FALSE;
   #ifdef _IBM_LFT
               if ( ! nfbCreateAdapter( pScreen, argc, argv, grafinfo ) ) {
                   return FALSE;
               }
   #endif	/*	_IBM_LFT	*/
           }
   void
   xxxCloseScreen(index, pScreen)
           int index;
           ScreenPtr pScreen;
   {
           xxxPrivatePtr xxxPriv = XXX_PRIVATE_DATA(pScreen);
   
           xfree(xxxPriv);
   #ifdef _IBM_LFT
           nfbddxCloseScreen(index, pScreen);
   #endif
   }
The
grafExec(D3nfb)
function does not exist in AIX 5L,
so you must eliminate those calls from the
SetGraphics(D3nfb)
and
SetText(D3nfb)
functions by enclosing them in #ifdndef _IBM_LFT sections.
You must then provide all the code required
to switch your card's mode to graphics and to text.
You can access the grafinfo DATA items
with the
grafGetFunction(D3nfb),
grafGetInt(D3nfb),
grafGetString(D3nfb),
and
grafGetMemInfo(D3nfb)
functions.
   void
   xxxSetGraphics(pScreen)
           ScreenPtr pScreen;
   {
       grafData *grafinfo = DDX_GRAFINFO(pScreen);
   
   #ifndef _IBM_LFT
       grafExec(grafinfo, "SetGraphics", NULL);
   #else
       /* Provide code to switch your video adapter to graphics mode */
   #endif
   }
   
   void
   xxxSetText(pScreen)
           ScreenPtr pScreen;
   {
       grafData *grafinfo = DDX_GRAFINFO(pScreen);
   
   #ifndef _IBM_LFT
       grafExec(grafinfo, "SetText", NULL);
   #else
       /* Provide code to switch your video adapter to text mode */
   #endif
   }
bios_ptr:
   #ifdef _IBM_LFT
       extern void nfbRomAccess(unsigned int *, unsigned int);
       unsigned char * bios_ptr;
   
       nfbRomAccess((unsigned int *)&bios_ptr, TRUE);
   #endif
   
   	When finished, release access:
   
   #ifdef _IBM_LFT
       nfbRomAccess((unsigned int *)&bios_ptr, FALSE);
       bios_ptr = (unsigned char *) NULL;
   #endif
   	grafData *grafinfo = DDX_GRAFINFO(pScreen);
   	unsigned char *IOreg_ptr;
   	unsigned char *FrameBuffer_ptr;
   	
       	grafGetMemInfo(grafinfo, "REGS", NULL, NULL, &IOreg_ptr))
       	grafGetMemInfo(grafinfo, "APERTURE", NULL, NULL, &FrameBuffer_ptr))
#ifdef _IBM_LFT int offset; /* offset into the PCI configuration space */ unsigned int size; /* size is 1,2,3 or 4 to indicate the */ unsigned long data; /* number of bytes in the data item */(void) nfbReadPCIConfig( offset, size, & data ); #endif
To write a single value PCI configuration data
#ifdef _IBM_LFT int offset; /* offset into the PCI configuration space */ unsigned int size; /* size is 1,2,3 or 4 to indicate the */ unsigned long data; /* number of bytes in the data item */
data = <value to write>; (void) nfbWritePCIConfig( offset, size, data ); #endif