ATAPI setback.

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
Exabyte256

ATAPI setback.

Post by Exabyte256 »

My name is Exabyte, I'm creating a CD-ROM based operating system. I've been at work for several weeks now, and throughout that time, I've mostly read developers documents and books.

I do not program features until I understand how they work and why they work, so it's been quite slow to begin with, mainly because of problems with the endian system malforming my GDT data.

I'm at a point where I need to load my kernel into the memory (from the CD-ROM), but there is a setback: The commands do not return any data.

Here's what I'm doing:

Select Correct Drive
Wait For Correct Status
Send Packet
Wait For DRQ
Recieve Data

I know the packet commands work, if I change the command to a NOP or something, then the DRQ stays blank and the program freezes because it waits forever until it's ready.

When I recieve the data though, that's a whole different story. For every read (of port 0x1F0) the result returns 0xFF, at least that's what bochs says.

Please could someone point out what I'm missing here? This is such an annoying problem, and the documentation just doesn't cover it.
kernel64

Re:ATAPI setback.

Post by kernel64 »

Did you install a binary of Bochs with CD-ROM support enabled? If you compiled your own bochs, when you run ./configure you --enable-cdrom (I think that's how it's done... LOL, I only compiled it three days ago and I've forgotten already!)

Also, are you setting the Bochs configuration file correctly? The ATAPI device section correctly points to the CD-ROM image file and is enabled, or is pointing to the real CD-ROM on your machine? Normally you have a bochsrc.txt or .bochsrc or somesuch in the root of your home folder, e.g. /home/user or C:\Documents and Settings\username (or maybe in \My Documents, but usually just the home directory).

Check that out and let us know how it goes.

You might also check out the logging output. You can configure that in the Bochs config file to dump all logging to a file of your choice. Maybe it will give you some clues like "CD-ROM support not enabled or no CD image found" or whatever.
Exabyte256

Re:ATAPI setback.

Post by Exabyte256 »

Yes, it's all working, I said my system loaded from a CD. It boots from a no-emulation El Torito header.

Everything works up to the point where I have to read from the device!
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:ATAPI setback.

Post by Candy »

Are you doing byte reads or word reads? In normal PC's there's not much difference, but bochs requires you to use the correct type.
Exabyte256

Re:ATAPI setback.

Post by Exabyte256 »

I'm reading bytes. That could be the cause of the problem, although I'm not sure why...

Okay, I'll try it using an "inw" function when I get back to my home computer.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:ATAPI setback.

Post by Pype.Clicker »

http://www.osdev.org/osfaq2/index.php/AtapiCdrom

I suggest you give a look at those .UG (user guide) files in the ATADRVR.zip distribution from ata-atapi.com ... that might give you better insight at what's going on.
Exabyte256

Re:ATAPI setback.

Post by Exabyte256 »

Well, I tried it with an 'inw' command and the screen lit up! Data... bytes of readable data... "___!____VTAB____Turbo CD-ROM____1.0_" it said. (The print command I made makes invisible chars show up).

Thankyou very much for helping.
Post Reply