From d7dcafe79a4aaef028e1391cdb840fe16bded3fe Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Tue, 11 Apr 2006 08:54:40 +0000 Subject: [PATCH] updated AGP setup to first make sure the card is running in PCI mode, if a coldstart attempt is done. Some cards outthere reset their PLL AGP during coldstart script execution, which makes the acc engine DMA transfers fail until the next reboot if AGP mode was running at that moment. This fixes coldstart trouble on the GeForce4MX4000 over here if AGP mode is used. Still testing (not yet 100% OK yet..) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17068 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/nvidia/engine/nv_agp.c | 11 +++++++---- src/add-ons/accelerants/nvidia/engine/nv_general.c | 13 +++++++++++-- src/add-ons/accelerants/nvidia/engine/nv_proto.h | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/add-ons/accelerants/nvidia/engine/nv_agp.c b/src/add-ons/accelerants/nvidia/engine/nv_agp.c index 0cdedb26e9..e62831d684 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_agp.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_agp.c @@ -1,5 +1,5 @@ /* Author: - Rudolf Cornelissen 6/2004-5/2005 + Rudolf Cornelissen 6/2004-4/2006 */ #define MODULE_BIT 0x00000100 @@ -10,7 +10,7 @@ static void nv_agp_list_info(agp_info ai); static void nv_agp_list_active(uint32 cmd); -status_t nv_agp_setup(void) +status_t nv_agp_setup(bool enable_agp) { nv_nth_agp_info nai; nv_cmd_agp nca; @@ -105,10 +105,13 @@ status_t nv_agp_setup(void) return B_ERROR; } - if (si->settings.force_pci) + if (si->settings.force_pci || !enable_agp) { /* set PCI mode if specified by user in nv.settings */ - LOG(4,("AGP: forcing PCI mode (specified in nv.settings)\n")); + if (enable_agp) + LOG(4,("AGP: forcing PCI mode (specified in nv.settings)\n")); + else + LOG(4,("AGP: forcing PCI mode during coldstart (required)\n")); /* let the AGP busmanager setup PCI mode. * (the AGP speed scheme is of no consequence now) */ diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c index fe76b4cf16..66d398dd0e 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_general.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c @@ -91,7 +91,7 @@ status_t nv_general_powerup() { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.79 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.80 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned) @@ -1392,6 +1392,15 @@ static status_t nvxx_general_powerup() * at system power-up POST time. */ if (!si->settings.usebios) { + /* Make sure we are running in PCI (not AGP) mode: + * This is a requirement for safely coldstarting cards! + * (some cards reset their AGP PLL during startup which makes acceleration + * engine DMA fail later on. A reboot is needed to overcome that.) + * Note: + * This may only be done when no transfers are in progress on the bus, so now + * is probably a good time.. */ + nv_agp_setup(false); + LOG(2, ("INIT: Attempting card coldstart!\n")); /* update the cardspecs in the shared_info PINS struct according to reported * specs as much as is possible; @@ -1681,7 +1690,7 @@ static status_t nv_general_bios_to_powergraphics() * Note: * This may only be done when no transfers are in progress on the bus, so now * is probably a good time.. */ - nv_agp_setup(); + nv_agp_setup(true); return B_OK; } diff --git a/src/add-ons/accelerants/nvidia/engine/nv_proto.h b/src/add-ons/accelerants/nvidia/engine/nv_proto.h index 091ccf0075..42dc7a9d9e 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_proto.h +++ b/src/add-ons/accelerants/nvidia/engine/nv_proto.h @@ -8,7 +8,7 @@ status_t nv_general_head_select(bool); status_t nv_general_validate_pic_size (display_mode *target, uint32 *bytes_per_row, bool *acc_mode); /* AGP functions */ -status_t nv_agp_setup(void); +status_t nv_agp_setup(bool enable_agp); /* apsed: logging macros */ #define MSG(args) do { /* if needed or si->settings with si NULL */ \