From 51842d6e913fc908ec98440187dee75fd65e353a Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Mon, 27 Sep 2004 14:36:30 +0000 Subject: [PATCH] restructured startup code, tested NV34 coldstart as secondary card: we have a go!. Analog monitors only, rest is working nicely. 8-). The script exec code is not yet finished, so I cannot promiss (yet) every card actually starts up. WoeHoe! git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9074 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/nvidia/engine/nv_general.c | 23 ++++++--- .../accelerants/nvidia/engine/nv_info.c | 49 ++++++++++++++----- .../accelerants/nvidia/engine/nv_proto.h | 3 +- 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c index 59214033fd..2dd65b17ac 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_general.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c @@ -80,7 +80,7 @@ status_t nv_general_powerup() { status_t status; - LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.27 running.\n")); + LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.28 running.\n")); /* preset no laptop */ si->ps.laptop = false; @@ -899,9 +899,13 @@ static status_t nvxx_general_powerup() { LOG(4, ("INIT: NV powerup\n")); - /* fill-in the cardspecs in the shared_info PINS struct */ - fake_pins(); - /* only process BIOS for specs and coldstart if requested by user; + /* setup cardspecs */ + /* note: + * this MUST be done before the driver attempts a card coldstart */ + set_specs(); + + /* only process BIOS for finetuning specs and coldstarting card if requested + * by the user; * note: * this in fact frees the driver from relying on the BIOS to be executed * at system power-up POST time. */ @@ -918,13 +922,16 @@ static status_t nvxx_general_powerup() LOG(2, ("INIT: Skipping card coldstart!\n")); } + /* get RAM size and fake panel startup (panel init code is still missing) */ + fake_panel_start(); + + /* log the final card specifications */ + dump_pins(); + /* dump config space as it is after a possible coldstart attempt */ if (si->settings.logmask & 0x80000000) nv_dump_configuration_space(); - /* log the final PINS struct settings */ - dump_pins(); - - /* setup CRTC and DAC functions access: determined in fake_pins */ + /* setup CRTC and DAC functions access: determined in fake_panel_start */ setup_virtualized_heads(si->ps.crtc2_prim); /* do powerup needed from pre-inited card state as done by system POST cardBIOS diff --git a/src/add-ons/accelerants/nvidia/engine/nv_info.c b/src/add-ons/accelerants/nvidia/engine/nv_info.c index 41e0a68624..356eb6d370 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_info.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_info.c @@ -27,7 +27,9 @@ static void pinsnv6_fake(void); static void pinsnv10_arch_fake(void); static void pinsnv20_arch_fake(void); static void pinsnv30_arch_fake(void); +static void getRAMsize_arch_nv4(void); static void getstrap_arch_nv4(void); +static void getRAMsize_arch_nv10_20_30_40(void); static void getstrap_arch_nv10_20_30_40(void); static status_t pins2_read(uint8 *rom, uint32 offset); static status_t pins3_5_read(uint8 *rom, uint32 offset); @@ -188,7 +190,6 @@ static status_t pins3_5_read(uint8 *rom, uint32 offset) //si->ps.max_video_vco = fvco_max / 1000; } - //fixme: extract RAM and core speeds from startscripts.. //fixme: add 'parsing scripts while not actually executing' as warmstart method, // instead of not parsing at all: this will update the driver's speeds // as below, while logging the scripts as well (for our learning pleasure :) @@ -224,7 +225,7 @@ static status_t coldstart_card(uint8* rom, uint16 init1, uint16 init2, uint16 in status_t result = B_OK; int16 size = init_size; - LOG(8,("INFO: executing coldstart...\n")); + LOG(8,("INFO: now executing coldstart...\n")); /* select colormode CRTC registers base adresses */ NV_REG8(NV8_MISCW) = 0xcb; @@ -292,7 +293,7 @@ static status_t coldstart_card_516_up(uint8* rom, PinsTables tabs, uint16 ram_ta status_t result = B_OK; uint16 adress; - LOG(8,("INFO: executing coldstart...\n")); + LOG(8,("INFO: now executing coldstart...\n")); /* select colormode CRTC registers base adresses */ NV_REG8(NV8_MISCW) = 0xcb; @@ -1683,10 +1684,10 @@ static status_t nv_crtc_setup_fifo() return B_OK; } -/* fake_pins presumes the card was coldstarted by it's BIOS */ -void fake_pins(void) +/* (pre)set 'fixed' card specifications */ +void set_specs(void) { - LOG(8,("INFO: faking PINS\n")); + LOG(8,("INFO: setting up card specifications\n")); /* set failsave speeds */ switch (si->ps.card_type) @@ -1722,7 +1723,7 @@ void fake_pins(void) break; } - /* detect RAM amount, reference crystal frequency and dualhead */ + /* detect reference crystal frequency and dualhead */ switch (si->ps.card_arch) { case NV04A: @@ -1732,6 +1733,23 @@ void fake_pins(void) getstrap_arch_nv10_20_30_40(); break; } +} + +/* this routine presumes the card was coldstarted by the card's BIOS for panel stuff */ +void fake_panel_start(void) +{ + LOG(8,("INFO: detecting RAM size\n")); + + /* detect RAM amount */ + switch (si->ps.card_arch) + { + case NV04A: + getRAMsize_arch_nv4(); + break; + default: + getRAMsize_arch_nv10_20_30_40(); + break; + } /* override memory detection if requested by user */ if (si->settings.memory != 0) @@ -1752,6 +1770,8 @@ void fake_pins(void) } */ + LOG(8,("INFO: faking panel startup\n")); + /* find out the BIOS preprogrammed panel use status... */ detect_panels(); @@ -2532,7 +2552,7 @@ static void pinsnv30_arch_fake(void) si->ps.std_memory_clock = 190; } -static void getstrap_arch_nv4(void) +static void getRAMsize_arch_nv4(void) { uint32 strapinfo = NV_REG32(NV32_NV4STRAPINFO); @@ -2563,8 +2583,11 @@ static void getstrap_arch_nv4(void) break; } } +} - strapinfo = NV_REG32(NV32_NVSTRAPINFO2); +static void getstrap_arch_nv4(void) +{ + uint32 strapinfo = NV_REG32(NV32_NVSTRAPINFO2); /* determine PLL reference crystal frequency */ if (strapinfo & 0x00000040) @@ -2576,7 +2599,7 @@ static void getstrap_arch_nv4(void) si->ps.secondary_head = false; } -static void getstrap_arch_nv10_20_30_40(void) +static void getRAMsize_arch_nv10_20_30_40(void) { uint32 dev_manID = CFGR(DEVID); uint32 strapinfo = NV_REG32(NV32_NV10STRAPINFO); @@ -2626,8 +2649,12 @@ static void getstrap_arch_nv10_20_30_40(void) break; } } +} - strapinfo = NV_REG32(NV32_NVSTRAPINFO2); +static void getstrap_arch_nv10_20_30_40(void) +{ + uint32 dev_manID = CFGR(DEVID); + uint32 strapinfo = NV_REG32(NV32_NVSTRAPINFO2); /* determine PLL reference crystal frequency: three types are used... */ if (strapinfo & 0x00000040) diff --git a/src/add-ons/accelerants/nvidia/engine/nv_proto.h b/src/add-ons/accelerants/nvidia/engine/nv_proto.h index d3aba9d6ce..2ef36fc3be 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_proto.h +++ b/src/add-ons/accelerants/nvidia/engine/nv_proto.h @@ -34,7 +34,8 @@ status_t i2c_maven_probe(void); /* card info functions */ status_t parse_pins(void); void get_panel_modes(display_mode *p1, display_mode *p2, bool *pan1, bool *pan2); -void fake_pins(void); +void fake_panel_start(void); +void set_specs(void); void dump_pins(void); /* DAC functions */