|
@@ -92,7 +92,7 @@ NVSetOwner(struct drm_device *dev, int owner)
|
|
|
if (owner == 1)
|
|
|
owner *= 3;
|
|
|
|
|
|
- if (nv_device(drm->device)->chipset == 0x11) {
|
|
|
+ if (drm->device.info.chipset == 0x11) {
|
|
|
/* This might seem stupid, but the blob does it and
|
|
|
* omitting it often locks the system up.
|
|
|
*/
|
|
@@ -103,7 +103,7 @@ NVSetOwner(struct drm_device *dev, int owner)
|
|
|
/* CR44 is always changed on CRTC0 */
|
|
|
NVWriteVgaCrtc(dev, 0, NV_CIO_CRE_44, owner);
|
|
|
|
|
|
- if (nv_device(drm->device)->chipset == 0x11) { /* set me harder */
|
|
|
+ if (drm->device.info.chipset == 0x11) { /* set me harder */
|
|
|
NVWriteVgaCrtc(dev, 0, NV_CIO_CRE_2E, owner);
|
|
|
NVWriteVgaCrtc(dev, 0, NV_CIO_CRE_2E, owner);
|
|
|
}
|
|
@@ -152,7 +152,7 @@ nouveau_hw_decode_pll(struct drm_device *dev, uint32_t reg1, uint32_t pll1,
|
|
|
pllvals->NM1 = pll1 & 0xffff;
|
|
|
if (nv_two_reg_pll(dev) && pll2 & NV31_RAMDAC_ENABLE_VCO2)
|
|
|
pllvals->NM2 = pll2 & 0xffff;
|
|
|
- else if (nv_device(drm->device)->chipset == 0x30 || nv_device(drm->device)->chipset == 0x35) {
|
|
|
+ else if (drm->device.info.chipset == 0x30 || drm->device.info.chipset == 0x35) {
|
|
|
pllvals->M1 &= 0xf; /* only 4 bits */
|
|
|
if (pll1 & NV30_RAMDAC_ENABLE_VCO2) {
|
|
|
pllvals->M2 = (pll1 >> 4) & 0x7;
|
|
@@ -168,8 +168,8 @@ nouveau_hw_get_pllvals(struct drm_device *dev, enum nvbios_pll_type plltype,
|
|
|
struct nouveau_pll_vals *pllvals)
|
|
|
{
|
|
|
struct nouveau_drm *drm = nouveau_drm(dev);
|
|
|
- struct nouveau_object *device = drm->device;
|
|
|
- struct nouveau_bios *bios = nouveau_bios(device);
|
|
|
+ struct nvif_device *device = &drm->device;
|
|
|
+ struct nouveau_bios *bios = nvkm_bios(device);
|
|
|
uint32_t reg1, pll1, pll2 = 0;
|
|
|
struct nvbios_pll pll_lim;
|
|
|
int ret;
|
|
@@ -187,7 +187,7 @@ nouveau_hw_get_pllvals(struct drm_device *dev, enum nvbios_pll_type plltype,
|
|
|
pll2 = nvif_rd32(device, reg2);
|
|
|
}
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type == 0x40 && reg1 >= NV_PRAMDAC_VPLL_COEFF) {
|
|
|
+ if (drm->device.info.family == NV_DEVICE_INFO_V0_CELSIUS && reg1 >= NV_PRAMDAC_VPLL_COEFF) {
|
|
|
uint32_t ramdac580 = NVReadRAMDAC(dev, 0, NV_PRAMDAC_580);
|
|
|
|
|
|
/* check whether vpll has been forced into single stage mode */
|
|
@@ -255,9 +255,9 @@ nouveau_hw_fix_bad_vpll(struct drm_device *dev, int head)
|
|
|
*/
|
|
|
|
|
|
struct nouveau_drm *drm = nouveau_drm(dev);
|
|
|
- struct nouveau_object *device = drm->device;
|
|
|
- struct nouveau_clock *clk = nouveau_clock(device);
|
|
|
- struct nouveau_bios *bios = nouveau_bios(device);
|
|
|
+ struct nvif_device *device = &drm->device;
|
|
|
+ struct nouveau_clock *clk = nvkm_clock(device);
|
|
|
+ struct nouveau_bios *bios = nvkm_bios(device);
|
|
|
struct nvbios_pll pll_lim;
|
|
|
struct nouveau_pll_vals pv;
|
|
|
enum nvbios_pll_type pll = head ? PLL_VPLL1 : PLL_VPLL0;
|
|
@@ -394,21 +394,21 @@ nv_save_state_ramdac(struct drm_device *dev, int head,
|
|
|
struct nv04_crtc_reg *regp = &state->crtc_reg[head];
|
|
|
int i;
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_10)
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_CELSIUS)
|
|
|
regp->nv10_cursync = NVReadRAMDAC(dev, head, NV_RAMDAC_NV10_CURSYNC);
|
|
|
|
|
|
nouveau_hw_get_pllvals(dev, head ? PLL_VPLL1 : PLL_VPLL0, ®p->pllvals);
|
|
|
state->pllsel = NVReadRAMDAC(dev, 0, NV_PRAMDAC_PLL_COEFF_SELECT);
|
|
|
if (nv_two_heads(dev))
|
|
|
state->sel_clk = NVReadRAMDAC(dev, 0, NV_PRAMDAC_SEL_CLK);
|
|
|
- if (nv_device(drm->device)->chipset == 0x11)
|
|
|
+ if (drm->device.info.chipset == 0x11)
|
|
|
regp->dither = NVReadRAMDAC(dev, head, NV_RAMDAC_DITHER_NV11);
|
|
|
|
|
|
regp->ramdac_gen_ctrl = NVReadRAMDAC(dev, head, NV_PRAMDAC_GENERAL_CONTROL);
|
|
|
|
|
|
if (nv_gf4_disp_arch(dev))
|
|
|
regp->ramdac_630 = NVReadRAMDAC(dev, head, NV_PRAMDAC_630);
|
|
|
- if (nv_device(drm->device)->chipset >= 0x30)
|
|
|
+ if (drm->device.info.chipset >= 0x30)
|
|
|
regp->ramdac_634 = NVReadRAMDAC(dev, head, NV_PRAMDAC_634);
|
|
|
|
|
|
regp->tv_setup = NVReadRAMDAC(dev, head, NV_PRAMDAC_TV_SETUP);
|
|
@@ -450,7 +450,7 @@ nv_save_state_ramdac(struct drm_device *dev, int head,
|
|
|
if (nv_gf4_disp_arch(dev))
|
|
|
regp->ramdac_8c0 = NVReadRAMDAC(dev, head, NV_PRAMDAC_8C0);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type == NV_40) {
|
|
|
+ if (drm->device.info.family == NV_DEVICE_INFO_V0_CURIE) {
|
|
|
regp->ramdac_a20 = NVReadRAMDAC(dev, head, NV_PRAMDAC_A20);
|
|
|
regp->ramdac_a24 = NVReadRAMDAC(dev, head, NV_PRAMDAC_A24);
|
|
|
regp->ramdac_a34 = NVReadRAMDAC(dev, head, NV_PRAMDAC_A34);
|
|
@@ -466,26 +466,26 @@ nv_load_state_ramdac(struct drm_device *dev, int head,
|
|
|
struct nv04_mode_state *state)
|
|
|
{
|
|
|
struct nouveau_drm *drm = nouveau_drm(dev);
|
|
|
- struct nouveau_clock *clk = nouveau_clock(drm->device);
|
|
|
+ struct nouveau_clock *clk = nvkm_clock(&drm->device);
|
|
|
struct nv04_crtc_reg *regp = &state->crtc_reg[head];
|
|
|
uint32_t pllreg = head ? NV_RAMDAC_VPLL2 : NV_PRAMDAC_VPLL_COEFF;
|
|
|
int i;
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_10)
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_CELSIUS)
|
|
|
NVWriteRAMDAC(dev, head, NV_RAMDAC_NV10_CURSYNC, regp->nv10_cursync);
|
|
|
|
|
|
clk->pll_prog(clk, pllreg, ®p->pllvals);
|
|
|
NVWriteRAMDAC(dev, 0, NV_PRAMDAC_PLL_COEFF_SELECT, state->pllsel);
|
|
|
if (nv_two_heads(dev))
|
|
|
NVWriteRAMDAC(dev, 0, NV_PRAMDAC_SEL_CLK, state->sel_clk);
|
|
|
- if (nv_device(drm->device)->chipset == 0x11)
|
|
|
+ if (drm->device.info.chipset == 0x11)
|
|
|
NVWriteRAMDAC(dev, head, NV_RAMDAC_DITHER_NV11, regp->dither);
|
|
|
|
|
|
NVWriteRAMDAC(dev, head, NV_PRAMDAC_GENERAL_CONTROL, regp->ramdac_gen_ctrl);
|
|
|
|
|
|
if (nv_gf4_disp_arch(dev))
|
|
|
NVWriteRAMDAC(dev, head, NV_PRAMDAC_630, regp->ramdac_630);
|
|
|
- if (nv_device(drm->device)->chipset >= 0x30)
|
|
|
+ if (drm->device.info.chipset >= 0x30)
|
|
|
NVWriteRAMDAC(dev, head, NV_PRAMDAC_634, regp->ramdac_634);
|
|
|
|
|
|
NVWriteRAMDAC(dev, head, NV_PRAMDAC_TV_SETUP, regp->tv_setup);
|
|
@@ -522,7 +522,7 @@ nv_load_state_ramdac(struct drm_device *dev, int head,
|
|
|
if (nv_gf4_disp_arch(dev))
|
|
|
NVWriteRAMDAC(dev, head, NV_PRAMDAC_8C0, regp->ramdac_8c0);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type == NV_40) {
|
|
|
+ if (drm->device.info.family == NV_DEVICE_INFO_V0_CURIE) {
|
|
|
NVWriteRAMDAC(dev, head, NV_PRAMDAC_A20, regp->ramdac_a20);
|
|
|
NVWriteRAMDAC(dev, head, NV_PRAMDAC_A24, regp->ramdac_a24);
|
|
|
NVWriteRAMDAC(dev, head, NV_PRAMDAC_A34, regp->ramdac_a34);
|
|
@@ -603,10 +603,10 @@ nv_save_state_ext(struct drm_device *dev, int head,
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX);
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_21);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_20)
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_KELVIN)
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_47);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_30)
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_RANKINE)
|
|
|
rd_cio_state(dev, head, regp, 0x9f);
|
|
|
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_49);
|
|
@@ -615,14 +615,14 @@ nv_save_state_ext(struct drm_device *dev, int head,
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR2_INDEX);
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_ILACE__INDEX);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_10) {
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_CELSIUS) {
|
|
|
regp->crtc_830 = NVReadCRTC(dev, head, NV_PCRTC_830);
|
|
|
regp->crtc_834 = NVReadCRTC(dev, head, NV_PCRTC_834);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_30)
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_RANKINE)
|
|
|
regp->gpio_ext = NVReadCRTC(dev, head, NV_PCRTC_GPIO_EXT);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type == NV_40)
|
|
|
+ if (drm->device.info.family == NV_DEVICE_INFO_V0_CURIE)
|
|
|
regp->crtc_850 = NVReadCRTC(dev, head, NV_PCRTC_850);
|
|
|
|
|
|
if (nv_two_heads(dev))
|
|
@@ -634,7 +634,7 @@ nv_save_state_ext(struct drm_device *dev, int head,
|
|
|
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_SCRATCH3__INDEX);
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_SCRATCH4__INDEX);
|
|
|
- if (nv_device(drm->device)->card_type >= NV_10) {
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_CELSIUS) {
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_EBR_INDEX);
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_CSB);
|
|
|
rd_cio_state(dev, head, regp, NV_CIO_CRE_4B);
|
|
@@ -663,14 +663,14 @@ nv_load_state_ext(struct drm_device *dev, int head,
|
|
|
struct nv04_mode_state *state)
|
|
|
{
|
|
|
struct nouveau_drm *drm = nouveau_drm(dev);
|
|
|
- struct nouveau_object *device = drm->device;
|
|
|
- struct nouveau_timer *ptimer = nouveau_timer(device);
|
|
|
- struct nouveau_fb *pfb = nouveau_fb(device);
|
|
|
+ struct nvif_device *device = &drm->device;
|
|
|
+ struct nouveau_timer *ptimer = nvkm_timer(device);
|
|
|
+ struct nouveau_fb *pfb = nvkm_fb(device);
|
|
|
struct nv04_crtc_reg *regp = &state->crtc_reg[head];
|
|
|
uint32_t reg900;
|
|
|
int i;
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_10) {
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_CELSIUS) {
|
|
|
if (nv_two_heads(dev))
|
|
|
/* setting ENGINE_CTRL (EC) *must* come before
|
|
|
* CIO_CRE_LCD, as writing CRE_LCD sets bits 16 & 17 in
|
|
@@ -692,10 +692,10 @@ nv_load_state_ext(struct drm_device *dev, int head,
|
|
|
NVWriteCRTC(dev, head, NV_PCRTC_830, regp->crtc_830);
|
|
|
NVWriteCRTC(dev, head, NV_PCRTC_834, regp->crtc_834);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_30)
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_RANKINE)
|
|
|
NVWriteCRTC(dev, head, NV_PCRTC_GPIO_EXT, regp->gpio_ext);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type == NV_40) {
|
|
|
+ if (drm->device.info.family == NV_DEVICE_INFO_V0_CURIE) {
|
|
|
NVWriteCRTC(dev, head, NV_PCRTC_850, regp->crtc_850);
|
|
|
|
|
|
reg900 = NVReadRAMDAC(dev, head, NV_PRAMDAC_900);
|
|
@@ -718,23 +718,23 @@ nv_load_state_ext(struct drm_device *dev, int head,
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_FF_INDEX);
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_20)
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_KELVIN)
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_47);
|
|
|
|
|
|
- if (nv_device(drm->device)->card_type >= NV_30)
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_RANKINE)
|
|
|
wr_cio_state(dev, head, regp, 0x9f);
|
|
|
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_49);
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX);
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR1_INDEX);
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR2_INDEX);
|
|
|
- if (nv_device(drm->device)->card_type == NV_40)
|
|
|
+ if (drm->device.info.family == NV_DEVICE_INFO_V0_CURIE)
|
|
|
nv_fix_nv40_hw_cursor(dev, head);
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_ILACE__INDEX);
|
|
|
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_SCRATCH3__INDEX);
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_SCRATCH4__INDEX);
|
|
|
- if (nv_device(drm->device)->card_type >= NV_10) {
|
|
|
+ if (drm->device.info.family >= NV_DEVICE_INFO_V0_CELSIUS) {
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_EBR_INDEX);
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_CSB);
|
|
|
wr_cio_state(dev, head, regp, NV_CIO_CRE_4B);
|
|
@@ -742,7 +742,7 @@ nv_load_state_ext(struct drm_device *dev, int head,
|
|
|
}
|
|
|
/* NV11 and NV20 stop at 0x52. */
|
|
|
if (nv_gf4_disp_arch(dev)) {
|
|
|
- if (nv_device(drm->device)->card_type < NV_20) {
|
|
|
+ if (drm->device.info.family < NV_DEVICE_INFO_V0_KELVIN) {
|
|
|
/* Not waiting for vertical retrace before modifying
|
|
|
CRE_53/CRE_54 causes lockups. */
|
|
|
nouveau_timer_wait_eq(ptimer, 650000000, NV_PRMCIO_INP0__COLOR, 0x8, 0x8);
|
|
@@ -769,7 +769,7 @@ static void
|
|
|
nv_save_state_palette(struct drm_device *dev, int head,
|
|
|
struct nv04_mode_state *state)
|
|
|
{
|
|
|
- struct nouveau_object *device = nouveau_drm(dev)->device;
|
|
|
+ struct nvif_device *device = &nouveau_drm(dev)->device;
|
|
|
int head_offset = head * NV_PRMDIO_SIZE, i;
|
|
|
|
|
|
nvif_wr08(device, NV_PRMDIO_PIXEL_MASK + head_offset,
|
|
@@ -788,7 +788,7 @@ void
|
|
|
nouveau_hw_load_state_palette(struct drm_device *dev, int head,
|
|
|
struct nv04_mode_state *state)
|
|
|
{
|
|
|
- struct nouveau_object *device = nouveau_drm(dev)->device;
|
|
|
+ struct nvif_device *device = &nouveau_drm(dev)->device;
|
|
|
int head_offset = head * NV_PRMDIO_SIZE, i;
|
|
|
|
|
|
nvif_wr08(device, NV_PRMDIO_PIXEL_MASK + head_offset,
|
|
@@ -808,7 +808,7 @@ void nouveau_hw_save_state(struct drm_device *dev, int head,
|
|
|
{
|
|
|
struct nouveau_drm *drm = nouveau_drm(dev);
|
|
|
|
|
|
- if (nv_device(drm->device)->chipset == 0x11)
|
|
|
+ if (drm->device.info.chipset == 0x11)
|
|
|
/* NB: no attempt is made to restore the bad pll later on */
|
|
|
nouveau_hw_fix_bad_vpll(dev, head);
|
|
|
nv_save_state_ramdac(dev, head, state);
|