atibios.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. /****************************************************************************
  2. *
  3. * Video BOOT Graphics Card POST Module
  4. *
  5. * ========================================================================
  6. * Copyright (C) 2007 Freescale Semiconductor, Inc.
  7. * Jason Jin <Jason.jin@freescale.com>
  8. *
  9. * Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
  10. *
  11. * This file may be distributed and/or modified under the terms of the
  12. * GNU General Public License version 2.0 as published by the Free
  13. * Software Foundation and appearing in the file LICENSE.GPL included
  14. * in the packaging of this file.
  15. *
  16. * Licensees holding a valid Commercial License for this product from
  17. * SciTech Software, Inc. may use this file in accordance with the
  18. * Commercial License Agreement provided with the Software.
  19. *
  20. * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
  21. * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22. * PURPOSE.
  23. *
  24. * See http://www.scitechsoft.com/license/ for information about
  25. * the licensing options available and how to purchase a Commercial
  26. * License Agreement.
  27. *
  28. * Contact license@scitechsoft.com if any conditions of this licensing
  29. * are not clear to you, or you have questions about licensing options.
  30. *
  31. * ========================================================================
  32. *
  33. * Language: ANSI C
  34. * Environment: Linux Kernel
  35. * Developer: Kendall Bennett
  36. *
  37. * Description: Module to implement booting PCI/AGP controllers on the
  38. * bus. We use the x86 real mode emulator to run the BIOS on
  39. * graphics controllers to bring the cards up.
  40. *
  41. * Note that at present this module does *not* support
  42. * multiple controllers.
  43. *
  44. * The orignal name of this file is warmboot.c.
  45. * Jason ported this file to u-boot to run the ATI video card
  46. * BIOS in u-boot.
  47. ****************************************************************************/
  48. #include <common.h>
  49. #include <compiler.h>
  50. #include <bios_emul.h>
  51. #include <errno.h>
  52. #include <log.h>
  53. #include <malloc.h>
  54. #include <vbe.h>
  55. #include <linux/delay.h>
  56. #include "biosemui.h"
  57. /* Length of the BIOS image */
  58. #define MAX_BIOSLEN (128 * 1024L)
  59. /* Place to save PCI BAR's that we change and later restore */
  60. static u32 saveROMBaseAddress;
  61. static u32 saveBaseAddress10;
  62. static u32 saveBaseAddress14;
  63. static u32 saveBaseAddress18;
  64. static u32 saveBaseAddress20;
  65. /* Addres im memory of VBE region */
  66. const int vbe_offset = 0x2000;
  67. #ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
  68. static const void *bios_ptr(const void *buf, BE_VGAInfo *vga_info,
  69. u32 x86_dword_ptr)
  70. {
  71. u32 seg_ofs, flat;
  72. seg_ofs = le32_to_cpu(x86_dword_ptr);
  73. flat = ((seg_ofs & 0xffff0000) >> 12) | (seg_ofs & 0xffff);
  74. if (flat >= 0xc0000)
  75. return vga_info->BIOSImage + flat - 0xc0000;
  76. else
  77. return buf + (flat - vbe_offset);
  78. }
  79. static int atibios_debug_mode(BE_VGAInfo *vga_info, RMREGS *regs,
  80. int vesa_mode, struct vbe_mode_info *mode_info)
  81. {
  82. void *buffer = (void *)(M.mem_base + vbe_offset);
  83. u16 buffer_seg = (((unsigned long)vbe_offset) >> 4) & 0xff00;
  84. u16 buffer_adr = ((unsigned long)vbe_offset) & 0xffff;
  85. struct vesa_mode_info *vm;
  86. struct vbe_info *info;
  87. const u16 *modes_bios, *ptr;
  88. u16 *modes;
  89. int size;
  90. debug("VBE: Getting information\n");
  91. regs->e.eax = VESA_GET_INFO;
  92. regs->e.esi = buffer_seg;
  93. regs->e.edi = buffer_adr;
  94. info = buffer;
  95. memset(info, '\0', sizeof(*info));
  96. strcpy(info->signature, "VBE2");
  97. BE_int86(0x10, regs, regs);
  98. if (regs->e.eax != 0x4f) {
  99. debug("VESA_GET_INFO: error %x\n", regs->e.eax);
  100. return -ENOSYS;
  101. }
  102. debug("version %x\n", le16_to_cpu(info->version));
  103. debug("oem '%s'\n", (char *)bios_ptr(buffer, vga_info,
  104. info->oem_string_ptr));
  105. debug("vendor '%s'\n", (char *)bios_ptr(buffer, vga_info,
  106. info->vendor_name_ptr));
  107. debug("product '%s'\n", (char *)bios_ptr(buffer, vga_info,
  108. info->product_name_ptr));
  109. debug("rev '%s'\n", (char *)bios_ptr(buffer, vga_info,
  110. info->product_rev_ptr));
  111. modes_bios = bios_ptr(buffer, vga_info, info->modes_ptr);
  112. debug("Modes: ");
  113. for (ptr = modes_bios; *ptr != 0xffff; ptr++)
  114. debug("%x ", le16_to_cpu(*ptr));
  115. debug("\nmemory %dMB\n", le16_to_cpu(info->total_memory) >> 4);
  116. size = (ptr - modes_bios) * sizeof(u16) + 2;
  117. modes = malloc(size);
  118. if (!modes)
  119. return -ENOMEM;
  120. memcpy(modes, modes_bios, size);
  121. regs->e.eax = VESA_GET_CUR_MODE;
  122. BE_int86(0x10, regs, regs);
  123. if (regs->e.eax != 0x4f) {
  124. debug("VESA_GET_CUR_MODE: error %x\n", regs->e.eax);
  125. return -ENOSYS;
  126. }
  127. debug("Current mode %x\n", regs->e.ebx);
  128. for (ptr = modes; *ptr != 0xffff; ptr++) {
  129. int mode = le16_to_cpu(*ptr);
  130. bool linear_ok;
  131. int attr;
  132. debug("Mode %x: ", mode);
  133. memset(buffer, '\0', sizeof(struct vbe_mode_info));
  134. regs->e.eax = VESA_GET_MODE_INFO;
  135. regs->e.ebx = 0;
  136. regs->e.ecx = mode;
  137. regs->e.edx = 0;
  138. regs->e.esi = buffer_seg;
  139. regs->e.edi = buffer_adr;
  140. BE_int86(0x10, regs, regs);
  141. if (regs->e.eax != 0x4f) {
  142. debug("VESA_GET_MODE_INFO: error %x\n", regs->e.eax);
  143. continue;
  144. }
  145. memcpy(mode_info->mode_info_block, buffer,
  146. sizeof(struct vesa_mode_info));
  147. mode_info->valid = true;
  148. vm = &mode_info->vesa;
  149. attr = le16_to_cpu(vm->mode_attributes);
  150. linear_ok = attr & 0x80;
  151. debug("res %d x %d, %d bpp, mm %d, (Linear %s, attr %02x)\n",
  152. le16_to_cpu(vm->x_resolution),
  153. le16_to_cpu(vm->y_resolution),
  154. vm->bits_per_pixel, vm->memory_model,
  155. linear_ok ? "OK" : "not available",
  156. attr);
  157. debug("\tRGB pos=%d,%d,%d, size=%d,%d,%d\n",
  158. vm->red_mask_pos, vm->green_mask_pos, vm->blue_mask_pos,
  159. vm->red_mask_size, vm->green_mask_size,
  160. vm->blue_mask_size);
  161. }
  162. return 0;
  163. }
  164. static int atibios_set_vesa_mode(RMREGS *regs, int vesa_mode,
  165. struct vbe_mode_info *mode_info)
  166. {
  167. void *buffer = (void *)(M.mem_base + vbe_offset);
  168. u16 buffer_seg = (((unsigned long)vbe_offset) >> 4) & 0xff00;
  169. u16 buffer_adr = ((unsigned long)vbe_offset) & 0xffff;
  170. struct vesa_mode_info *vm;
  171. debug("VBE: Setting VESA mode %#04x\n", vesa_mode);
  172. regs->e.eax = VESA_SET_MODE;
  173. regs->e.ebx = vesa_mode;
  174. /* request linear framebuffer mode and don't clear display */
  175. regs->e.ebx |= (1 << 14) | (1 << 15);
  176. BE_int86(0x10, regs, regs);
  177. if (regs->e.eax != 0x4f) {
  178. debug("VESA_SET_MODE: error %x\n", regs->e.eax);
  179. return -ENOSYS;
  180. }
  181. memset(buffer, '\0', sizeof(struct vbe_mode_info));
  182. debug("VBE: Geting info for VESA mode %#04x\n", vesa_mode);
  183. regs->e.eax = VESA_GET_MODE_INFO;
  184. regs->e.ecx = vesa_mode;
  185. regs->e.esi = buffer_seg;
  186. regs->e.edi = buffer_adr;
  187. BE_int86(0x10, regs, regs);
  188. if (regs->e.eax != 0x4f) {
  189. debug("VESA_GET_MODE_INFO: error %x\n", regs->e.eax);
  190. return -ENOSYS;
  191. }
  192. memcpy(mode_info->mode_info_block, buffer,
  193. sizeof(struct vesa_mode_info));
  194. mode_info->valid = true;
  195. mode_info->video_mode = vesa_mode;
  196. vm = &mode_info->vesa;
  197. vm->x_resolution = le16_to_cpu(vm->x_resolution);
  198. vm->y_resolution = le16_to_cpu(vm->y_resolution);
  199. vm->bytes_per_scanline = le16_to_cpu(vm->bytes_per_scanline);
  200. vm->phys_base_ptr = le32_to_cpu(vm->phys_base_ptr);
  201. vm->mode_attributes = le16_to_cpu(vm->mode_attributes);
  202. debug("VBE: Init complete\n");
  203. return 0;
  204. }
  205. #endif /* CONFIG_FRAMEBUFFER_SET_VESA_MODE */
  206. /****************************************************************************
  207. PARAMETERS:
  208. pcidev - PCI device info for the video card on the bus to boot
  209. vga_info - BIOS emulator VGA info structure
  210. REMARKS:
  211. This function executes the BIOS POST code on the controller. We assume that
  212. at this stage the controller has its I/O and memory space enabled and
  213. that all other controllers are in a disabled state.
  214. ****************************************************************************/
  215. static void PCI_doBIOSPOST(struct udevice *pcidev, BE_VGAInfo *vga_info,
  216. int vesa_mode, struct vbe_mode_info *mode_info)
  217. {
  218. RMREGS regs;
  219. RMSREGS sregs;
  220. pci_dev_t bdf;
  221. /* Determine the value to store in AX for BIOS POST. Per the PCI specs,
  222. AH must contain the bus and AL must contain the devfn, encoded as
  223. (dev << 3) | fn
  224. */
  225. memset(&regs, 0, sizeof(regs));
  226. memset(&sregs, 0, sizeof(sregs));
  227. bdf = dm_pci_get_bdf(pcidev);
  228. regs.x.ax = (int)PCI_BUS(bdf) << 8 |
  229. (int)PCI_DEV(bdf) << 3 | (int)PCI_FUNC(bdf);
  230. /*Setup the X86 emulator for the VGA BIOS*/
  231. BE_setVGA(vga_info);
  232. /*Execute the BIOS POST code*/
  233. BE_callRealMode(0xC000, 0x0003, &regs, &sregs);
  234. /*Cleanup and exit*/
  235. BE_getVGA(vga_info);
  236. #ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
  237. /* Useful for debugging */
  238. if (0)
  239. atibios_debug_mode(vga_info, &regs, vesa_mode, mode_info);
  240. if (vesa_mode != -1)
  241. atibios_set_vesa_mode(&regs, vesa_mode, mode_info);
  242. #endif
  243. }
  244. /****************************************************************************
  245. PARAMETERS:
  246. pcidev - PCI device info for the video card on the bus
  247. bar - Place to return the base address register offset to use
  248. RETURNS:
  249. The address to use to map the secondary BIOS (AGP devices)
  250. REMARKS:
  251. Searches all the PCI base address registers for the device looking for a
  252. memory mapping that is large enough to hold our ROM BIOS. We usually end up
  253. finding the framebuffer mapping (usually BAR 0x10), and we use this mapping
  254. to map the BIOS for the device into. We use a mapping that is already
  255. assigned to the device to ensure the memory range will be passed through
  256. by any PCI->PCI or AGP->PCI bridge that may be present.
  257. NOTE: Usually this function is only used for AGP devices, but it may be
  258. used for PCI devices that have already been POST'ed and the BIOS
  259. ROM base address has been zero'ed out.
  260. NOTE: This function leaves the original memory aperture disabled by leaving
  261. it programmed to all 1's. It must be restored to the correct value
  262. later.
  263. ****************************************************************************/
  264. static u32 PCI_findBIOSAddr(struct udevice *pcidev, int *bar)
  265. {
  266. u32 base, size;
  267. for (*bar = 0x10; *bar <= 0x14; (*bar) += 4) {
  268. dm_pci_read_config32(pcidev, *bar, &base);
  269. if (!(base & 0x1)) {
  270. dm_pci_write_config32(pcidev, *bar, 0xFFFFFFFF);
  271. dm_pci_read_config32(pcidev, *bar, &size);
  272. size = ~(size & ~0xFF) + 1;
  273. if (size >= MAX_BIOSLEN)
  274. return base & ~0xFF;
  275. }
  276. }
  277. return 0;
  278. }
  279. /****************************************************************************
  280. REMARKS:
  281. Some non-x86 Linux kernels map PCI relocateable I/O to values that
  282. are above 64K, which will not work with the BIOS image that requires
  283. the offset for the I/O ports to be a maximum of 16-bits. Ideally
  284. someone should fix the kernel to map the I/O ports for VGA compatible
  285. devices to a different location (or just all I/O ports since it is
  286. unlikely you can have enough devices in the machine to use up all
  287. 64K of the I/O space - a total of more than 256 cards would be
  288. necessary).
  289. Anyway to fix this we change all I/O mapped base registers and
  290. chop off the top bits.
  291. ****************************************************************************/
  292. static void PCI_fixupIObase(struct udevice *pcidev, int reg, u32 *base)
  293. {
  294. if ((*base & 0x1) && (*base > 0xFFFE)) {
  295. *base &= 0xFFFF;
  296. dm_pci_write_config32(pcidev, reg, *base);
  297. }
  298. }
  299. /****************************************************************************
  300. PARAMETERS:
  301. pcidev - PCI device info for the video card on the bus
  302. RETURNS:
  303. Pointers to the mapped BIOS image
  304. REMARKS:
  305. Maps a pointer to the BIOS image on the graphics card on the PCI bus.
  306. ****************************************************************************/
  307. void *PCI_mapBIOSImage(struct udevice *pcidev)
  308. {
  309. u32 BIOSImageBus;
  310. int BIOSImageBAR;
  311. u8 *BIOSImage;
  312. /*Save PCI BAR registers that might get changed*/
  313. dm_pci_read_config32(pcidev, PCI_ROM_ADDRESS, &saveROMBaseAddress);
  314. dm_pci_read_config32(pcidev, PCI_BASE_ADDRESS_0, &saveBaseAddress10);
  315. dm_pci_read_config32(pcidev, PCI_BASE_ADDRESS_1, &saveBaseAddress14);
  316. dm_pci_read_config32(pcidev, PCI_BASE_ADDRESS_2, &saveBaseAddress18);
  317. dm_pci_read_config32(pcidev, PCI_BASE_ADDRESS_4, &saveBaseAddress20);
  318. /*Fix up I/O base registers to less than 64K */
  319. if(saveBaseAddress14 != 0)
  320. PCI_fixupIObase(pcidev, PCI_BASE_ADDRESS_1, &saveBaseAddress14);
  321. else
  322. PCI_fixupIObase(pcidev, PCI_BASE_ADDRESS_4, &saveBaseAddress20);
  323. /* Some cards have problems that stop us from being able to read the
  324. BIOS image from the ROM BAR. To fix this we have to do some chipset
  325. specific programming for different cards to solve this problem.
  326. */
  327. BIOSImageBus = PCI_findBIOSAddr(pcidev, &BIOSImageBAR);
  328. if (BIOSImageBus == 0) {
  329. printf("Find bios addr error\n");
  330. return NULL;
  331. }
  332. BIOSImage = dm_pci_bus_to_virt(pcidev, BIOSImageBus,
  333. PCI_REGION_MEM, 0, MAP_NOCACHE);
  334. /*Change the PCI BAR registers to map it onto the bus.*/
  335. dm_pci_write_config32(pcidev, BIOSImageBAR, 0);
  336. dm_pci_write_config32(pcidev, PCI_ROM_ADDRESS, BIOSImageBus | 0x1);
  337. udelay(1);
  338. /*Check that the BIOS image is valid. If not fail, or return the
  339. compiled in BIOS image if that option was enabled
  340. */
  341. if (BIOSImage[0] != 0x55 || BIOSImage[1] != 0xAA || BIOSImage[2] == 0) {
  342. return NULL;
  343. }
  344. return BIOSImage;
  345. }
  346. /****************************************************************************
  347. PARAMETERS:
  348. pcidev - PCI device info for the video card on the bus
  349. REMARKS:
  350. Unmaps the BIOS image for the device and restores framebuffer mappings
  351. ****************************************************************************/
  352. void PCI_unmapBIOSImage(struct udevice *pcidev, void *BIOSImage)
  353. {
  354. dm_pci_write_config32(pcidev, PCI_ROM_ADDRESS, saveROMBaseAddress);
  355. dm_pci_write_config32(pcidev, PCI_BASE_ADDRESS_0, saveBaseAddress10);
  356. dm_pci_write_config32(pcidev, PCI_BASE_ADDRESS_1, saveBaseAddress14);
  357. dm_pci_write_config32(pcidev, PCI_BASE_ADDRESS_2, saveBaseAddress18);
  358. dm_pci_write_config32(pcidev, PCI_BASE_ADDRESS_4, saveBaseAddress20);
  359. }
  360. /****************************************************************************
  361. PARAMETERS:
  362. pcidev - PCI device info for the video card on the bus to boot
  363. VGAInfo - BIOS emulator VGA info structure
  364. RETURNS:
  365. true if successfully initialised, false if not.
  366. REMARKS:
  367. Loads and POST's the display controllers BIOS, directly from the BIOS
  368. image we can extract over the PCI bus.
  369. ****************************************************************************/
  370. static int PCI_postController(struct udevice *pcidev, uchar *bios_rom,
  371. int bios_len, BE_VGAInfo *vga_info,
  372. int vesa_mode, struct vbe_mode_info *mode_info)
  373. {
  374. u32 bios_image_len;
  375. uchar *mapped_bios;
  376. uchar *copy_of_bios;
  377. pci_dev_t bdf;
  378. if (bios_rom) {
  379. copy_of_bios = bios_rom;
  380. bios_image_len = bios_len;
  381. } else {
  382. /*
  383. * Allocate memory to store copy of BIOS from display
  384. * controller
  385. */
  386. mapped_bios = PCI_mapBIOSImage(pcidev);
  387. if (mapped_bios == NULL) {
  388. printf("videoboot: Video ROM failed to map!\n");
  389. return false;
  390. }
  391. bios_image_len = mapped_bios[2] * 512;
  392. copy_of_bios = malloc(bios_image_len);
  393. if (copy_of_bios == NULL) {
  394. printf("videoboot: Out of memory!\n");
  395. return false;
  396. }
  397. memcpy(copy_of_bios, mapped_bios, bios_image_len);
  398. PCI_unmapBIOSImage(pcidev, mapped_bios);
  399. }
  400. /*Save information in vga_info structure*/
  401. bdf = dm_pci_get_bdf(pcidev);
  402. vga_info->function = PCI_FUNC(bdf);
  403. vga_info->device = PCI_DEV(bdf);
  404. vga_info->bus = PCI_BUS(bdf);
  405. vga_info->pcidev = pcidev;
  406. vga_info->BIOSImage = copy_of_bios;
  407. vga_info->BIOSImageLen = bios_image_len;
  408. /*Now execute the BIOS POST for the device*/
  409. if (copy_of_bios[0] != 0x55 || copy_of_bios[1] != 0xAA) {
  410. printf("videoboot: Video ROM image is invalid!\n");
  411. return false;
  412. }
  413. PCI_doBIOSPOST(pcidev, vga_info, vesa_mode, mode_info);
  414. /*Reset the size of the BIOS image to the final size*/
  415. vga_info->BIOSImageLen = copy_of_bios[2] * 512;
  416. return true;
  417. }
  418. int biosemu_setup(struct udevice *pcidev, BE_VGAInfo **vga_infop)
  419. {
  420. BE_VGAInfo *VGAInfo;
  421. pci_dev_t bdf = dm_pci_get_bdf(pcidev);
  422. printf("videoboot: Booting PCI video card bus %d, function %d, device %d\n",
  423. PCI_BUS(bdf), PCI_FUNC(bdf), PCI_DEV(bdf));
  424. /*Initialise the x86 BIOS emulator*/
  425. if ((VGAInfo = malloc(sizeof(*VGAInfo))) == NULL) {
  426. printf("videoboot: Out of memory!\n");
  427. return -ENOMEM;
  428. }
  429. memset(VGAInfo, 0, sizeof(*VGAInfo));
  430. BE_init(0, 65536, VGAInfo, 0);
  431. *vga_infop = VGAInfo;
  432. return 0;
  433. }
  434. void biosemu_set_interrupt_handler(int intnum, int (*int_func)(void))
  435. {
  436. X86EMU_setupIntrFunc(intnum, (X86EMU_intrFuncs)int_func);
  437. }
  438. int biosemu_run(struct udevice *pcidev, uchar *bios_rom, int bios_len,
  439. BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
  440. struct vbe_mode_info *mode_info)
  441. {
  442. /*Post all the display controller BIOS'es*/
  443. if (!PCI_postController(pcidev, bios_rom, bios_len, vga_info,
  444. vesa_mode, mode_info))
  445. return -EINVAL;
  446. /*
  447. * Cleanup and exit the emulator if requested. If the BIOS emulator
  448. * is needed after booting the card, we will not call BE_exit and
  449. * leave it enabled for further use (ie: VESA driver etc).
  450. */
  451. if (clean_up) {
  452. BE_exit();
  453. if (vga_info->BIOSImage &&
  454. (ulong)(vga_info->BIOSImage) != 0xc0000)
  455. free(vga_info->BIOSImage);
  456. free(vga_info);
  457. }
  458. return 0;
  459. }
  460. /****************************************************************************
  461. PARAMETERS:
  462. pcidev - PCI device info for the video card on the bus to boot
  463. pVGAInfo - Place to return VGA info structure is requested
  464. cleanUp - true to clean up on exit, false to leave emulator active
  465. REMARKS:
  466. Boots the PCI/AGP video card on the bus using the Video ROM BIOS image
  467. and the X86 BIOS emulator module.
  468. ****************************************************************************/
  469. int BootVideoCardBIOS(struct udevice *pcidev, BE_VGAInfo **pVGAInfo,
  470. int clean_up)
  471. {
  472. BE_VGAInfo *VGAInfo;
  473. int ret;
  474. ret = biosemu_setup(pcidev, &VGAInfo);
  475. if (ret)
  476. return false;
  477. ret = biosemu_run(pcidev, NULL, 0, VGAInfo, clean_up, -1, NULL);
  478. if (ret)
  479. return false;
  480. /* Return VGA info pointer if the caller requested it*/
  481. if (pVGAInfo)
  482. *pVGAInfo = VGAInfo;
  483. return true;
  484. }