pI128->HWCursor = FALSE;
I128PreInit(ScrnInfoPtr pScrn, int flags){    I128Ptr pI128;    int i;    int bytesPerPixel;    ClockRangePtr clockRanges;    MessageType from;    char *mod = NULL;    CARD32 iobase;    char *ramdac = NULL;    CARD32 tmpl, tmph, tmp;    unsigned char n, m, p, mdc, df;    float mclk;    xf86MonPtr mon;    /* Check the number of entities, and fail if it isn't one. */    if (pScrn->numEntities != 1)	return FALSE;    /* Allocate the I128Rec driverPrivate */    I128GetRec(pScrn);    pI128 = I128PTR(pScrn);    /* Get the entity, and make sure it is PCI. */    pI128->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);    if (pI128->pEnt->location.type != BUS_PCI)	return FALSE;    if (flags & PROBE_DETECT) {	/* I128ProbeDDC(pScrn, pI128->pEnt->index); */	return TRUE;    }    /* Find the PCI info for this screen */    pI128->PciInfo = xf86GetPciInfoForEntity(pI128->pEnt->index);    pI128->PciTag = pciTag(pI128->PciInfo->bus, pI128->PciInfo->device,			  pI128->PciInfo->func);    pI128->Primary = xf86IsPrimaryPci(pI128->PciInfo);    /* The vgahw module should be allocated here when needed */    if (!xf86LoadSubModule(pScrn, "vgahw"))        return FALSE;        xf86LoaderReqSymLists(vgahwSymbols, NULL);    /*     * Allocate a vgaHWRec     */    if (!vgaHWGetHWRec(pScrn))        return FALSE;     vgaHWGetIOBase(VGAHWPTR(pScrn));    /* Set pScrn->monitor */    pScrn->monitor = pScrn->confScreen->monitor;    /*     * The first thing we should figure out is the depth, bpp, etc.     * Our default depth is 8, so pass it to the helper function.     * We support both 24bpp and 32bpp layouts, so indicate that.     */    if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) {	return FALSE;    } else {	/* Check that the returned depth is one we support */	switch (pScrn->depth) {	case 8:	case 15:	case 16:	case 24:	    /* OK */	    break;	default:	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,		       "Given depth (%d) is not supported by this driver\n",		       pScrn->depth);	    return FALSE;	}    }    xf86PrintDepthBpp(pScrn);    /*     * This must happen after pScrn->display has been set because     * xf86SetWeight references it.     */    if (pScrn->depth > 8) {	/* The defaults are OK for us */	rgb zeros = {0, 0, 0};	if (!xf86SetWeight(pScrn, zeros, zeros)) {	    return FALSE;	} else {	    /* XXX check that weight returned is supported */            ;        }    }    if (!xf86SetDefaultVisual(pScrn, -1)) {	return FALSE;    } else {	/* We don't currently support DirectColor at > 8bpp */	if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual"		       " (%s) is not supported at depth %d\n",		       xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);	    return FALSE;	}    }    bytesPerPixel = pScrn->bitsPerPixel / 8;    /* We use a programamble clock */    pScrn->progClock = TRUE;    /* Collect all of the relevant option flags (fill in pScrn->options) */    xf86CollectOptions(pScrn, NULL);    /* Process the options */    if (!(pI128->Options = xalloc(sizeof(I128Options))))	return FALSE;    memcpy(pI128->Options, I128Options, sizeof(I128Options));    xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI128->Options);    if (pScrn->depth == 8)	pScrn->rgbBits = 8;    /*     * The preferred method is to use the "hw cursor" option as a tri-state     * option, with the default set above.     */    from = X_DEFAULT;    pI128->HWCursor = TRUE;    if (xf86GetOptValBool(pI128->Options, OPTION_HW_CURSOR, &pI128->HWCursor)) {	from = X_CONFIG;    }    /* For compatibility, accept this too (as an override) */    if (xf86ReturnOptValBool(pI128->Options, OPTION_SW_CURSOR, FALSE)) {	from = X_CONFIG;	pI128->HWCursor = FALSE;    }    xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",		pI128->HWCursor ? "HW" : "SW");    if (xf86ReturnOptValBool(pI128->Options, OPTION_NOACCEL, FALSE)) {	pI128->NoAccel = TRUE;	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");    } else pI128->NoAccel = FALSE;    if (xf86ReturnOptValBool(pI128->Options, OPTION_SYNC_ON_GREEN, FALSE)) {	pI128->DACSyncOnGreen = TRUE;	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Sync-on-Green enabled\n");    } else pI128->DACSyncOnGreen = FALSE;    if (xf86ReturnOptValBool(pI128->Options, OPTION_SHOWCACHE, FALSE)) {	pI128->ShowCache = TRUE;	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n");    } else pI128->ShowCache = FALSE;    if (xf86ReturnOptValBool(pI128->Options, OPTION_DAC6BIT, FALSE)) {	pI128->DAC8Bit = FALSE;	pScrn->rgbBits = 6;	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Dac6Bit enabled\n");    } else pI128->DAC8Bit = TRUE;    if (xf86ReturnOptValBool(pI128->Options, OPTION_DEBUG, FALSE)) {	pI128->Debug = TRUE;	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Debug enabled\n");    } else pI128->Debug = FALSE;    if (xf86ReturnOptValBool(pI128->Options, OPTION_FLATPANEL, FALSE)) {	pI128->FlatPanel = TRUE;	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "FlatPanel forced\n");    } else pI128->FlatPanel = FALSE;    /*     * Set the Chipset and ChipRev.     */    from = X_PROBED;    pI128->Chipset = pI128->PciInfo->chipType;    pScrn->chipset = (char *)xf86TokenToString(I128Chipsets, pI128->Chipset);    pI128->ChipRev = pI128->PciInfo->chipRev;    /*     * This shouldn't happen because such problems should be caught in     * I128Probe(), but check it just in case.     */    if (pScrn->chipset == NULL) {	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,		   "ChipID 0x%04X is not recognised\n", pI128->Chipset);	return FALSE;    }    if (pI128->Chipset < 0) {	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,		   "Chipset \"%s\" is not recognised\n", pScrn->chipset);	return FALSE;    }    xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset);    iobase = pI128->PciInfo->ioBase[5] & 0xFF00;    pI128->RegRec.iobase = iobase;    pI128->io.rbase_g = inl(iobase)        & 0xFFFFFF00;    pI128->io.rbase_w = inl(iobase + 0x04) & 0xFFFFFF00;    pI128->io.rbase_a = inl(iobase + 0x08) & 0xFFFFFF00;    pI128->io.rbase_b = inl(iobase + 0x0C) & 0xFFFFFF00;    pI128->io.rbase_i = inl(iobase + 0x10) & 0xFFFFFF00;    pI128->io.rbase_e = inl(iobase + 0x14) & 0xFFFF8003;    pI128->io.id =      inl(iobase + 0x18) & /* 0x7FFFFFFF */ 0xFFFFFFFF;    pI128->io.config1 = inl(iobase + 0x1C) & /* 0xF3333F1F */ 0xFF133706;    pI128->io.config2 = inl(iobase + 0x20) & 0xC1F70FFF;    pI128->io.sgram   = inl(iobase + 0x24) & 0xFFFFFFFF;    pI128->io.soft_sw = inl(iobase + 0x28) & 0x0000FFFF;    pI128->io.vga_ctl = inl(iobase + 0x30) & 0x0000FFFF;    if (pI128->Debug)	I128DumpBaseRegisters(pScrn);    pI128->RegRec.config1 = pI128->io.config1;    pI128->RegRec.config2 = pI128->io.config2;    pI128->RegRec.sgram = pI128->io.sgram;    if (pI128->Chipset == PCI_CHIP_I128_T2R4)	pI128->io.sgram = 0x211BF030;    else	pI128->io.sgram = 0x21089030;    /* vga_ctl is saved later */    /* enable all of the memory mapped windows */    pI128->io.config1 &= 0x3300001F;    pI128->io.config1 |= 0x00331F10;    outl(iobase + 0x1C, pI128->io.config1);    pI128->MemoryType = I128_MEMORY_UNKNOWN;    if (pI128->Chipset == PCI_CHIP_I128_T2R4)	pI128->MemoryType = I128_MEMORY_SGRAM;    else if (pI128->Chipset == PCI_CHIP_I128_T2R) {	if ((pI128->io.config2&6) == 2)		pI128->MemoryType = I128_MEMORY_SGRAM;	else		pI128->MemoryType = I128_MEMORY_WRAM;    } else if (pI128->Chipset == PCI_CHIP_I128_2) {   	if (((((pciConfigPtr)pI128->PciInfo->thisCard)->pci_command & 0x03)	    == 0x03) && (pI128->PciInfo->subsysCard == 0x08))   	   pI128->MemoryType = I128_MEMORY_DRAM;    }    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Memory type %s\n",	pI128->MemoryType == I128_MEMORY_SGRAM ? "SGRAM" :	pI128->MemoryType == I128_MEMORY_DRAM ? "DRAM" :	pI128->MemoryType == I128_MEMORY_WRAM ? "WRAM" : "UNKNOWN");    pI128->io.config2 &= 0xFF0FFF7F;    pI128->io.config2 |= 0x00100000;    if (pI128->MemoryType != I128_MEMORY_SGRAM)   	pI128->io.config2 |= 0x00400000;    outl(pI128->RegRec.iobase + 0x20, pI128->io.config2);    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Linear framebuffer at 0x%lX\n",	(unsigned long)pI128->PciInfo->memBase[0]);    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO registers at 0x%lX\n",	(unsigned long)pI128->PciInfo->ioBase[5]);    if (xf86RegisterResources(pI128->pEnt->index, NULL, ResExclusive)) {	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,		"xf86RegisterResources() found resource conflicts\n");	I128FreeRec(pScrn);	return FALSE;    }    /* HW bpp matches reported bpp */    pI128->bitsPerPixel = pScrn->bitsPerPixel;    pI128->depth = pScrn->depth;    pI128->weight.red =  pScrn->weight.red;    pI128->weight.green =  pScrn->weight.green;    pI128->weight.blue =  pScrn->weight.blue;    pI128->mode = pScrn->modes;    pScrn->videoRam = I128CountRam(pScrn);    pI128->MemorySize = pScrn->videoRam;    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VideoRAM: %d kByte\n",               pScrn->videoRam);	    /*     * If the driver can do gamma correction, it should call xf86SetGamma()     * here.     */    {	Gamma zeros = {0.0, 0.0, 0.0};	if (!xf86SetGamma(pScrn, zeros)) {	    return FALSE;	}    }    if (!I128MapMem(pScrn))	return FALSE;    /*     * Reset card if it isn't primary one (must be done after config1 is set)     */    if (!pI128->Primary)        I128SoftReset(pScrn);    if (pI128->Chipset != PCI_CHIP_I128) {	pI128->ddc1Read = NULL /*I128DDC1Read*/;	pI128->i2cInit = I128I2CInit;    }    /* Load DDC if we have the code to use it */    /* This gives us DDC1 */    if (pI128->ddc1Read || pI128->i2cInit) {        if (xf86LoadSubModule(pScrn, "ddc")) {          xf86LoaderReqSymLists(ddcSymbols, NULL);        } else {          /* ddc module not found, we can do without it */          pI128->ddc1Read = NULL;          /* Without DDC, we have no use for the I2C bus */          pI128->i2cInit = NULL;        }    }    /* - DDC can use I2C bus */    /* Load I2C if we have the code to use it */    if (pI128->i2cInit) {      if ( xf86LoadSubModule(pScrn, "i2c") ) {        xf86LoaderReqSymLists(i2cSymbols,NULL);      } else {        /* i2c module not found, we can do without it */        pI128->i2cInit = NULL;        pI128->I2C = NULL;      }    }    /* Read and print the Monitor DDC info */    mon = I128getDDC(pScrn);    pScrn->monitor->DDC = mon;    /* see if we can find a flatpanel */    if (!pI128->FlatPanel && mon) {	int i;        for (i=0; i<4; i++)    	    if (mon->det_mon[i].type == DS_NAME) {		if (strncmp((char *)mon->det_mon[i].section.name,			    "SGI 1600SW FP", 13) == 0) {			pI128->FlatPanel = TRUE;    			xf86DrvMsg(pScrn->scrnIndex, X_PROBED,				"Found FlatPanel via DDC2\n");		}		break;	    }    }    pI128->maxClock = 175000;    switch (pI128->Chipset) {    	case PCI_CHIP_I128:	    if (pI128->io.id & 0x0400)       /* 2 banks VRAM   */		pI128->RamdacType = IBM528_DAC;	    else		pI128->RamdacType = TI3025_DAC;	    break;    	case PCI_CHIP_I128_2:	    if (pI128->io.id & 0x0400)       /* 2 banks VRAM   */		pI128->RamdacType = IBM528_DAC;	    else		pI128->RamdacType = IBM526_DAC;	    pI128->maxClock = 220000;	    break;    	case PCI_CHIP_I128_T2R:	    pI128->RamdacType = IBM526_DAC;	    pI128->maxClock = 220000;	    break;    	case PCI_CHIP_I128_T2R4:	    pI128->RamdacType = SILVER_HAMMER_DAC;	    pI128->maxClock = 270000;	    break;	default:    	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"Unknown I128 chipset: %d\n",               		pI128->Chipset);            return(FALSE);    }    if ((pI128->maxClock == 175000) && (pI128->MemorySize == 8192))	pI128->maxClock = 220000;    switch(pI128->RamdacType) {       case TI3025_DAC:          /* verify that the ramdac is a TVP3025 */          pI128->mem.rbase_g[INDEX_TI] = TI_ID;				MB;          if ((pI128->mem.rbase_g[DATA_TI]&0xFF) != TI_VIEWPOINT25_ID) {    	     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"Ti3025 Ramdac not found\n");             return(FALSE);          }          ramdac = "TI3025";          pI128->mem.rbase_g[INDEX_TI] = TI_PLL_CONTROL;		MB;          pI128->mem.rbase_g[DATA_TI] = 0x00;				MB;          pI128->mem.rbase_g[INDEX_TI] = TI_MCLK_PLL_DATA;		MB;          n = pI128->mem.rbase_g[DATA_TI]&0x7f;          pI128->mem.rbase_g[INDEX_TI] = TI_PLL_CONTROL;		MB;          pI128->mem.rbase_g[DATA_TI] = 0x01;				MB;          pI128->mem.rbase_g[INDEX_TI] = TI_MCLK_PLL_DATA;		MB;          m = pI128->mem.rbase_g[DATA_TI]&0x7f;          pI128->mem.rbase_g[INDEX_TI] = TI_PLL_CONTROL;		MB;          pI128->mem.rbase_g[DATA_TI] = 0x02;				MB;          pI128->mem.rbase_g[INDEX_TI] = TI_MCLK_PLL_DATA;		MB;          p = pI128->mem.rbase_g[DATA_TI]&0x03;          pI128->mem.rbase_g[INDEX_TI] = TI_MCLK_DCLK_CONTROL;		MB;          mdc = pI128->mem.rbase_g[DATA_TI]&0xFF;          if (mdc&0x08)	    mdc = (mdc&0x07)*2 + 2;          else	    mdc = 1;          mclk = ((1431818 * ((m+2) * 8)) / (n+2) / (1 << p) / mdc + 50) / 100;    	  xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"Using TI 3025 programmable clock (MCLK %1.3f MHz)\n",			mclk / 1000.0);	  pI128->minClock = 20000;	  pI128->ProgramDAC = I128ProgramTi3025;	  break;       case IBM524_DAC:    	  xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"IBM524 Ramdac not supported\n");          return(FALSE);       case IBM526_DAC:          /* verify that the ramdac is an IBM526 */          ramdac = "IBM526";	  tmph = pI128->mem.rbase_g[IDXH_I] & 0xFF;	  tmpl = pI128->mem.rbase_g[IDXL_I] & 0xFF;          pI128->mem.rbase_g[IDXH_I] = 0;				MB;          pI128->mem.rbase_g[IDXL_I] = IBMRGB_id;			MB;	  tmp = pI128->mem.rbase_g[DATA_I] & 0xFF;          pI128->mem.rbase_g[IDXL_I] = IBMRGB_sysclk_ref_div;		MB;	  n = pI128->mem.rbase_g[DATA_I] & 0x1f;          pI128->mem.rbase_g[IDXL_I] = IBMRGB_sysclk_vco_div;		MB;	  m = pI128->mem.rbase_g[DATA_I];	  df = m>>6;	  m &= 0x3f;	  if (n == 0) { m=0; n=1; }	  mclk = ((2517500 * (m+65)) / n / (8>>df) + 50) / 100;	  pI128->mem.rbase_g[IDXL_I] = tmpl;				MB;	  pI128->mem.rbase_g[IDXH_I] = tmph;				MB;          if (tmp != 2) {    	     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"IBM526 Ramdac not found\n");             return(FALSE);          }    	  xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"Using IBM 526 programmable clock (MCLK %1.3f MHz)\n",			mclk / 1000.0);	  pI128->minClock = 25000;	  pI128->ProgramDAC = I128ProgramIBMRGB;          break;       case IBM528_DAC:          /* verify that the ramdac is an IBM528 */          ramdac = "IBM528";	  tmph = pI128->mem.rbase_g[IDXH_I] & 0xFF;	  tmpl = pI128->mem.rbase_g[IDXL_I] & 0xFF;          pI128->mem.rbase_g[IDXH_I] = 0;				MB;          pI128->mem.rbase_g[IDXL_I] = IBMRGB_id;			MB;	  tmp = pI128->mem.rbase_g[DATA_I] & 0xFF;          pI128->mem.rbase_g[IDXL_I] = IBMRGB_sysclk_ref_div;		MB;	  n = pI128->mem.rbase_g[DATA_I] & 0x1f;          pI128->mem.rbase_g[IDXL_I] = IBMRGB_sysclk_vco_div;		MB;	  m = pI128->mem.rbase_g[DATA_I] & 0xFF;	  df = m>>6;	  m &= 0x3f;	  if (n == 0) { m=0; n=1; }	  mclk = ((2517500 * (m+65)) / n / (8>>df) + 50) / 100;	  pI128->mem.rbase_g[IDXL_I] = tmpl;				MB;	  pI128->mem.rbase_g[IDXH_I] = tmph;				MB;          if (tmp != 2) {    	     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"IBM528 Ramdac not found\n");             return(FALSE);          }    	  xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"Using IBM 528 programmable clock (MCLK %1.3f MHz)\n",			mclk / 1000.0);	  pI128->minClock = 25000;	  pI128->ProgramDAC = I128ProgramIBMRGB;          break;       case SILVER_HAMMER_DAC:          /* verify that the ramdac is a Silver Hammer */          ramdac = "SilverHammer";	  tmph = pI128->mem.rbase_g[IDXH_I] & 0xFF;	  tmpl = pI128->mem.rbase_g[IDXL_I] & 0xFF;	  tmp = pI128->mem.rbase_g[DATA_I] & 0xFF;          pI128->mem.rbase_g[IDXL_I] = IBMRGB_sysclk_ref_div;		MB;	  n = pI128->mem.rbase_g[DATA_I] & 0x1f;          pI128->mem.rbase_g[IDXL_I] = IBMRGB_sysclk_vco_div;		MB;	  m = pI128->mem.rbase_g[DATA_I];	  df = m>>6;	  m &= 0x3f;	  if (n == 0) { m=0; n=1; }	  mclk = ((3750000 * (m+65)) / n / (8>>df) + 50) / 100;	  pI128->mem.rbase_g[IDXL_I] = tmpl;				MB;	  pI128->mem.rbase_g[IDXH_I] = tmph;				MB;          if (pI128->Chipset != PCI_CHIP_I128_T2R4) {    	     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"SilverHammer Ramdac not found\n");             return(FALSE);          }	  if (pI128->mem.rbase_g[CRT_1CON] & 0x00000100) {             pI128->FlatPanel = TRUE;    	     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"Digital flat panel detected\n");          } else if (pI128->FlatPanel)    	     xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,			"Digital flat panel forced\n");    	  xf86DrvMsg(pScrn->scrnIndex, X_PROBED,			"Using SilverHammer programmable clock (MCLK %1.3f MHz)\n",			mclk / 1000.0);	  pI128->minClock = 25000;	  pI128->ProgramDAC = I128ProgramSilverHammer;          break;       default:    	 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,		"Ramdac Unknown\n");          return(FALSE);     }    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,		"Ramdac Type min/max speed: %s %d/%d MHz\n",		ramdac, pI128->minClock/1000, pI128->maxClock/1000);    /*     * Setup the ClockRanges, which describe what clock ranges are available,     * and what sort of modes they can be used for.     */    clockRanges = xnfalloc(sizeof(ClockRange));    clockRanges->next = NULL;    clockRanges->minClock = pI128->minClock;    clockRanges->maxClock = pI128->maxClock;    clockRanges->clockIndex = -1;		/* programmable */    clockRanges->interlaceAllowed = TRUE;    clockRanges->doubleScanAllowed = TRUE;    clockRanges->ClockMulFactor = 1;    clockRanges->ClockDivFactor = 1;    /*     * xf86ValidateModes will check that the mode HTotal and VTotal values     * don't exceed the chipset's limit if pScrn->maxHValue and     * pScrn->maxVValue are set.  Since our I128ValidMode() already takes     * care of this, we don't worry about setting them here.     */    {	int *linePitches = NULL;	int minPitch = 256;	int maxPitch = 2048;		int pitchAlignment = 256;	        	if (pI128->MemoryType == I128_MEMORY_WRAM)	   pitchAlignment = (128 * 8);	pitchAlignment /= pI128->bitsPerPixel;	i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,			      pScrn->display->modes, clockRanges,			      linePitches, minPitch, maxPitch,			      pitchAlignment * pI128->bitsPerPixel,			      128, 2048,			      pScrn->display->virtualX,			      pScrn->display->virtualY,			      pI128->MemorySize,			      LOOKUP_BEST_REFRESH);	pI128->displayWidth = pScrn->virtualX;	if ((pScrn->virtualX % pitchAlignment) != 0)	   pI128->displayWidth += pitchAlignment -				  (pScrn->virtualX % pitchAlignment);    }    if (i == -1) {	I128FreeRec(pScrn);	return FALSE;    }    /* Prune the modes marked as invalid */    xf86PruneDriverModes(pScrn);    if (i == 0 || pScrn->modes == NULL) {	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");	I128FreeRec(pScrn);	return FALSE;    }    if ((pI128->MemorySize > 4096) &&        (pI128->MemoryType != I128_MEMORY_DRAM) &&        (pI128->MemoryType != I128_MEMORY_SGRAM))        pI128->displayOffset = 0x400000L %		          (pI128->displayWidth * (pI128->bitsPerPixel/8));    else        pI128->displayOffset = 0;    pI128->MemoryPtr =	    (pointer)&((char *)pI128->MemoryPtr)[pI128->displayOffset];    /* Set the current mode to the first in the list */    pScrn->currentMode = pScrn->modes;    /* Print the list of modes being used */    xf86PrintModes(pScrn);    /* Set display resolution */    xf86SetDpi(pScrn, 0, 0);    if (mod && xf86LoadSubModule(pScrn, mod) == NULL) {	I128FreeRec(pScrn);	return FALSE;    }    if (!xf86LoadSubModule(pScrn, "fb")) {	I128FreeRec(pScrn);	return FALSE;    }    xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL);    /* Load XAA if needed */    if (!pI128->NoAccel) {	if (!xf86LoadSubModule(pScrn, "xaa")) {	    I128FreeRec(pScrn);	    return FALSE;	}	xf86LoaderReqSymLists(xaaSymbols, NULL);    }    /* Load ramdac if needed */    if (pI128->HWCursor) {	if (!xf86LoadSubModule(pScrn, "ramdac")) {	    I128FreeRec(pScrn);	    return FALSE;	}	xf86LoaderReqSymLists(ramdacSymbols, NULL);    }    I128UnmapMem(pScrn);    if (pI128->Debug)    	xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "PreInit complete\n");    return TRUE;}