|
Joyoung
初级用户
 
积分 48
发帖 18
注册 2008-9-30
状态 离线
|
『楼 主』:
请教个ATA 0xec command取出的数据问题
使用 LLM 解释/回答一下
代码如下:
unsigned int diskData; /* Disk data */
。。。
。。。
for (offset = 0; offset != 256; offset++) /* Read "sector" */
diskData = inpw(cmdInterface);//此时能成功取得数据
printf("Word:%X, Word:%X\n", diskData, diskData]);//61:60是number of sectors.如果硬盘大小为80G时,取出的数据是正确的,但如果硬盘是160G/250G/500G时取出的数却都是FFF:FFFF,这肯定有错,但不知问题出在哪里。有哪位高手知道的?谢谢!~~~~
The code is as follows:
unsigned int diskData; /* Disk data */
。。。
。。。
for (offset = 0; offset != 256; offset++) /* Read "sector" */
diskData = inpw(cmdInterface);//At this time, data can be successfully obtained
printf("Word:%X, Word:%X\n", diskData, diskData]);//61: 60 is the number of sectors. If the hard disk size is 80G, the data taken out is correct, but if the hard disk is 160G/250G/500G, the taken-out numbers are all FFF:FFFF. There must be something wrong, but I don't know where the problem is. Is there any expert who knows? Thank you!~~~~
|
|
2008-10-29 16:17 |
|
|
netwinxp
高级用户
   
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
对于LBA48的硬盘(>137G),该DWORD存放0FFF FFFFH(7个F刚好LBA28),真正的扇区数不放在这里,详细位置我不太记得了,你可以查找一下ATA-ATAPI-5标准(好像是)。直接对硬件编程是个很烦琐的事情,最好的办法是尽可能多找有关的标准文档。
LBA48和LBA28很多ATA命令不一样,而且LBA包的格式也不一样。很多HPA工具用不了也是编写者没考虑到这里的区别的原因造成的。
Last edited by netwinxp on 2008-10-29 at 16:39 ]
For LBA48 hard drives (>137G), this DWORD stores 0FFF FFFFH (7 Fs are exactly LBA28). The actual number of sectors is not stored here. I don't quite remember the exact location. You can look up the ATA-ATAPI-5 standard (I think). Direct hardware programming is a very tedious task. The best way is to find as many relevant standard documents as possible.
There are many different ATA commands between LBA48 and LBA28, and the format of the LBA packet is also different. The reason why many HPA tools don't work is that the writers didn't consider the difference here.
Last edited by netwinxp on 2008-10-29 at 16:39 ]
|
|
2008-10-29 16:27 |
|
|
Joyoung
初级用户
 
积分 48
发帖 18
注册 2008-9-30
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
Originally posted by netwinxp at 2008-10-29 16:27:
对于LBA48的硬盘(>137G),该DWORD存放0FFF FFFFH(7个F刚好LBA28),真正的扇区数不放在这里,详细位置我不太记得了,你可以查找一下ATA-ATAPI-5标准(好像是)。 ...
我看了ATA 6,E文不是很好,没有发现会存在哪,可以麻烦高手帮我看看吗?感激不尽呀
Originally posted by netwinxp at 2008-10-29 16:27:
For hard disks with LBA48 (>137G), this DWORD stores 0FFF FFFFH (7 Fs are exactly LBA28), and the actual number of sectors is not stored here. I don't quite remember the exact location. You can look up the ATA-ATAPI-5 standard (I think). ...
I read ATA 6, but my English is not very good, and I didn't find where it could be. Can you please ask a master to take a look? Thanks a lot!
|
|
2008-10-29 16:38 |
|
|
netwinxp
高级用户
   
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
找IDENTIFY_DEV(0ECH)命令,它会标出在哪里找那256字节的定义。
Looking for the IDENTIFY_DEV(0ECH) command, which will mark where to find the definition of the 256 - byte.
|
|
2008-10-29 16:40 |
|
|
Joyoung
初级用户
 
积分 48
发帖 18
注册 2008-9-30
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
Originally posted by netwinxp at 2008-10-29 16:40:
找IDENTIFY_DEV(0ECH)命令,它会标出在哪里找那256字节的定义。
我看了,好像就是Word60-Word61:Total number of user addressable sectors (LBA mode only),还有一个是Word57-Word58:Current capacity in sectors;其他的好像没有了
ATA 6的SPEC在附件里,高手可否帮忙看看?
Originally posted by netwinxp at 2008-10-29 16:40:
Looking for the IDENTIFY_DEV(0ECH) command, which will mark where to find the definition of those 256 bytes.
I took a look, it seems to be Word60-Word61:Total number of user addressable sectors (LBA mode only), and another one is Word57-Word58:Current capacity in sectors; the others don't seem to be there. The ATA 6 SPEC is in the attachment, can the experts help take a look?
附件
1: HDD.rar (2008-10-29 17:36, 9.53 KiB,下载次数: 28)
|
|
2008-10-29 17:36 |
|
|
netwinxp
高级用户
   
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
WORD60~61(LBA28)如果为0FFFFFFF就无效。
WORD100~103(LBA48)如果为0000FFFFFFFFFFFF就无效。(PS:目前还没有超过LBA48,所以超过后的定义还没出来)
详看6.2.1。
判断是否支持LBA48看WORD83 BIT10,这个值只是BIOS能返回的最大容量(不含HPA)。
真正的硬盘容量(含HPA部分)使用READ_NATIVE_MAX(F8)<LBA28>或READ_NATIVE_MAX_EXT(27)<LBA48>获得。
LZ肯定看得不够仔细,附件就不用下载了,我的PATCH都下载到今年八九月份了。<img src="images/smilies/face-raspberry.png" align="absmiddle" border="0">
Last edited by netwinxp on 2008-10-29 at 19:36 ]
WORD60~61 (LBA28) is invalid if it is 0FFFFFFF.
WORD100~103 (LBA48) is invalid if it is 0000FFFFFFFFFFFF. (PS: Currently there is no exceeding LBA48, so the definition after exceeding is not out yet)
See 6.2.1 in detail.
To judge whether LBA48 is supported, check WORD83 BIT10, this value is only the maximum capacity that BIOS can return (excluding HPA).
The real hard disk capacity (including HPA part) is obtained by READ_NATIVE_MAX(F8)<LBA28> or READ_NATIVE_MAX_EXT(27)<LBA48>.
LZ must not have read carefully enough, no need to download the attachment, my PATCH has been downloaded to August-September this year. :P
Last edited by netwinxp on 2008-10-29 at 19:36 ]
|
|
2008-10-29 19:04 |
|
|
Joyoung
初级用户
 
积分 48
发帖 18
注册 2008-9-30
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Originally posted by netwinxp at 2008-10-29 19:04:
WORD60~61(LBA28)如果为0FFFFFFF就无效。
WORD100~103(LBA48)如果为0000FFFFFFFFFFFF就无效。(PS:目前还没有超过LBA48,所以超过后的定义还没出来)
详看6.2.1。
判断是 ...
搞定了,真是太感谢你啦!谢谢!~~~
是用Word,我的文档是标为红色的,以为是现在不用这区域的了呢,原来是我理解错误啦,唉。。。
PS:READ_NATIVE_MAX(F8)<LBA28>或READ_NATIVE_MAX_EXT(27)<LBA48>这两个函数是Linux下用的吧,DOS下用不了,BC3.1里找不到源码
Originally posted by netwinxp at 2008-10-29 19:04:
WORD60~61 (LBA28) are invalid if they are 0FFFFFFF.
WORD100~103 (LBA48) are invalid if they are 0000FFFFFFFFFFFF. (PS: There hasn't been any LBA48 exceeding yet, so the definition beyond that hasn't been worked out yet)
See 6.2.1 in detail.
Judgment is ...
Got it, really thank you so much! Thanks!~~~
I used Word, my document is marked in red, I thought it's not used in this area now, but it turned out I misunderstood, alas...
PS: READ_NATIVE_MAX(F8) <LBA28> or READ_NATIVE_MAX_EXT(27) <LBA48> These two functions are used under Linux, not available under DOS, and the source code can't be found in BC3.1
|
|
2008-10-29 20:05 |
|
|
netwinxp
高级用户
   
积分 741
发帖 366
注册 2007-7-25
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by Joyoung at 2008-10-29 20:05:
PS:READ_NATIVE_MAX(F8)<LBA28>或READ_NATIVE_MAX_EXT(27)<LBA48>
晕啊,这是两条ATA命令F8、27,其中F8用在LBA28的场合,27用在LBA48上。它和EC是差不多的冬冬<img src="images/smilies/face-wink.png" align="absmiddle" border="0">
LZ的大作如果写好了记得拿出来让大家欣赏一下<img src="images/smilies/face-smile-big.png" align="absmiddle" border="0">
Last edited by netwinxp on 2008-10-30 at 12:50 ]
Originally posted by Joyoung at 2008-10-29 20:05:
PS:READ_NATIVE_MAX(F8)<LBA28> or READ_NATIVE_MAX_EXT(27)<LBA48>
Oh no! These are two ATA commands, F8 and 27. F8 is used in the LBA28 scenario, and 27 is used in LBA48. It's similar to EC stuff;)
Remember to share your great work with everyone when it's done! :D
Last edited by netwinxp on 2008-10-30 at 12:50 ]
|
|
2008-10-30 11:55 |
|