Can speed of 2nd harddrive in 6510b DVD-bay be improved

Discussion in 'HP Business Class Notebooks' started by diskfreak, Apr 22, 2009.

Thread Status:
Not open for further replies.
  1. kingzq

    kingzq Notebook Enthusiast

    Reputations:
    20
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    6
    Hi nbruser, I also tried the MBR editing method. The following is my experience which I can't assure applies to other people's cases.

    The original post from the chinese forum is based on the MBR from a windows XP partitioned driver. I could simply download his modified mbr file and use:

    dd if=modified.bin of=/dev/sda bit=446 count=1

    to apply the tweak to my drive without hurting my partition information. However, if I use a windows 7 partitioned driver, the mbr information for initialization is very different, thus can't use this simple tweak and must modify the codes manually (add in extra jump loop for the register).

    What I have noticed is that the mbr modification is actually doing the same job as the setpci. It enables the UDMA mode under windows, which by default is at UDMA2 mode. After UDMA enabled, simple:

    hdparam.exe -X UDMA5 /dev/sdb

    would set the UDMA5 mode nicely and remains the same mode even after reboot or resume from sleep, well as far as you always boot into windows. As a matter of fact, even if I don't use the mbr method and only stay with the baredit or setpci script, I also only need to run the script once. That's right! Even without running the script again at booting everytime, the UMDA5 mode always stays for each reboot or resume. However, if I boot into linux once, the UDMA5 tweaking information is lost and has to be redone again, this is true for both the script method and the mbr method. The different between them is that for the script method, you would fall back to the super slow MDMA2 mode, while the modified mbr brings you back to UDMA2.

    At this point things seem to be working pretty nice, after all not many people need boot into linux. Well, there is one problem I can never get around with that finally made me give up the UDMA5 adventure:

    The extreme long waiting time after resume! This problem hits me almost every single time after I left my sleep for more than 10mins or so. The hard drive activity LED keeps on and the driver in the optical bay is busy with something for like 5mins or longer. I have verified that the source of this issue comes from the hdparam program. Means if you only use mbr enable the UDMA(2) mode, but not applying the UMDA5 switch, the problem won't happen. Once hdparam is used to set UDMA5, I always get the problem. Try to reset the IDE controller register back to 0000 with setpci doesn't help. I have never found a solution to this problem, and I can only assume there is something wrong with my caddy adapter if no one else suffers this problem. Unlike the Marvell chip many other caddies use, mine has a Sunplus SATALink SPIF223A-HL002 chip, my driver is a 500GB WD blue. Maybe this chip is not as stable as the Marvell ones :(
     
  2. nbruser

    nbruser Notebook Consultant

    Reputations:
    70
    Messages:
    124
    Likes Received:
    1
    Trophy Points:
    31
    Hi.

    1) First of all what's your laptop model?

    2) 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.

    3) About Linux - well, most likely Linux resets somehow drive state and probably writes some information into registers so you might need to check what grub or other bootloader is doing.

    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:
    Code:
    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
    Code:
    seg000:0017                 push    ax
    seg000:0018                 push    61Ch
    
    replace it with:
    Code:
    seg000:0017                 jmp     loc_163
    find the line
    Code:
    seg000:0163 ; ---------------------------------------------------------------------------
    seg000:0163                 dec     cx
    
    and replace with

    Code:
    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:

    mbr_patch_422_bytes

    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).

    NOTE: I tested this ONLY on Newmodeus caddy (master jumper activated) - it worked just fine.

    Please test this and report back if it worked for you.
     
  3. nbruser

    nbruser Notebook Consultant

    Reputations:
    70
    Messages:
    124
    Likes Received:
    1
    Trophy Points:
    31
    Yes, it exactly does the same thing but before Windows starts. You can also use my latest script which works just fine on Windows 7 too without need of editing MBR.

    Well, if you did a reboot - PCI registers untouched.
    If Windows resets the drive that means in register 48h 000000. Windows also clears up 54h as well, because if you read Intel's documentation about ICH8-M you'd notice there is a requirement of PCT0 to make UDMA work.

     
  4. User Retired 2

    User Retired 2 Notebook Nobel Laureate NBR Reviewer

    Reputations:
    4,127
    Messages:
    7,892
    Likes Received:
    10
    Trophy Points:
    0
    When using a SATALink SPIF223A based caddy on a HP 2510P also causes a 30s bios hang on bootup. Ebay caddies that use the Marvell sata-to-pata bridge do not experience that problem. Unfortunately we've found that ebay caddies now can come with either chip with some vendors being unable to advise which one their's uses.

    Excellent work. +rep.
     
  5. kingzq

    kingzq Notebook Enthusiast

    Reputations:
    20
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    6
    I use the 8710w laptop, and I used the IDA to do the MBR analysis and Ultra Edit to apply the changes. My fix for the windows 7 MBR used the same strategy as yours, I used the address from 0163h to 01b1h that orginially holds the error message to host the new register information, but I only had the part that resets the 54h resister to enable the UMDA mode, that is what I learned from the Chinese post. Nice job on finding the fix for register 48h! I would never figure that out given my zero knowledge of hardware, can only do what other people already have found :confused:

    I am going to give my crappy caddy one last shot see if the new MBR fix can wake him from sleep correctly and I will keep you guys posted.

     
  6. kingzq

    kingzq Notebook Enthusiast

    Reputations:
    20
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    6
    Hmm, interesting that the Marvell chip doesn't have the boot up delay. Well that actually doesn't bother me much, if my SATALink chip wakes up normally, I would be happy with it :)

     
  7. User Retired 2

    User Retired 2 Notebook Nobel Laureate NBR Reviewer

    Reputations:
    4,127
    Messages:
    7,892
    Likes Received:
    10
    Trophy Points:
    0
    The sleep/resume issue was another problem a user reported with the Sunplus-based caddy. If yours has a master/slave jumper then try setting it on the other setting to see if that makes a difference.
     
  8. kingzq

    kingzq Notebook Enthusiast

    Reputations:
    20
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    6
    Mine doesn't have a switch, but I saw it was working on master when I had it installed before. I didn't think much of the channel problem given the 8710w only has one IDE device, sitting on master seemed reasonable to me.

     
  9. User Retired 2

    User Retired 2 Notebook Nobel Laureate NBR Reviewer

    Reputations:
    4,127
    Messages:
    7,892
    Likes Received:
    10
    Trophy Points:
    0
    Is the stock HP optical drive configured as master or slave? You'd want the caddy to mirror the optical drive for best chance of success.
     
  10. kingzq

    kingzq Notebook Enthusiast

    Reputations:
    20
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    6
    The stock optical drive is sitting at master too.
     
Loading...
Thread Status:
Not open for further replies.

Share This Page