tiuser
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Posts posted by tiuser
-
-
UPDATE 01.03.2013
updated UDMA_Fix.zip for better handling when going from sleep mode (I hope its finally fixed, sorry for being stupid before (: )
NOTE: sometimes if 2nd drive in caddy is in use running software workaround can potentially lead to complete freeze, so it's highly recommended to use MBR method instead.
I read about the delay at boot with newmodeus caddy, tried both master and slave jumpers without any luck.. (same ~ 18s delay at boot). I'm on HP Compaq 8710p. (bios version is F0.E patched with SLIC2.1 and unwhitelisted, F.0F has the fan issues)
OVERVIEW
To summ up everything here is how I've solved the problem:
I've used setpci to set appropriate registers
Check up Intel's ICH8 specs for further info in this file: ich8.pdf
My script is suitable for drive in MASTER mode, but can be adjusted for SLAVE as well (just check the pdf I've linked before.
Basically, you need to modify modify 0/31/1 device (IDE Controller)
54h register
48h register
4Ah
4Bh (if you use drive in slave mode).
setpci -s 0:1f.1 54.l=3033
setpci -s 0:1f.1 48.l=10001Otherwise Windows gonna reset drive to MDMA2 or MDMA0 everytime you set UDMA5 or UDMA6 for it without adjusting these registers.
SOFTWARE WORKAROUND
Grab UDMA_Fix.zip
Read README inside the package and install accordingly to it.
If you don't trust scripts bundled inside the .zip for some reason, you can download them yourself, you'd need
1. setpci for windows 32 or 64
2. hdparm for windows
3. devcon.exe
4. fix_udma_on_sdb_setpci.bat file:
@echo off
setlocal enableextensions
setlocal enabledelayedexpansion
REM path to the directory where all executables are
set PTH=c:\UDMA_Fix
REM your mode, depends on your drive udma5 for older drives, for newer udma6,
REM WARNING: make sure udma5 or udma6 written in the lowercase otherwise script might not work properly
set MODE=udma5
REM your drive, you can check with hdparm to make sure you're applying everything to the right drive
set DRIVE=/dev/sdb
REM Don't change ANYTHING BELOW
set reg54_value=3033
set reg48_value=10001
REM whether current OS is 64bit or 32bit, to use appropriate setpci version
if defined ProgramFiles(x86) (
set SETPCI=setpci.exe
) else (
set SETPCI=setpci_32.exe
)
:check
REM check for registers to make sure computer won't return from sleep mode
@%PTH%\%SETPCI% -d 8086:2850 48.l|find "%reg48_value%" >nul
set reg48=%errorlevel%
@%PTH%\%SETPCI% -d 8086:2850 54.l|find "%reg54_value%" >nul
set reg54=%errorlevel%
REM check current drive mode
@%PTH%\hdparm -i %DRIVE%|find "*%MODE%" >nul
set hdparm=%errorlevel%
REM we check if both registers were successfully set we change drive's mode to %MODE%
if %reg54%==0 (
if %reg48%==0 (
REM we check for current drive mode if it's already set we don't do anything
if not %hdparm%==0 (
REM set drive desired mode if it was not set already
goto :fix
REM set drive sleep mode
)
goto :sleep
)
)
REM otherwise we go to fix procedure again (happens sometimes)
goto :fix
:sleep
REM set standby mode to 90 minutes
REM 30 min - 241, 60min - 242, 90min - 243, check hdparm manual page for other values
REM @%PTH%\hdparm -S 243 %DRIVE%
goto :fin
rem we need to write two registers 48 & 54 in order to make drive working @ UDMA specified mode
rem because windows thinks drive connected via 40pin cable
:fix
@%PTH%\%SETPCI% -d 8086:2850 54.l=%reg54_value%
@%PTH%\%SETPCI% -d 8086:2850 40.b=5
@%PTH%\%SETPCI% -d 8086:2850 41.b=A3
@%PTH%\%SETPCI% -d 8086:2850 43.b=0
@%PTH%\%SETPCI% -d 8086:2850 48.b=1
@%PTH%\%SETPCI% -d 8086:2850 4A.b=1
@%PTH%\hdparm -X %MODE% %DRIVE%
devcon rescan
goto :check
:fin
setlocal disabledelayedexpansion
exit /b 05. all files should be inside the same directory and PTH variable should point to that directory
6. add a task to the windows scheduler with highest privileges, hidden on event logon.
MBR method
There is no need to use baredit at all, you can do everything with setpci, also there is no need to use devcon anymore as it slows down booting process and clears up registers for some reason sometimes.
Script should work for both Windows 32 and Windows 64. Please report if you encounter any problems.
EDIT: I've also succeed in MBR editing - the hack works just fine and windows recognizes drive in UDMA5 mode, even if you let computer into the sleep, so all you need is to patch MBR one time and don't need to run any scripts.
MBR instructions:
I managed to fix MBR for Windows 7 and you don't need to start anything after fix applied, you just boot that's it. And if computer returns from sleep 2nd HDD works fine in UDMA5.
Here is what my friend and I did with MBR (big thanks to my friend):
1) Basically you need to extract MBR first either with dd or HexEdit
MBR is the first 512 bytes from the start of the drive
with dd:
dd if=/dev/sdX of=mbr bs=512 count=1
2) The hack is simple - we are replacing strings from MBR (which are used to display errors) and add there our functions to write relevant data into 54h and 48h registers before windows starts in the MBR.
Basically you need to locate in original MBR
seg000:0017 push ax
seg000:0018 push 61Chreplace it with:
seg000:0017 jmp loc_163
find the line
seg000:0163 ; ---------------------------------------------------------------------------
seg000:0163 dec cxand replace with
seg000:0163 ; ---------------------------------------------------------------------------
seg000:0163
seg000:0163 loc_163: ; CODE XREF: seg000:0017j
seg000:0163 mov ax, 8000h
seg000:0166 shl eax, 10h
seg000:016A mov ax, 0F954h
seg000:016D mov dx, 0CF8h
seg000:0170 out dx, eax
seg000:0172 add dl, 4
seg000:0175 mov ax, 0
seg000:0178 shl eax, 10h
seg000:017C mov ax, 3033h
seg000:017F out dx, eax
seg000:0181 mov ax, 8000h
seg000:0184 shl eax, 10h
seg000:0188 mov ax, 0F948h
seg000:018B mov dx, 0CF8h
seg000:018E out dx, eax
seg000:0190 add dl, 4
seg000:0193 mov ax, 1
seg000:0196 shl eax, 10h
seg000:019A mov ax, 1
seg000:019D out dx, eax
seg000:019F xor ax, ax
seg000:01A1 push ax
seg000:01A2 push 61Ch
seg000:01A5 retf
seg000:01A6 ; ---------------------------------------------------------------------------My friend did it with HexWorkshop and Visual Studio + IDA.
He disassembled MBR, located where he can inject this code, compiled ASM code into Visual Studio and edited in HexWorkshop relevant parts of the MBR.
Here is first 422 bytes of MBR for Windows 7 x64 Ultimate (Partitions should be untouched if you apply this patch, but
I DO NOT GUARANTEE ANYTHING SO BETTER BACKUP YOUR MBR BEFORE PROCEEDING AND GET A LIVECD/USB RECOVERY:
3) What does this patch do?
It writes into 0/31/1 device register 54h 3033h which stands for 80pin cable / UDMA enabled for both master and slave devices connected to IDE Controller.
It writes into 0/31/1 device register 48h 10001h which stands for PCT values used for UDMA (without this Windows will reset drive back into UDMA2 - exactly the annoying error you described).
Please test this and report back if it worked for you.
- 5
-
nice one, you need to move ODD Caddy stuff here as well, maybe bring TTAV134 here for bios mods! I've tried contacting him few times without luck
-
Hi guys!
I'm the guy from NBR which helped Tech Inferno Fan with UDMA fix for PATA HP caddy.
It seems to be a tendency to ban good people for their contribution and their own opinion about everything.
Sad news about Tech Inferno Fan I've been enjoying reading his mod-stuff, seems to be a very tech-skilled guy.
Anyways, I have a little problem now which I need your help too guy, I'm gonna post further details in specific thread.
Peace & Respect.
- 5
DIY: Adding SSD or HDD storage using an optical bay caddy [ver 2.0]
in Desktop Storage
Posted
I've updated UDMA_Fix.zip script, should be working fine after returning from sleep mode, also added UDMA5.xml to easily import into the task scheduler.
Enjoy guys.
EDIT: there seems still some problem when running this script sometimes a complete hang could occur, I'm working on it ... Stay tuned.
EDIT2: problems should be sorted out.. if not try using MBR method instead. I did few tests and it worked fine most of the time even going back from sleep mode.
P.S. ffs I hate this forum formatting and editing posts, need to click few times to get formatting visible. Can it be adjusted to make it easy to edit posts (especially links) ?