xref: /haiku/src/add-ons/accelerants/neomagic/engine/nm_info.c (revision 3794f85ae65d152486c18ee79f4aabeafb2cca97)
177680cefSshatty /* setup initialisation information for card */
277680cefSshatty /* Authors:
3*3794f85aSRudolf Cornelissen    Rudolf Cornelissen 4/2003-6/2004
477680cefSshatty */
577680cefSshatty 
677680cefSshatty #define MODULE_BIT 0x00002000
777680cefSshatty 
877680cefSshatty #include "nm_std.h"
977680cefSshatty 
set_nm2070(void)104afe6a6bSshatty static void set_nm2070(void)
1177680cefSshatty {
1277680cefSshatty 	/* setup cardspecs */
1377680cefSshatty 	si->ps.f_ref = 14.31818;
1477680cefSshatty 	si->ps.max_system_vco = 65;
1577680cefSshatty 	si->ps.min_system_vco = 11;
1677680cefSshatty 	si->ps.max_pixel_vco = 65;
1777680cefSshatty 	si->ps.min_pixel_vco = 11;
1877680cefSshatty 	si->ps.max_dac1_clock = 65;
1977680cefSshatty 	si->ps.max_dac1_clock_8 = 65;
2077680cefSshatty 	si->ps.max_dac1_clock_16 = 65;
2177680cefSshatty 	/* 24bit color is not supported */
2277680cefSshatty 	si->ps.max_dac1_clock_24 = 0;
2377680cefSshatty 	si->ps.memory_size = 896;
2477680cefSshatty 	si->ps.curmem_size = 2048;
2577680cefSshatty 	si->ps.max_crtc_width = 1024;
2686e8ff4dSRudolf Cornelissen 	si->ps.max_crtc_height = 1000;
2777680cefSshatty 	si->ps.std_engine_clock = 0;
2877680cefSshatty }
2977680cefSshatty 
set_nm2090_nm2093(void)304afe6a6bSshatty static void set_nm2090_nm2093(void)
3177680cefSshatty {
3277680cefSshatty 	/* setup cardspecs */
3377680cefSshatty 	si->ps.f_ref = 14.31818;
3477680cefSshatty 	si->ps.max_system_vco = 80;
3577680cefSshatty 	si->ps.min_system_vco = 11;
3677680cefSshatty 	si->ps.max_pixel_vco = 80;
3777680cefSshatty 	si->ps.min_pixel_vco = 11;
3877680cefSshatty 	si->ps.max_dac1_clock = 80;
3977680cefSshatty 	si->ps.max_dac1_clock_8 = 80;
4077680cefSshatty 	si->ps.max_dac1_clock_16 = 80;
4177680cefSshatty 	si->ps.max_dac1_clock_24 = 65;
4277680cefSshatty 	si->ps.memory_size = 1152;
4377680cefSshatty 	si->ps.curmem_size = 2048;
4477680cefSshatty 	si->ps.max_crtc_width = 1024;
4586e8ff4dSRudolf Cornelissen 	si->ps.max_crtc_height = 1000;
4677680cefSshatty 	si->ps.std_engine_clock = 0;
4777680cefSshatty }
4877680cefSshatty 
set_nm2097(void)494afe6a6bSshatty static void set_nm2097(void)
5077680cefSshatty {
5177680cefSshatty 	/* setup cardspecs */
5277680cefSshatty 	si->ps.f_ref = 14.31818;
5377680cefSshatty 	si->ps.max_system_vco = 80;
5477680cefSshatty 	si->ps.min_system_vco = 11;
5577680cefSshatty 	si->ps.max_pixel_vco = 80;
5677680cefSshatty 	si->ps.min_pixel_vco = 11;
5777680cefSshatty 	si->ps.max_dac1_clock = 80;
5877680cefSshatty 	si->ps.max_dac1_clock_8 = 80;
5977680cefSshatty 	si->ps.max_dac1_clock_16 = 80;
6077680cefSshatty 	si->ps.max_dac1_clock_24 = 65;
6177680cefSshatty 	si->ps.memory_size = 1152;
6277680cefSshatty 	si->ps.curmem_size = 1024;
6377680cefSshatty 	si->ps.max_crtc_width = 1024;
6486e8ff4dSRudolf Cornelissen 	si->ps.max_crtc_height = 1000;
6577680cefSshatty 	si->ps.std_engine_clock = 0;
6677680cefSshatty }
6777680cefSshatty 
set_nm2160(void)684afe6a6bSshatty static void set_nm2160(void)
6977680cefSshatty {
7077680cefSshatty 	/* setup cardspecs */
7177680cefSshatty 	si->ps.f_ref = 14.31818;
7277680cefSshatty 	si->ps.max_system_vco = 90;
7377680cefSshatty 	si->ps.min_system_vco = 11;
7477680cefSshatty 	si->ps.max_pixel_vco = 90;
7577680cefSshatty 	si->ps.min_pixel_vco = 11;
7677680cefSshatty 	si->ps.max_dac1_clock = 90;
7777680cefSshatty 	si->ps.max_dac1_clock_8 = 90;
7877680cefSshatty 	si->ps.max_dac1_clock_16 = 90;
7977680cefSshatty 	si->ps.max_dac1_clock_24 = 70;
8077680cefSshatty 	si->ps.memory_size = 2048;
8177680cefSshatty 	si->ps.curmem_size = 1024;
8277680cefSshatty 	si->ps.max_crtc_width = 1024;
8386e8ff4dSRudolf Cornelissen 	si->ps.max_crtc_height = 1000;
8477680cefSshatty 	si->ps.std_engine_clock = 0;
8577680cefSshatty }
8677680cefSshatty 
set_nm2200(void)874afe6a6bSshatty static void set_nm2200(void)
8877680cefSshatty {
8977680cefSshatty 	/* setup cardspecs */
9077680cefSshatty 	si->ps.f_ref = 14.31818;
9177680cefSshatty 	si->ps.max_system_vco = 110;
9277680cefSshatty 	si->ps.min_system_vco = 11;
9377680cefSshatty 	si->ps.max_pixel_vco = 110;
9477680cefSshatty 	si->ps.min_pixel_vco = 11;
9577680cefSshatty 	si->ps.max_dac1_clock = 110;
9677680cefSshatty 	si->ps.max_dac1_clock_8 = 110;
9777680cefSshatty 	si->ps.max_dac1_clock_16 = 110;
9877680cefSshatty 	si->ps.max_dac1_clock_24 = 90;
9977680cefSshatty 	si->ps.memory_size = 2560;
10077680cefSshatty 	si->ps.curmem_size = 1024;
10177680cefSshatty 	si->ps.max_crtc_width = 1280;
10277680cefSshatty 	si->ps.max_crtc_height = 1024;
10377680cefSshatty 	si->ps.std_engine_clock = 0;
10477680cefSshatty }
10577680cefSshatty 
set_nm2230(void)1064afe6a6bSshatty static void set_nm2230(void)
10777680cefSshatty {
10877680cefSshatty 	/* setup cardspecs */
10977680cefSshatty 	si->ps.f_ref = 14.31818;
11077680cefSshatty 	si->ps.max_system_vco = 110;
11177680cefSshatty 	si->ps.min_system_vco = 11;
11277680cefSshatty 	si->ps.max_pixel_vco = 110;
11377680cefSshatty 	si->ps.min_pixel_vco = 11;
11477680cefSshatty 	si->ps.max_dac1_clock = 110;
11577680cefSshatty 	si->ps.max_dac1_clock_8 = 110;
11677680cefSshatty 	si->ps.max_dac1_clock_16 = 110;
11777680cefSshatty 	si->ps.max_dac1_clock_24 = 90;
11877680cefSshatty 	si->ps.memory_size = 3008;
11977680cefSshatty 	si->ps.curmem_size = 1024;
12077680cefSshatty 	si->ps.max_crtc_width = 1280;
12177680cefSshatty 	si->ps.max_crtc_height = 1024;
12277680cefSshatty 	si->ps.std_engine_clock = 0;
12377680cefSshatty }
12477680cefSshatty 
set_nm2360(void)1254afe6a6bSshatty static void set_nm2360(void)
12677680cefSshatty {
12777680cefSshatty 	/* setup cardspecs */
12877680cefSshatty 	si->ps.f_ref = 14.31818;
12977680cefSshatty 	si->ps.max_system_vco = 110;
13077680cefSshatty 	si->ps.min_system_vco = 11;
13177680cefSshatty 	si->ps.max_pixel_vco = 110;
13277680cefSshatty 	si->ps.min_pixel_vco = 11;
13377680cefSshatty 	si->ps.max_dac1_clock = 110;
13477680cefSshatty 	si->ps.max_dac1_clock_8 = 110;
13577680cefSshatty 	si->ps.max_dac1_clock_16 = 110;
13677680cefSshatty 	si->ps.max_dac1_clock_24 = 90;
13777680cefSshatty 	si->ps.memory_size = 4096;
13877680cefSshatty 	si->ps.curmem_size = 1024;
13977680cefSshatty 	si->ps.max_crtc_width = 1280;
14077680cefSshatty 	si->ps.max_crtc_height = 1024;
14177680cefSshatty 	si->ps.std_engine_clock = 0;
14277680cefSshatty }
14377680cefSshatty 
set_nm2380(void)1444afe6a6bSshatty static void set_nm2380(void)
14577680cefSshatty {
14677680cefSshatty 	/* setup cardspecs */
14777680cefSshatty 	si->ps.f_ref = 14.31818;
14877680cefSshatty 	si->ps.max_system_vco = 110;
14977680cefSshatty 	si->ps.min_system_vco = 11;
15077680cefSshatty 	si->ps.max_pixel_vco = 110;
15177680cefSshatty 	si->ps.min_pixel_vco = 11;
15277680cefSshatty 	si->ps.max_dac1_clock = 110;
15377680cefSshatty 	si->ps.max_dac1_clock_8 = 110;
15477680cefSshatty 	si->ps.max_dac1_clock_16 = 110;
15577680cefSshatty 	si->ps.max_dac1_clock_24 = 90;
15677680cefSshatty 	si->ps.memory_size = 6144;
15777680cefSshatty 	si->ps.curmem_size = 1024;
15877680cefSshatty 	si->ps.max_crtc_width = 1280;
15977680cefSshatty 	si->ps.max_crtc_height = 1024;
16077680cefSshatty 	si->ps.std_engine_clock = 0;
16177680cefSshatty }
16277680cefSshatty 
set_specs(void)16377680cefSshatty void set_specs(void)
16477680cefSshatty {
16577680cefSshatty 	uint8 size_outputs, type;
16677680cefSshatty 
16777680cefSshatty 	LOG(8,("INFO: setting cardspecs\n"));
16877680cefSshatty 
16977680cefSshatty 	switch (si->ps.card_type)
17077680cefSshatty 	{
17177680cefSshatty 		case NM2070:
17277680cefSshatty 			set_nm2070();
17377680cefSshatty 			break;
17477680cefSshatty 		case NM2090:
17577680cefSshatty 		case NM2093:
17677680cefSshatty 			set_nm2090_nm2093();
17777680cefSshatty 			break;
17877680cefSshatty 		case NM2097:
17977680cefSshatty 			set_nm2097();
18077680cefSshatty 			break;
18177680cefSshatty 		case NM2160:
18277680cefSshatty 			set_nm2160();
18377680cefSshatty 			break;
18477680cefSshatty 		case NM2200:
18577680cefSshatty 			set_nm2200();
18677680cefSshatty 			break;
18777680cefSshatty 		case NM2230:
18877680cefSshatty 			set_nm2230();
18977680cefSshatty 			break;
19077680cefSshatty 		case NM2360:
19177680cefSshatty 			set_nm2360();
19277680cefSshatty 			break;
19377680cefSshatty 		case NM2380:
19477680cefSshatty 			set_nm2380();
19577680cefSshatty 			break;
19677680cefSshatty 	}
19777680cefSshatty 
19877680cefSshatty 	/* get output properties: */
19977680cefSshatty     /* read panelsize and preselected outputs (via BIOS) */
20077680cefSshatty     size_outputs = ISAGRPHR(PANELCTRL1);
20177680cefSshatty     /* read the panel type */
20277680cefSshatty     type = ISAGRPHR(PANELTYPE);
20377680cefSshatty 
20477680cefSshatty     /* setup panelspecs */
20577680cefSshatty     switch ((size_outputs & 0x18) >> 3)
20677680cefSshatty     {
20777680cefSshatty     case 0x00 :
20877680cefSshatty 		si->ps.panel_width = 640;
20977680cefSshatty 		si->ps.panel_height = 480;
21077680cefSshatty 		break;
21177680cefSshatty     case 0x01 :
21277680cefSshatty 		si->ps.panel_width = 800;
21377680cefSshatty 		si->ps.panel_height = 600;
21477680cefSshatty 		break;
21577680cefSshatty     case 0x02 :
21677680cefSshatty 		si->ps.panel_width = 1024;
21777680cefSshatty 		si->ps.panel_height = 768;
21877680cefSshatty 		break;
21977680cefSshatty     case 0x03 :
22077680cefSshatty         /* fixme: 1280x1024 panel support still needs to be done */
22177680cefSshatty 		si->ps.panel_width = 1280;
22277680cefSshatty 		si->ps.panel_height = 1024;
22377680cefSshatty 	}
22477680cefSshatty 	/* make note of paneltype */
22577680cefSshatty 	si->ps.panel_type = (type & 0x12);
22677680cefSshatty 	/* make note of preselected outputs (via BIOS) */
22777680cefSshatty 	si->ps.outputs = (size_outputs & 0x03);
22877680cefSshatty 	/* check for illegal setting */
22977680cefSshatty 	if (si->ps.outputs == 0)
23077680cefSshatty 	{
231*3794f85aSRudolf Cornelissen 		LOG(4, ("INFO: illegal outputmode detected, assuming internal mode!\n"));
23277680cefSshatty 		si->ps.outputs = 2;
23377680cefSshatty 	}
23477680cefSshatty }
23577680cefSshatty 
dump_specs(void)23677680cefSshatty void dump_specs(void)
23777680cefSshatty {
23877680cefSshatty 	LOG(2,("INFO: cardspecs and settings follow:\n"));
23977680cefSshatty 	LOG(2,("f_ref: %fMhz\n", si->ps.f_ref));
24077680cefSshatty 	LOG(2,("max_system_vco: %dMhz\n", si->ps.max_system_vco));
24177680cefSshatty 	LOG(2,("min_system_vco: %dMhz\n", si->ps.min_system_vco));
24277680cefSshatty 	LOG(2,("max_pixel_vco: %dMhz\n", si->ps.max_pixel_vco));
24377680cefSshatty 	LOG(2,("min_pixel_vco: %dMhz\n", si->ps.min_pixel_vco));
24477680cefSshatty 	LOG(2,("std_engine_clock: %dMhz\n", si->ps.std_engine_clock));
24577680cefSshatty 	LOG(2,("max_dac1_clock: %dMhz\n", si->ps.max_dac1_clock));
24677680cefSshatty 	LOG(2,("max_dac1_clock_8: %dMhz\n", si->ps.max_dac1_clock_8));
24777680cefSshatty 	LOG(2,("max_dac1_clock_16: %dMhz\n", si->ps.max_dac1_clock_16));
24877680cefSshatty 	LOG(2,("max_dac1_clock_24: %dMhz\n", si->ps.max_dac1_clock_24));
24977680cefSshatty 	LOG(2,("card memory_size: %dKbytes\n", si->ps.memory_size));
25077680cefSshatty 	LOG(2,("card curmem_size: %dbytes\n", si->ps.curmem_size));
25177680cefSshatty 	LOG(2,("card max_crtc_width: %d\n", si->ps.max_crtc_width));
25277680cefSshatty 	LOG(2,("card max_crtc_height: %d\n", si->ps.max_crtc_height));
25377680cefSshatty 	switch (si->ps.panel_type)
25477680cefSshatty 	{
25577680cefSshatty 	case 0x00:
25677680cefSshatty 		LOG(2, ("B/W dualscan LCD panel detected\n"));
25777680cefSshatty 		break;
25877680cefSshatty 	case 0x02:
25977680cefSshatty 		LOG(2, ("color dualscan LCD panel detected\n"));
26077680cefSshatty 		break;
26177680cefSshatty 	case 0x10:
26277680cefSshatty 		LOG(2, ("B/W TFT LCD panel detected\n"));
26377680cefSshatty 		break;
26477680cefSshatty 	case 0x12:
26577680cefSshatty 		LOG(2, ("color TFT LCD panel detected\n"));
26677680cefSshatty 		break;
26777680cefSshatty 	}
26877680cefSshatty 	LOG(2,("internal panel width: %d\n", si->ps.panel_width));
26977680cefSshatty 	LOG(2,("internal panel height: %d\n", si->ps.panel_height));
27077680cefSshatty 	switch (si->ps.outputs)
27177680cefSshatty 	{
27277680cefSshatty 	case 0x01:
27377680cefSshatty 		LOG(2, ("external CRT only mode preset\n"));
27477680cefSshatty 		break;
27577680cefSshatty 	case 0x02:
27677680cefSshatty 		LOG(2, ("internal LCD only mode preset\n"));
27777680cefSshatty 		break;
27877680cefSshatty 	case 0x03:
27977680cefSshatty 		LOG(2, ("simultaneous LCD/CRT mode preset\n"));
28077680cefSshatty 		break;
28177680cefSshatty 	}
28277680cefSshatty 	LOG(2,("INFO: end cardspecs and settings.\n"));
28377680cefSshatty }
284