SATA problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
hesperus
Posts: 1
Joined: Sun May 31, 2009 6:10 pm

SATA problem

Post by hesperus »

Hi!
I'm trying to write disk driver. I have problem with SATA disk in PCI mode.
I've read BARs #0 and #1 (primary command/control blocks), with values EC01 and E881.
Then I have two approaches:
1. clearing lowest bit (so it gives EC00 and E880)
2. shifting by 3 and 2 (according to this spec http://www.intel.com/Assets/PDF/datasheet/313056.pdf - this is a controller I have - adress of command block starts at 4th bit and control at 3rd bit)-1D80 and 3A20
Then I'm using this values as normal registers (e.g. when normally 0x1F0 goes I put EC00 in first or 1D80 in second method).
The first one hangs identify function (I think the BSY never gets cleared), the second tells me there is no drive on bus (0xFF on every reads on every ports).
Is there any major mistake in my method? And which values should I use? Shifted or just with cleared bit?

PS. This is my first post so hello to everybody and sorry for any language mistakes :)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: SATA problem

Post by Combuster »

You shouldn't shift BAR addresses. the "missing" bits are zero, and indicate that they are not checked when the processor accesses that address. See PCI
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply