/**************************************************************************** PARAMETERS: pcidev - PCI device info for the video card on the bus to boot pVGAInfo - Place to return VGA info structure is requested cleanUp - True to clean up on exit, false to leave emulator active REMARKS: Boots the PCI/AGP video card on the bus using the Video ROM BIOS image and the X86 BIOS emulator module. ****************************************************************************/ int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo ** pVGAInfo, int cleanUp) { BE_VGAInfo *VGAInfo; printf("videoboot: Booting PCI video card bus %d, function %d, device %d\n", PCI_BUS(pcidev), PCI_FUNC(pcidev), PCI_DEV(pcidev)); /*Initialise the x86 BIOS emulator*/ if ((VGAInfo = malloc(sizeof(*VGAInfo))) == NULL) { printf("videoboot: Out of memory!\n"); return false; } memset(VGAInfo, 0, sizeof(*VGAInfo)); BE_init(0, 65536, VGAInfo, 0); /*Post all the display controller BIOS'es*/ PCI_postController(pcidev, VGAInfo); /*Cleanup and exit the emulator if requested. If the BIOS emulator is needed after booting the card, we will not call BE_exit and leave it enabled for further use (ie: VESA driver etc). */ if (cleanUp) { BE_exit(); if (VGAInfo->BIOSImage) free(VGAInfo->BIOSImage); free(VGAInfo); VGAInfo = NULL; } /*Return VGA info pointer if the caller requested it*/ if (pVGAInfo) *pVGAInfo = VGAInfo; return true; }
int DRV_init (int &argc, ACE_TCHAR *argv[]) { // Initialize front end. FE_init (); // Initialize driver private data. DRV_nfiles will be updated // by DRV_parse_args(). DRV_nfiles = 0; DRV_file_index = 0; #if defined (TAO_IDL_PREPROCESSOR) idl_global->set_cpp_location (TAO_IDL_PREPROCESSOR); #elif defined (ACE_CC_PREPROCESSOR) idl_global->set_cpp_location (ACE_CC_PREPROCESSOR); #else // Just default to cc idl_global->set_cpp_location ("cc"); #endif /* TAO_IDL_PREPROCESSOR */ // Does nothing for IDL compiler, stores -ORB args, initializes // ORB and IFR for IFR loader. return BE_init (argc, argv); }
int vga_bios_init(void) { struct pci_device *pdev; unsigned long romsize = 0; unsigned long romaddress = 0; unsigned char magic[2]; unsigned short ppcidata; /* pointer to pci data structure */ unsigned char pcisig[4]; /* signature of pci data structure */ unsigned char codetype; /* unsigned int vesa_mode = 0;*/ int XGIZ9_ROM = 0; if (vga_dev != NULL) { pdev = vga_dev; printf("Found VGA device: vendor=0x%04x, device=0x%04x\n", PCI_VENDOR(pdev->pa.pa_id),pdev->pa.pa_device); if (PCI_VENDOR(pdev->pa.pa_id) == 0x1002 && pdev->pa.pa_device == 0x4750) BE_wrw(0xc015e,0x4750); if (PCI_VENDOR((pdev->pa.pa_id) == 0x102b)) { printf("skipping matrox cards\n"); return -1; } pci_read_config_dword(pdev,0x30,(int*)&romaddress); romaddress &= (~1); /* enable rom address decode */ pci_write_config_dword(pdev,0x30,romaddress|1); if (romaddress == 0) { printf("No rom address assigned,skipped\n"); return -1; } #ifdef BONITOEL romaddress |= 0x10000000; #endif printf("Rom mapped to %lx\n",romaddress); magic[0] = readb(romaddress); magic[1] = readb(romaddress + 1); if (magic[0]==0x55 && magic[1]==0xaa) { printf("VGA bios found\n"); /* rom size is stored at offset 2,in 512 byte unit*/ romsize = (readb(romaddress + 2)) * 512; printf("rom size is %ldk\n",romsize/1024); ppcidata = readw(romaddress + 0x18); printf("PCI data structure at offset %x\n",ppcidata); pcisig[0] = readb(romaddress + ppcidata); pcisig[1] = readb(romaddress + ppcidata + 1); pcisig[2] = readb(romaddress + ppcidata + 2); pcisig[3] = readb(romaddress + ppcidata + 3); if (pcisig[0]!='P' || pcisig[1]!='C' || pcisig[2]!='I' || pcisig[3]!='R') { printf("PCIR expected,read %c%c%c%c\n", pcisig[0],pcisig[1],pcisig[2],pcisig[3]); printf("Invalid pci signature found,give up\n"); return -1; } codetype = readb(romaddress + ppcidata + 0x14); if (codetype != 0) { printf("Not x86 code in rom,give up\n"); return -1; } } else { #ifdef HAVE_XGIZ9_ROM romaddress = z9sl10810_rom_data; XGIZ9_ROM = 1; romsize = (readb(romaddress + 2)) * 512; #else printf("No valid bios found,magic=%x%x\n",magic[0],magic[1]); return -1; #endif } memset(VGAInfo,0,sizeof(BE_VGAInfo)); VGAInfo[0].pciInfo = pdev; VGAInfo[0].BIOSImage = (void*)malloc(romsize); if (VGAInfo[0].BIOSImage == NULL) { printf("Error alloc memory for vgabios\n"); return -1; } VGAInfo[0].BIOSImageLen = romsize; if (XGIZ9_ROM == 1) memcpy(VGAInfo[0].BIOSImage,(char*)romaddress,romsize); else memcpy(VGAInfo[0].BIOSImage,(char*)(0xa0000000|romaddress),romsize); BE_init(debugFlags,65536,&VGAInfo[0]); regs.h.ah = pdev->pa.pa_bus; regs.h.al = (pdev->pa.pa_device<<3)|(pdev->pa.pa_function&0x7); // Execute the BIOS POST code #ifdef DEBUG_EMU_VGA X86EMU_trace_on(); #endif BE_callRealMode(0xC000,0x0003,®s,&sregs); #if 0 { RMREGS in; RMREGS out; in.e.eax = 0x0003; BE_int86(0x10,&in,&out); } #endif if (XGIZ9_ROM == 0) { //BE_exit(); pci_read_config_dword(pdev,0x30,(int*)&romaddress); /* disable rom address decode */ pci_write_config_dword(pdev,0x30,romaddress & ~1); } printf("vgabios_init: Emulation done\n"); vga_available = 1; return 1; } else{ printf("No VGA PCI device available\n"); return -1; } }