📄 nv_hw.c
字号:
break; case 0x0160: case 0x01D0: case 0x0240: NV_WR32(par->PMC, 0x1700, NV_RD32(par->PFB, 0x020C)); NV_WR32(par->PMC, 0x1704, 0); NV_WR32(par->PMC, 0x1708, 0); NV_WR32(par->PMC, 0x170C, NV_RD32(par->PFB, 0x020C)); NV_WR32(par->PGRAPH, 0x0860, 0); NV_WR32(par->PGRAPH, 0x0864, 0); NV_WR32(par->PRAMDAC, 0x0608, NV_RD32(par->PRAMDAC, 0x0608) | 0x00100000); break; case 0x0140: NV_WR32(par->PGRAPH, 0x0828, 0x0072cb77); NV_WR32(par->PGRAPH, 0x082C, 0x00000108); break; case 0x0220: case 0x0230: NV_WR32(par->PGRAPH, 0x0860, 0); NV_WR32(par->PGRAPH, 0x0864, 0); NV_WR32(par->PRAMDAC, 0x0608, NV_RD32(par->PRAMDAC, 0x0608) | 0x00100000); break; case 0x0090: case 0x02E0: case 0x0290: NV_WR32(par->PRAMDAC, 0x0608, NV_RD32(par->PRAMDAC, 0x0608) | 0x00100000); NV_WR32(par->PGRAPH, 0x0828, 0x07830610); NV_WR32(par->PGRAPH, 0x082C, 0x0000016A); break; default: break; }; NV_WR32(par->PGRAPH, 0x0b38, 0x2ffff800); NV_WR32(par->PGRAPH, 0x0b3c, 0x00006000); NV_WR32(par->PGRAPH, 0x032C, 0x01000000); NV_WR32(par->PGRAPH, 0x0220, 0x00001200); } else if (par->Architecture == NV_ARCH_30) { NV_WR32(par->PGRAPH, 0x0084, 0x40108700); NV_WR32(par->PGRAPH, 0x0890, 0x00140000); NV_WR32(par->PGRAPH, 0x008C, 0xf00e0431); NV_WR32(par->PGRAPH, 0x0090, 0x00008000); NV_WR32(par->PGRAPH, 0x0610, 0xf04b1f36); NV_WR32(par->PGRAPH, 0x0B80, 0x1002d888); NV_WR32(par->PGRAPH, 0x0B88, 0x62ff007f); } else { NV_WR32(par->PGRAPH, 0x0084, 0x00118700); NV_WR32(par->PGRAPH, 0x008C, 0xF20E0431); NV_WR32(par->PGRAPH, 0x0090, 0x00000000); NV_WR32(par->PGRAPH, 0x009C, 0x00000040); if ((par->Chipset & 0x0ff0) >= 0x0250) { NV_WR32(par->PGRAPH, 0x0890, 0x00080000); NV_WR32(par->PGRAPH, 0x0610, 0x304B1FB6); NV_WR32(par->PGRAPH, 0x0B80, 0x18B82880); NV_WR32(par->PGRAPH, 0x0B84, 0x44000000); NV_WR32(par->PGRAPH, 0x0098, 0x40000080); NV_WR32(par->PGRAPH, 0x0B88, 0x000000ff); } else { NV_WR32(par->PGRAPH, 0x0880, 0x00080000); NV_WR32(par->PGRAPH, 0x0094, 0x00000005); NV_WR32(par->PGRAPH, 0x0B80, 0x45CAA208); NV_WR32(par->PGRAPH, 0x0B84, 0x24000000); NV_WR32(par->PGRAPH, 0x0098, 0x00000040); NV_WR32(par->PGRAPH, 0x0750, 0x00E00038); NV_WR32(par->PGRAPH, 0x0754, 0x00000030); NV_WR32(par->PGRAPH, 0x0750, 0x00E10038); NV_WR32(par->PGRAPH, 0x0754, 0x00000030); } } if ((par->Architecture < NV_ARCH_40) || ((par->Chipset & 0xfff0) == 0x0040)) { for (i = 0; i < 32; i++) { NV_WR32(par->PGRAPH, 0x0900 + i*4, NV_RD32(par->PFB, 0x0240 +i*4)); NV_WR32(par->PGRAPH, 0x6900 + i*4, NV_RD32(par->PFB, 0x0240 +i*4)); } } else { if (((par->Chipset & 0xfff0) == 0x0090) || ((par->Chipset & 0xfff0) == 0x01D0) || ((par->Chipset & 0xfff0) == 0x02E0) || ((par->Chipset & 0xfff0) == 0x0290)) { for (i = 0; i < 60; i++) { NV_WR32(par->PGRAPH, 0x0D00 + i*4, NV_RD32(par->PFB, 0x0600 + i*4)); NV_WR32(par->PGRAPH, 0x6900 + i*4, NV_RD32(par->PFB, 0x0600 + i*4)); } } else { for (i = 0; i < 48; i++) { NV_WR32(par->PGRAPH, 0x0900 + i*4, NV_RD32(par->PFB, 0x0600 + i*4)); if(((par->Chipset & 0xfff0) != 0x0160) && ((par->Chipset & 0xfff0) != 0x0220) && ((par->Chipset & 0xfff0) != 0x240)) NV_WR32(par->PGRAPH, 0x6900 + i*4, NV_RD32(par->PFB, 0x0600 + i*4)); } } } if (par->Architecture >= NV_ARCH_40) { if ((par->Chipset & 0xfff0) == 0x0040) { NV_WR32(par->PGRAPH, 0x09A4, NV_RD32(par->PFB, 0x0200)); NV_WR32(par->PGRAPH, 0x09A8, NV_RD32(par->PFB, 0x0204)); NV_WR32(par->PGRAPH, 0x69A4, NV_RD32(par->PFB, 0x0200)); NV_WR32(par->PGRAPH, 0x69A8, NV_RD32(par->PFB, 0x0204)); NV_WR32(par->PGRAPH, 0x0820, 0); NV_WR32(par->PGRAPH, 0x0824, 0); NV_WR32(par->PGRAPH, 0x0864, par->FbMapSize - 1); NV_WR32(par->PGRAPH, 0x0868, par->FbMapSize - 1); } else { if ((par->Chipset & 0xfff0) == 0x0090 || (par->Chipset & 0xfff0) == 0x01D0 || (par->Chipset & 0xfff0) == 0x02E0 || (par->Chipset & 0xfff0) == 0x0290) { NV_WR32(par->PGRAPH, 0x0DF0, NV_RD32(par->PFB, 0x0200)); NV_WR32(par->PGRAPH, 0x0DF4, NV_RD32(par->PFB, 0x0204)); } else { NV_WR32(par->PGRAPH, 0x09F0, NV_RD32(par->PFB, 0x0200)); NV_WR32(par->PGRAPH, 0x09F4, NV_RD32(par->PFB, 0x0204)); } NV_WR32(par->PGRAPH, 0x69F0, NV_RD32(par->PFB, 0x0200)); NV_WR32(par->PGRAPH, 0x69F4, NV_RD32(par->PFB, 0x0204)); NV_WR32(par->PGRAPH, 0x0840, 0); NV_WR32(par->PGRAPH, 0x0844, 0); NV_WR32(par->PGRAPH, 0x08a0, par->FbMapSize - 1); NV_WR32(par->PGRAPH, 0x08a4, par->FbMapSize - 1); } } else { NV_WR32(par->PGRAPH, 0x09A4, NV_RD32(par->PFB, 0x0200)); NV_WR32(par->PGRAPH, 0x09A8, NV_RD32(par->PFB, 0x0204)); NV_WR32(par->PGRAPH, 0x0750, 0x00EA0000); NV_WR32(par->PGRAPH, 0x0754, NV_RD32(par->PFB, 0x0200)); NV_WR32(par->PGRAPH, 0x0750, 0x00EA0004); NV_WR32(par->PGRAPH, 0x0754, NV_RD32(par->PFB, 0x0204)); NV_WR32(par->PGRAPH, 0x0820, 0); NV_WR32(par->PGRAPH, 0x0824, 0); NV_WR32(par->PGRAPH, 0x0864, par->FbMapSize - 1); NV_WR32(par->PGRAPH, 0x0868, par->FbMapSize - 1); } NV_WR32(par->PGRAPH, 0x0B20, 0x00000000); NV_WR32(par->PGRAPH, 0x0B04, 0xFFFFFFFF); } } NV_WR32(par->PGRAPH, 0x053C, 0); NV_WR32(par->PGRAPH, 0x0540, 0); NV_WR32(par->PGRAPH, 0x0544, 0x00007FFF); NV_WR32(par->PGRAPH, 0x0548, 0x00007FFF); NV_WR32(par->PFIFO, 0x0140 * 4, 0x00000000); NV_WR32(par->PFIFO, 0x0141 * 4, 0x00000001); NV_WR32(par->PFIFO, 0x0480 * 4, 0x00000000); NV_WR32(par->PFIFO, 0x0494 * 4, 0x00000000); if (par->Architecture >= NV_ARCH_40) NV_WR32(par->PFIFO, 0x0481 * 4, 0x00010000); else NV_WR32(par->PFIFO, 0x0481 * 4, 0x00000100); NV_WR32(par->PFIFO, 0x0490 * 4, 0x00000000); NV_WR32(par->PFIFO, 0x0491 * 4, 0x00000000); if (par->Architecture >= NV_ARCH_40) NV_WR32(par->PFIFO, 0x048B * 4, 0x00001213); else NV_WR32(par->PFIFO, 0x048B * 4, 0x00001209); NV_WR32(par->PFIFO, 0x0400 * 4, 0x00000000); NV_WR32(par->PFIFO, 0x0414 * 4, 0x00000000); NV_WR32(par->PFIFO, 0x0084 * 4, 0x03000100); NV_WR32(par->PFIFO, 0x0085 * 4, 0x00000110); NV_WR32(par->PFIFO, 0x0086 * 4, 0x00000112); NV_WR32(par->PFIFO, 0x0143 * 4, 0x0000FFFF); NV_WR32(par->PFIFO, 0x0496 * 4, 0x0000FFFF); NV_WR32(par->PFIFO, 0x0050 * 4, 0x00000000); NV_WR32(par->PFIFO, 0x0040 * 4, 0xFFFFFFFF); NV_WR32(par->PFIFO, 0x0415 * 4, 0x00000001); NV_WR32(par->PFIFO, 0x048C * 4, 0x00000000); NV_WR32(par->PFIFO, 0x04A0 * 4, 0x00000000);#ifdef __BIG_ENDIAN NV_WR32(par->PFIFO, 0x0489 * 4, 0x800F0078);#else NV_WR32(par->PFIFO, 0x0489 * 4, 0x000F0078);#endif NV_WR32(par->PFIFO, 0x0488 * 4, 0x00000001); NV_WR32(par->PFIFO, 0x0480 * 4, 0x00000001); NV_WR32(par->PFIFO, 0x0494 * 4, 0x00000001); NV_WR32(par->PFIFO, 0x0495 * 4, 0x00000001); NV_WR32(par->PFIFO, 0x0140 * 4, 0x00000001); if (par->Architecture >= NV_ARCH_10) { if (par->twoHeads) { NV_WR32(par->PCRTC0, 0x0860, state->head); NV_WR32(par->PCRTC0, 0x2860, state->head2); } NV_WR32(par->PRAMDAC, 0x0404, NV_RD32(par->PRAMDAC, 0x0404) | (1 << 25)); NV_WR32(par->PMC, 0x8704, 1); NV_WR32(par->PMC, 0x8140, 0); NV_WR32(par->PMC, 0x8920, 0); NV_WR32(par->PMC, 0x8924, 0); NV_WR32(par->PMC, 0x8908, par->FbMapSize - 1); NV_WR32(par->PMC, 0x890C, par->FbMapSize - 1); NV_WR32(par->PMC, 0x1588, 0); NV_WR32(par->PCRTC, 0x0810, state->cursorConfig); NV_WR32(par->PCRTC, 0x0830, state->displayV - 3); NV_WR32(par->PCRTC, 0x0834, state->displayV - 1); if (par->FlatPanel) { if ((par->Chipset & 0x0ff0) == 0x0110) { NV_WR32(par->PRAMDAC, 0x0528, state->dither); } else if (par->twoHeads) { NV_WR32(par->PRAMDAC, 0x083C, state->dither); } VGA_WR08(par->PCIO, 0x03D4, 0x53); VGA_WR08(par->PCIO, 0x03D5, state->timingH); VGA_WR08(par->PCIO, 0x03D4, 0x54); VGA_WR08(par->PCIO, 0x03D5, state->timingV); VGA_WR08(par->PCIO, 0x03D4, 0x21); VGA_WR08(par->PCIO, 0x03D5, 0xfa); } VGA_WR08(par->PCIO, 0x03D4, 0x41); VGA_WR08(par->PCIO, 0x03D5, state->extra); } VGA_WR08(par->PCIO, 0x03D4, 0x19); VGA_WR08(par->PCIO, 0x03D5, state->repaint0); VGA_WR08(par->PCIO, 0x03D4, 0x1A); VGA_WR08(par->PCIO, 0x03D5, state->repaint1); VGA_WR08(par->PCIO, 0x03D4, 0x25); VGA_WR08(par->PCIO, 0x03D5, state->screen); VGA_WR08(par->PCIO, 0x03D4, 0x28); VGA_WR08(par->PCIO, 0x03D5, state->pixel); VGA_WR08(par->PCIO, 0x03D4, 0x2D); VGA_WR08(par->PCIO, 0x03D5, state->horiz); VGA_WR08(par->PCIO, 0x03D4, 0x1C); VGA_WR08(par->PCIO, 0x03D5, state->fifo); VGA_WR08(par->PCIO, 0x03D4, 0x1B); VGA_WR08(par->PCIO, 0x03D5, state->arbitration0); VGA_WR08(par->PCIO, 0x03D4, 0x20); VGA_WR08(par->PCIO, 0x03D5, state->arbitration1); if(par->Architecture >= NV_ARCH_30) { VGA_WR08(par->PCIO, 0x03D4, 0x47); VGA_WR08(par->PCIO, 0x03D5, state->arbitration1 >> 8); } VGA_WR08(par->PCIO, 0x03D4, 0x30); VGA_WR08(par->PCIO, 0x03D5, state->cursor0); VGA_WR08(par->PCIO, 0x03D4, 0x31); VGA_WR08(par->PCIO, 0x03D5, state->cursor1); VGA_WR08(par->PCIO, 0x03D4, 0x2F); VGA_WR08(par->PCIO, 0x03D5, state->cursor2); VGA_WR08(par->PCIO, 0x03D4, 0x39); VGA_WR08(par->PCIO, 0x03D5, state->interlace); if (!par->FlatPanel) { NV_WR32(par->PRAMDAC0, 0x050C, state->pllsel); NV_WR32(par->PRAMDAC0, 0x0508, state->vpll); if (par->twoHeads) NV_WR32(par->PRAMDAC0, 0x0520, state->vpll2); if (par->twoStagePLL) { NV_WR32(par->PRAMDAC0, 0x0578, state->vpllB); NV_WR32(par->PRAMDAC0, 0x057C, state->vpll2B); } } else { NV_WR32(par->PRAMDAC, 0x0848, state->scale); NV_WR32(par->PRAMDAC, 0x0828, state->crtcSync + par->PanelTweak); } NV_WR32(par->PRAMDAC, 0x0600, state->general); NV_WR32(par->PCRTC, 0x0140, 0); NV_WR32(par->PCRTC, 0x0100, 1); par->CurrentState = state;}void NVUnloadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) { VGA_WR08(par->PCIO, 0x03D4, 0x19); state->repaint0 = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x1A); state->repaint1 = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x25); state->screen = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x28); state->pixel = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x2D); state->horiz = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x1C); state->fifo = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x1B); state->arbitration0 = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x20); state->arbitration1 = VGA_RD08(par->PCIO, 0x03D5); if(par->Architecture >= NV_ARCH_30) { VGA_WR08(par->PCIO, 0x03D4, 0x47); state->arbitration1 |= (VGA_RD08(par->PCIO, 0x03D5) & 1) << 8; } VGA_WR08(par->PCIO, 0x03D4, 0x30); state->cursor0 = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x31); state->cursor1 = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x2F); state->cursor2 = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x39); state->interlace = VGA_RD08(par->PCIO, 0x03D5); state->vpll = NV_RD32(par->PRAMDAC0, 0x0508); if (par->twoHeads) state->vpll2 = NV_RD32(par->PRAMDAC0, 0x0520); if (par->twoStagePLL) { state->vpllB = NV_RD32(par->PRAMDAC0, 0x0578); state->vpll2B = NV_RD32(par->PRAMDAC0, 0x057C); } state->pllsel = NV_RD32(par->PRAMDAC0, 0x050C); state->general = NV_RD32(par->PRAMDAC, 0x0600); state->scale = NV_RD32(par->PRAMDAC, 0x0848); state->config = NV_RD32(par->PFB, 0x0200); if (par->Architecture >= NV_ARCH_10) { if (par->twoHeads) { state->head = NV_RD32(par->PCRTC0, 0x0860); state->head2 = NV_RD32(par->PCRTC0, 0x2860); VGA_WR08(par->PCIO, 0x03D4, 0x44); state->crtcOwner = VGA_RD08(par->PCIO, 0x03D5); } VGA_WR08(par->PCIO, 0x03D4, 0x41); state->extra = VGA_RD08(par->PCIO, 0x03D5); state->cursorConfig = NV_RD32(par->PCRTC, 0x0810); if ((par->Chipset & 0x0ff0) == 0x0110) { state->dither = NV_RD32(par->PRAMDAC, 0x0528); } else if (par->twoHeads) { state->dither = NV_RD32(par->PRAMDAC, 0x083C); } if (par->FlatPanel) { VGA_WR08(par->PCIO, 0x03D4, 0x53); state->timingH = VGA_RD08(par->PCIO, 0x03D5); VGA_WR08(par->PCIO, 0x03D4, 0x54); state->timingV = VGA_RD08(par->PCIO, 0x03D5); } }}void NVSetStartAddress(struct nvidia_par *par, u32 start){ NV_WR32(par->PCRTC, 0x800, start);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -