Exemplo n.º 1
0
irqreturn_t
nouveau_irq_handler(DRM_IRQ_ARGS)
{
	struct drm_device *dev = arg;
	struct nouveau_device *device = nouveau_dev(dev);
	struct nouveau_mc *pmc = nouveau_mc(device);
	u32 stat;

	stat = nv_rd32(device, 0x000100);
	if (stat == 0 || stat == ~0)
		return IRQ_NONE;

	nv_subdev(pmc)->intr(nv_subdev(pmc));

	if (device->card_type >= NV_D0) {
		if (nv_rd32(device, 0x000100) & 0x04000000)
			nvd0_display_intr(dev);
	} else
	if (device->card_type >= NV_50) {
		if (nv_rd32(device, 0x000100) & 0x04000000)
			nv50_display_intr(dev);
	}

	return IRQ_HANDLED;
}
Exemplo n.º 2
0
int
nv04_pm_clocks_set(struct drm_device *dev, void *pre_state)
{
	struct nouveau_device *device = nouveau_dev(dev);
	struct nouveau_timer *ptimer = nouveau_timer(device);
	struct nv04_pm_state *state = pre_state;

	prog_pll(dev, &state->core);

	if (state->memory.pll.reg) {
		prog_pll(dev, &state->memory);
		if (device->card_type < NV_30) {
			if (device->card_type == NV_20)
				nv_mask(device, 0x1002c4, 0, 1 << 20);

			/* Reset the DLLs */
			nv_mask(device, 0x1002c0, 0, 1 << 8);
		}
	}

	nv_ofuncs(ptimer)->init(nv_object(ptimer));

	kfree(state);
	return 0;
}
Exemplo n.º 3
0
static int nouveau_platform_remove(struct platform_device *pdev)
{
	struct drm_device *drm_dev = platform_get_drvdata(pdev);
	struct nouveau_device *device = nouveau_dev(drm_dev);
	struct nouveau_platform_gpu *gpu = nv_device_to_platform(device)->gpu;

	nouveau_drm_device_remove(drm_dev);

	return nouveau_platform_power_down(gpu);
}
Exemplo n.º 4
0
static void
nv50_cursor_set_pos(struct nouveau_crtc *nv_crtc, int x, int y)
{
	struct nouveau_device *device = nouveau_dev(nv_crtc->base.dev);

	nv_crtc->cursor_saved_x = x; nv_crtc->cursor_saved_y = y;
	nv_wr32(device, NV50_PDISPLAY_CURSOR_USER_POS(nv_crtc->index),
		((y & 0xFFFF) << 16) | (x & 0xFFFF));
	/* Needed to make the cursor move. */
	nv_wr32(device, NV50_PDISPLAY_CURSOR_USER_POS_CTRL(nv_crtc->index), 0);
}
Exemplo n.º 5
0
static void
prog_pll(struct drm_device *dev, struct nv04_pm_clock *clk)
{
	struct nouveau_device *device = nouveau_dev(dev);
	struct nouveau_clock *pclk = nouveau_clock(device);
	u32 reg = clk->pll.reg;

	/* thank the insane nouveau_hw_setpll() interface for this */
	if (device->card_type >= NV_40)
		reg += 4;

	pclk->pll_prog(pclk, reg, &clk->calc);
}
Exemplo n.º 6
0
irqreturn_t
nouveau_irq_handler(DRM_IRQ_ARGS)
{
	struct drm_device *dev = arg;
	struct nouveau_device *device = nouveau_dev(dev);
	struct nouveau_mc *pmc = nouveau_mc(device);
	u32 stat;

	stat = nv_rd32(device, 0x000100);
	if (stat == 0 || stat == ~0)
		return IRQ_NONE;

	nv_subdev(pmc)->intr(nv_subdev(pmc));
	return IRQ_HANDLED;
}
Exemplo n.º 7
0
static unsigned int
nouveau_vga_set_decode(void *priv, bool state)
{
	struct nouveau_device *device = nouveau_dev(priv);

	if (device->chipset >= 0x40)
		nv_wr32(device, 0x088054, state);
	else
		nv_wr32(device, 0x001854, state);

	if (state)
		return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
		       VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
	else
		return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
}
Exemplo n.º 8
0
static void
legacy_perf_init(struct drm_device *dev)
{
	struct nouveau_device *device = nouveau_dev(dev);
	struct nouveau_drm *drm = nouveau_drm(dev);
	struct nvbios *bios = &drm->vbios;
	struct nouveau_pm *pm = nouveau_pm(dev);
	char *perf, *entry, *bmp = &bios->data[bios->offset];
	int headerlen, use_straps;

	if (bmp[5] < 0x5 || bmp[6] < 0x14) {
		NV_DEBUG(drm, "BMP version too old for perf\n");
		return;
	}

	perf = ROMPTR(dev, bmp[0x73]);
	if (!perf) {
		NV_DEBUG(drm, "No memclock table pointer found.\n");
		return;
	}

	switch (perf[0]) {
	case 0x12:
	case 0x14:
	case 0x18:
		use_straps = 0;
		headerlen = 1;
		break;
	case 0x01:
		use_straps = perf[1] & 1;
		headerlen = (use_straps ? 8 : 2);
		break;
	default:
		NV_WARN(drm, "Unknown memclock table version %x.\n", perf[0]);
		return;
	}

	entry = perf + headerlen;
	if (use_straps)
		entry += (nv_rd32(device, NV_PEXTDEV_BOOT_0) & 0x3c) >> 1;

	sprintf(pm->perflvl[0].name, "performance_level_0");
	pm->perflvl[0].memory = ROM16(entry[0]) * 20;
	pm->nr_perflvl = 1;
}
Exemplo n.º 9
0
static int
calc_pll(struct drm_device *dev, u32 id, int khz, struct nv04_pm_clock *clk)
{
	struct nouveau_device *device = nouveau_dev(dev);
	struct nouveau_bios *bios = nouveau_bios(device);
	struct nouveau_clock *pclk = nouveau_clock(device);
	int ret;

	ret = nvbios_pll_parse(bios, id, &clk->pll);
	if (ret)
		return ret;

	ret = pclk->pll_calc(pclk, &clk->pll, khz, &clk->calc);
	if (!ret)
		return -EINVAL;

	return 0;
}
Exemplo n.º 10
0
u8 *
nouveau_perf_ramcfg(struct drm_device *dev, u32 freq, u8 *ver, u8 *len)
{
	struct nouveau_device *device = nouveau_dev(dev);
	struct nouveau_drm *drm = nouveau_drm(dev);
	struct nvbios *bios = &drm->vbios;
	u8 strap, hdr, cnt;
	u8 *rammap;

	strap = (nv_rd32(device, 0x101000) & 0x0000003c) >> 2;
	if (bios->ram_restrict_tbl_ptr)
		strap = bios->data[bios->ram_restrict_tbl_ptr + strap];

	rammap = nouveau_perf_rammap(dev, freq, ver, &hdr, &cnt, len);
	if (rammap && strap < cnt)
		return rammap + hdr + (strap * *len);

	return NULL;
}
Exemplo n.º 11
0
void
nouveau_irq_uninstall(struct drm_device *dev)
{
	nv_wr32(nouveau_dev(dev), 0x000140, 0x00000000);
}
Exemplo n.º 12
0
int
nouveau_irq_postinstall(struct drm_device *dev)
{
	nv_wr32(nouveau_dev(dev), 0x000140, 0x00000001);
	return 0;
}