1#ifndef _MGA_MACROS_H_ 2#define _MGA_MACROS_H_ 3 4#ifdef XSERVER_LIBPCIACCESS 5#define MGA_IO_ADDRESS(p) (p)->PciInfo->regions[(p)->io_bar].base_addr 6#define VENDOR_ID(p) (p)->vendor_id 7#define DEVICE_ID(p) (p)->device_id 8#define SUBSYS_ID(p) (p)->subdevice_id 9#define CHIP_REVISION(p) (p)->revision 10#else 11#define MGA_IO_ADDRESS(p) (p)->IOAddress 12#define VENDOR_ID(p) (p)->vendor 13#define DEVICE_ID(p) (p)->chipType 14#define SUBSYS_ID(p) (p)->subsysCard 15#define CHIP_REVISION(p) (p)->chipRev 16#endif 17 18#define RGBEQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff)) 19 20#ifdef MGADRI 21#define MGA_SYNC_XTAG 0x275f4200 22 23#define MGABUSYWAIT() do { \ 24OUTREG(MGAREG_DWGSYNC, MGA_SYNC_XTAG); \ 25while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \ 26}while(0); 27 28#endif 29 30#define MGAISBUSY() (INREG8(MGAREG_Status + 2) & 0x01) 31 32#define WAITFIFO(cnt) \ 33 if(!pMga->UsePCIRetry) {\ 34 register int n = cnt; \ 35 if(n > pMga->FifoSize) n = pMga->FifoSize; \ 36 while(pMga->fifoCount < (n))\ 37 pMga->fifoCount = INREG8(MGAREG_FIFOSTATUS);\ 38 pMga->fifoCount -= n;\ 39 } 40 41#define XYADDRESS(x,y) \ 42 ((y) * pMga->CurrentLayout.displayWidth + (x) + pMga->YDstOrg) 43 44#define MAKEDMAINDEX(index) ((((index) >> 2) & 0x7f) | (((index) >> 6) & 0x80)) 45 46#define DMAINDICES(one,two,three,four) \ 47 ( MAKEDMAINDEX(one) | \ 48 (MAKEDMAINDEX(two) << 8) | \ 49 (MAKEDMAINDEX(three) << 16) | \ 50 (MAKEDMAINDEX(four) << 24) ) 51 52#define SET_PLANEMASK_REPLICATED(mask, rep_mask, bpp) \ 53 do { \ 54 if( (bpp != 24) \ 55 && !(pMga->AccelFlags & MGA_NO_PLANEMASK) \ 56 && ((mask) != pMga->PlaneMask)) { \ 57 pMga->PlaneMask = (mask); \ 58 OUTREG(MGAREG_PLNWT,(rep_mask)); \ 59 } \ 60 } while( 0 ) 61 62#define DISABLE_CLIP() { \ 63 pMga->AccelFlags &= ~CLIPPER_ON; \ 64 WAITFIFO(1); \ 65 OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); } 66 67#ifdef MGADRI 68#define CHECK_DMA_QUIESCENT(pMGA, pScrn) { \ 69 if (!pMGA->haveQuiescense) { \ 70 pMGA->GetQuiescence( pScrn ); \ 71 } \ 72} 73#else 74#define CHECK_DMA_QUIESCENT(pMGA, pScrn) 75#endif 76 77#define MGA_NOT_HAL(x) { x; } 78 79#define MGAISGx50(x) ((x)->is_Gx50) 80 81#define MGA_DH_NEEDS_HAL(x) (((x)->Chipset == PCI_CHIP_MGAG400) && \ 82 ((x)->ChipRev < 0x80)) 83 84#endif /* _MGA_MACROS_H_ */ 85