/* * BDM2: Banked dumb monochrome driver * Pascal Haible 8/93, haible@izfm.uni-stuttgart.de * * bdm2/driver/apollo/apollodriv.c * Hamish Coleman 11/93 hamish@zot.apana.org.au * * derived from: * hgc1280/* * Pascal Haible 8/93, haible@izfm.uni-stuttgart.de * hga2/* * Author: Davor Matic, dmatic@athena.mit.edu * and * vga256/* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * Thanks to Herb Peyerl (hpeyerl@novatel.ca) for the information on * programming this card. * * see bdm2/COPYRIGHT for copyright and disclaimers. */ /* $XFree86: mit/server/ddx/x386/bdm2/drivers/apollo/apollodriv.c,v 2.0 1994/04/10 05:54:10 dawes Exp $ */ #include "X.h" #include "input.h" #include "screenint.h" #include "compiler.h" #include "x386.h" #include "x386Priv.h" #include "xf86_OSlib.h" #include "xf86_Config.h" #include "bdm.h" #include "apolloHW.h" #ifdef NOTYET #include "mfbfuncs.h" #endif int apollo_Current_mode = apollo_Textmode; /* * Define the Apollo I/O Ports */ unsigned Apollo_IOBASE = AP_PORT_BASE; unsigned Apollo_IOPorts[16] = {AP_PORT_BASE, AP_PORT_BASE + 1, AP_PORT_BASE + 2, AP_PORT_BASE + 3, AP_PORT_BASE + 4, AP_PORT_BASE + 5, AP_PORT_BASE + 6, AP_PORT_BASE + 7, AP_PORT_BASE + 8, AP_PORT_BASE + 9, AP_PORT_BASE + 0x0a, AP_PORT_BASE + 0x0b, AP_PORT_BASE + 0x0c, AP_PORT_BASE + 0x0d, AP_PORT_BASE + 0x0e, AP_PORT_BASE + 0x0f}; int Num_Apollo_IOPorts = (sizeof(Apollo_IOPorts)/sizeof(Apollo_IOPorts[0])); char * ApolloIdent(); Bool ApolloProbe(); void ApolloEnterLeave(); void * ApolloInit(); void * ApolloSave(); void ApolloRestore(); void ApolloAdjust(); Bool ApolloSaveScreen(); void ApolloGetMode(); void ApolloFbInit(); extern int ApolloDoBitblt(); /* Assembler functions in apolloBank.s * - to be called by assembler functions only! */ /* They are empty for this card */ extern void ApolloSetRead(); extern void ApolloSetWrite(); extern void ApolloSetReadWrite(); #if 0 /* From bdm.h -- see there, this here might not be up to date */ /* * structure for accessing the video chip`s functions * * We are doing a total encapsulation of the driver's functions. * Banking (bdmSetReadWrite(p) etc.) is done in bdmBank.c * using the chip's function pointed to by * bmpSetReadWriteFunc(bank) etc. */ typedef struct { char * (* ChipIdent)(); Bool (* ChipProbe)(); void (* ChipEnterLeave)(); void * (* ChipInit)(); void * (* ChipSave)(); void (* ChipRestore)(); void (* ChipAdjust)(); Bool (* ChipSaveScreen)(); void (* ChipGetMode)(); /* These are the chip's banking functions: */ /* they do the real switching to the desired bank */ /* they 'become' bdmSetReadFunc() etc. */ void (* ChipSetRead)(); void (* ChipSetWrite)(); void (* ChipSetReadWrite)(); /* Bottom and top of the banking window (rel. to ChipMapBase) */ /* Note: Top = highest accessable byte + 1 */ void *ChipReadBottom; void *ChipReadTop; void *ChipWriteBottom; void *ChipWriteTop; /* Memory to map */ int ChipMapBase; int ChipMapSize; /* replaces MEMTOMAP */ int ChipSegmentSize; int ChipSegmentShift; int ChipSegmentMask; Bool ChipUse2Banks; /* Display size is given by the driver */ int ChipHDisplay; int ChipVDisplay; /* In case Scan Line in mfb is longer than HDisplay */ int ChipScanLineWidth; } bdmVideoChipRec, *bdmVideoChipPtr; #endif /* 0 */ bdmVideoChipRec APOLLO = { /* Functions */ ApolloIdent, ApolloProbe, ApolloEnterLeave, ApolloInit, ApolloSave, ApolloRestore, ApolloAdjust, ApolloSaveScreen, NoopDDA, /* ApolloGetMode */ #ifdef notyet ApolloFbInit, /* Initialize acclerated functions */ #endif ApolloSetRead, ApolloSetWrite, ApolloSetReadWrite, (void *)AP_BANK_BOTTOM, /* ReadBottom */ (void *)AP_BANK_TOP, /* ReadTop */ (void *)AP_BANK_BOTTOM, /* WriteBottom */ (void *)AP_BANK_TOP, /* WriteTop */ AP_MAP_BASE, /* MapBase */ AP_MAP_SIZE, /* MapSize */ AP_SEGMENT_SIZE, /* SegmentSize */ AP_SEGMENT_SHIFT, /* SegmentShift */ AP_SEGMENT_MASK, /* SegmentMask */ TRUE, /* Use2Banks */ /* for this non banking card this means the bitblt code can read from * source and write to dest. without having to bank within */ AP_HDISPLAY, /* HDisplay */ AP_VDISPLAY, /* VDisplay */ AP_SCAN_LINE_WIDTH, /* ScanLineWidth */ }; /* * ApolloIdent */ char * ApolloIdent(n) int n; { static char *chipsets[] = {"apollo9"}; if (n >= sizeof(chipsets) / sizeof(char *)) return(NULL); else return(chipsets[n]); } /* * ApolloProbe -- * check whether an Apollo ID-9 board is installed */ Bool ApolloProbe() { #ifndef OPTION_SECONDARY #define OPTION_SECONDARY 23 /* * If you have a 2.0 server then you will have to hardwire the * following if statement and delete this error line */ #error You need to configure primary/secondary port #endif /* * Set up I/O ports to be used by this card */ if (OFLG_ISSET(OPTION_SECONDARY, &bdm2InfoRec.options)) { int i; /* option "secondary" */ Apollo_IOBASE = AP_PORT_ALTERNATE; APOLLO.ChipMapBase = AP_MAP_ALTERNATE; for (i=0;i