如何获取磁盘制造商信息?
我正在学习对 ATA 总线进行编程。在 Bochs 中,我的 r/w 代码似乎有效,但是在我用真实磁盘尝试之前我不能肯定地说。因此,我需要找出如何获取磁盘制造商信息,这是在谈论其功能时最不重要的事情,但另一方面,在屏幕上打印此信息是可以确保我不会搞砸的事情之一启动我的整个电脑。我试图用谷歌搜索这个问题,但不太幸运。如果您能为我提供一些链接或提示,那就太好了。谢谢你。
ps - 首选无中断的解决方案
I'm learning to program the ATA bus. In Bochs it seems my code for r/w works, however I can't say that for sure until I try it with real disk. Thus I need to find out how to obtain the disk manufacturer information which is the least importnant thing when talking about it's functionality but on the other hand printing this information on the screen is one of the things that can assure me I'm not gonna screw up my whole pc. I was trying to google this out but wasn't very lucky. If you could provide me with some links or hints that would be great. thx stu.
ps - solutions without interrupts are prefered
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 this pdf 中找到了解决方案(查找indetify 设备命令),还有一个很好的 C 代码 此处。还有很多关于 osdev 的信息,如果你不太喜欢的话,我认为这是最好的阅读源代码。使用 Bochs 它工作得很好,使用 Qemu 它工作得很好,使用我的台式电脑它工作得很好,但当然笔记本电脑感觉有点特殊,所以我还不能让它在这些上工作。一台打印 40 个字符,看起来像 pi,而一台则根本不打印任何内容。如果您有任何想法,请与我分享您的意见。希望这些参考资料可以帮助其他寻求此信息的人。
编辑
好吧,我的错(当然),我忘了等待 BSY。获取所需信息的正确方法正如 osdev 上 IDENTIFY 命令下所述。还要确保在发送命令后读取所有数据,否则忙 LED 不会熄灭。
I found the solution in this pdf (look up the indetify device command) and there is also a nice C code here. There is also a lot of information on osdev, which I think is the best if you don't much like reading through source codes. With Bochs it works fine, with Qemu it works fine, with my desktop PC it works fine, but of course laptops are feeling somewhat special so I couldn't make it work on these yet. One prints 40 characters which look like pi and one doesn't print anything at all. Should you have ideas what could be the matter please share your opinions with me. Hope the references help others who seek this information.
EDIT
ok, my bad (of course), I forgot to wait for BSY. The proper way to get the desired information is just as described on osdev under IDENTIFY command. Also make sure you read all the data after sending the command or else the busy led would not go off.
我认为你应该尝试从 Linux 内核研究 libata。
I think that you should try with investigating libata from linux kernel.