summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/core/subdev/bios/init.c')
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/init.c56
1 files changed, 35 insertions, 21 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
index 9c41b58d57e2..c300b5e7b670 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
@@ -64,27 +64,33 @@ init_exec_force(struct nvbios_init *init, bool exec)
64static inline int 64static inline int
65init_or(struct nvbios_init *init) 65init_or(struct nvbios_init *init)
66{ 66{
67 if (init->outp) 67 if (init_exec(init)) {
68 return ffs(init->outp->or) - 1; 68 if (init->outp)
69 error("script needs OR!!\n"); 69 return ffs(init->outp->or) - 1;
70 error("script needs OR!!\n");
71 }
70 return 0; 72 return 0;
71} 73}
72 74
73static inline int 75static inline int
74init_link(struct nvbios_init *init) 76init_link(struct nvbios_init *init)
75{ 77{
76 if (init->outp) 78 if (init_exec(init)) {
77 return !(init->outp->sorconf.link & 1); 79 if (init->outp)
78 error("script needs OR link\n"); 80 return !(init->outp->sorconf.link & 1);
81 error("script needs OR link\n");
82 }
79 return 0; 83 return 0;
80} 84}
81 85
82static inline int 86static inline int
83init_crtc(struct nvbios_init *init) 87init_crtc(struct nvbios_init *init)
84{ 88{
85 if (init->crtc >= 0) 89 if (init_exec(init)) {
86 return init->crtc; 90 if (init->crtc >= 0)
87 error("script needs crtc\n"); 91 return init->crtc;
92 error("script needs crtc\n");
93 }
88 return 0; 94 return 0;
89} 95}
90 96
@@ -92,16 +98,21 @@ static u8
92init_conn(struct nvbios_init *init) 98init_conn(struct nvbios_init *init)
93{ 99{
94 struct nouveau_bios *bios = init->bios; 100 struct nouveau_bios *bios = init->bios;
101 u8 ver, len;
102 u16 conn;
95 103
96 if (init->outp) { 104 if (init_exec(init)) {
97 u8 ver, len; 105 if (init->outp) {
98 u16 conn = dcb_conn(bios, init->outp->connector, &ver, &len); 106 conn = init->outp->connector;
99 if (conn) 107 conn = dcb_conn(bios, conn, &ver, &len);
100 return nv_ro08(bios, conn); 108 if (conn)
109 return nv_ro08(bios, conn);
110 }
111
112 error("script needs connector type\n");
101 } 113 }
102 114
103 error("script needs connector type\n"); 115 return 0xff;
104 return 0x00;
105} 116}
106 117
107static inline u32 118static inline u32
@@ -227,7 +238,8 @@ init_i2c(struct nvbios_init *init, int index)
227 } else 238 } else
228 if (index < 0) { 239 if (index < 0) {
229 if (!init->outp) { 240 if (!init->outp) {
230 error("script needs output for i2c\n"); 241 if (init_exec(init))
242 error("script needs output for i2c\n");
231 return NULL; 243 return NULL;
232 } 244 }
233 245
@@ -544,7 +556,8 @@ init_tmds_reg(struct nvbios_init *init, u8 tmds)
544 return 0x6808b0 + dacoffset; 556 return 0x6808b0 + dacoffset;
545 } 557 }
546 558
547 error("tmds opcodes need dcb\n"); 559 if (init_exec(init))
560 error("tmds opcodes need dcb\n");
548 } else { 561 } else {
549 if (tmds < ARRAY_SIZE(pramdac_table)) 562 if (tmds < ARRAY_SIZE(pramdac_table))
550 return pramdac_table[tmds]; 563 return pramdac_table[tmds];
@@ -792,7 +805,8 @@ init_dp_condition(struct nvbios_init *init)
792 break; 805 break;
793 } 806 }
794 807
795 warn("script needs dp output table data\n"); 808 if (init_exec(init))
809 warn("script needs dp output table data\n");
796 break; 810 break;
797 case 5: 811 case 5:
798 if (!(init_rdauxr(init, 0x0d) & 1)) 812 if (!(init_rdauxr(init, 0x0d) & 1))
@@ -816,7 +830,7 @@ init_io_mask_or(struct nvbios_init *init)
816 u8 or = init_or(init); 830 u8 or = init_or(init);
817 u8 data; 831 u8 data;
818 832
819 trace("IO_MASK_OR\t0x03d4[0x%02x] &= ~(1 << 0x%02x)", index, or); 833 trace("IO_MASK_OR\t0x03d4[0x%02x] &= ~(1 << 0x%02x)\n", index, or);
820 init->offset += 2; 834 init->offset += 2;
821 835
822 data = init_rdvgai(init, 0x03d4, index); 836 data = init_rdvgai(init, 0x03d4, index);
@@ -835,7 +849,7 @@ init_io_or(struct nvbios_init *init)
835 u8 or = init_or(init); 849 u8 or = init_or(init);
836 u8 data; 850 u8 data;
837 851
838 trace("IO_OR\t0x03d4[0x%02x] |= (1 << 0x%02x)", index, or); 852 trace("IO_OR\t0x03d4[0x%02x] |= (1 << 0x%02x)\n", index, or);
839 init->offset += 2; 853 init->offset += 2;
840 854
841 data = init_rdvgai(init, 0x03d4, index); 855 data = init_rdvgai(init, 0x03d4, index);