Ejemplo n.º 1
0
static void gma_func0_init(struct device *dev)
{
	u32 reg32;

	/* Unconditionally reset graphics */
	pci_write_config8(dev, GDRST, 1);
	udelay(50);
	pci_write_config8(dev, GDRST, 0);
	/* wait for device to finish */
	while (pci_read_config8(dev, GDRST) & 1) { };

	/* IGD needs to be Bus Master */
	reg32 = pci_read_config32(dev, PCI_COMMAND);
	pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);


#if !CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT
	/* PCI Init, will run VBIOS */
	pci_dev_init(dev);
#endif


#if CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT
	/* This should probably run before post VBIOS init. */
	printk(BIOS_SPEW, "Initializing VGA without OPROM.\n");
	u32 iobase, mmiobase, graphics_base;
	iobase = dev->resource_list[1].base;
	mmiobase = dev->resource_list[0].base;
	graphics_base = dev->resource_list[2].base + 0x20000;

	printk(BIOS_SPEW, "GMADR=0x%08x GTTADR=0x%08x\n",
		pci_read_config32(dev, GMADR),
		pci_read_config32(dev, GTTADR)
	);

	int i915lightup(u32 physbase, u32 iobase, u32 mmiobase, u32 gfx);
	u32 uma_memory_base = pci_read_config32(dev, BSM) & ~((1 << 20) - 1);
	int lightup_ok = i915lightup(uma_memory_base, iobase, mmiobase, graphics_base);
	if (lightup_ok)
		gfx_set_init_done(1);
#endif

}
Ejemplo n.º 2
0
static void gma_func0_init(struct device *dev)
{
	u32 reg32;

	/* IGD needs to be Bus Master */
	reg32 = pci_read_config32(dev, PCI_COMMAND);
	reg32 |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO;
	pci_write_config32(dev, PCI_COMMAND, reg32);

	/* Init graphics power management */
	gma_pm_init_pre_vbios(dev);

	if (!CONFIG(MAINBOARD_DO_NATIVE_VGA_INIT))
		/* PCI Init, will run VBIOS */
		pci_dev_init(dev);

	/* Post VBIOS init */
	gma_pm_init_post_vbios(dev);

	int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;

	/* Running graphics init on S3 breaks Linux drm driver. */
	if (!acpi_is_wakeup_s3() &&
	    CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
		if (vga_disable) {
			printk(BIOS_INFO,
			       "IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n");
		} else {
			/* This should probably run before post VBIOS init. */
			printk(BIOS_SPEW, "Initializing VGA without OPROM.\n");
			int lightup_ok;
			gma_gfxinit(&lightup_ok);
			if (lightup_ok)
				gfx_set_init_done(1);
		}
	}

	gma_enable_swsci();
	intel_gma_restore_opregion();
}