mga1x64.c (1369B)
1 /* $Id$ 2 ** 3 ** Copyright 1999 Brian J. Swetland. All rights reserved. 4 ** Distributed under the terms of the OpenBLT License 5 */ 6 7 #include "pci.h" 8 #include "fb.h" 9 10 #include <stdlib.h> 11 #include <blt/syscall.h> 12 13 #include "mga1x64.h" 14 15 16 static int32 mga_find(void **cookie) 17 { 18 pci_cfg cfg; 19 mga1x64 *mga; 20 int i; 21 22 if(pci_find(&cfg,VENDOR,DEVICE)) return -1; 23 24 dprintf("mga_find(): card @ %d/%d/%d",cfg.bus,cfg.dev,cfg.func); 25 26 if(!(mga = (mga1x64*) malloc(sizeof(mga1x64)))) return -1; 27 *cookie = mga; 28 29 mga->regs = (uint32 *) (cfg.base[REGS] & 0xfffffff0); 30 if(area_create(0x4000, 0, (void**) &(mga->regs), AREA_PHYSMAP) < 0){ 31 dprintf("mga_find(): CANNOT MAP REGISTERS!?"); 32 free(mga); 33 return -1; 34 } 35 36 mga->fb = (uchar *) (cfg.base[FB] & 0xfffffff0); 37 mga->fbsize = 0x100000; 38 if(area_create(mga->fbsize, 0, (void**) &(mga->fb), AREA_PHYSMAP) < 0){ 39 dprintf("mga_find(): CANNOT MAP FRAMEBUFFER!?"); 40 free(mga); 41 return -1; 42 } 43 44 dprintf("mga_find(): registers @ %xv, %xp", 45 mga->regs,cfg.base[REGS]&0xfffffff0); 46 dprintf("mga_find(): framebuffer @ %xv, %xp (sz %x)", 47 mga->fb,cfg.base[FB]&0xfffffff0,mga->fbsize); 48 49 dprintf("mga_find(): FIFOSTATUS = %x",RD(FIFOSTATUS)); 50 51 return 0; 52 } 53 54 static int32 mga_init(void *cookie) 55 { 56 mga1x64 *mga = (mga1x64*) cookie; 57 58 dprintf("mga_init()"); 59 } 60 61 fb_info fb_mga1x64 = 62 { 63 "MGA-1x64", 64 &mga_find, 65 &mga_init 66 }; 67