Page 1 of 1

ATAPI Again

Posted: Mon Oct 12, 2009 12:16 am
by pguy
I finally have a simi-functional PIO atapi driver (works on real hardware and emulated), but I have a problem. I cannot read certain sectors in full, when I try to read sector 16, it seems that I can only read the first 7 bytes. When I read the disk using winhex, I can see that sector 16 has more readable characters in it than what I can see in my OS and I need to read this sector to find root and work with the disc. If I traverse the disc it appears that I can not read any sector in full until I reach a sector that is actual file data; I can only read parts of the other sectors before and after such sectors.

I checked the status bits and they are 88 88 88, and I wait for BSY to clear which should mean that the transmission went well and is complete. I tested how much data was being sent in and it is 2048, which is what I expected. But, when I try to read the offsets where the root would be described, I get nothing. I've been pouring through the ATAPI spec and I have read the ATAPI wiki entry at least 5 times and as far as I can tell, I am doing everything right.

Any ideas what I might be doing wrong?

Re: ATAPI Again

Posted: Fri Oct 16, 2009 4:56 pm
by pguy
Well, no hits in a reasonable amount of time, so let me rephrase my question.

How important is it to loop until DRQ is clear while reading? Meaning, after the read has taken place, before exiting the function, should I check DRQ and loop again if not zero or is it OK to ignore it? If it is important, why is it important? Thanks

Re: ATAPI Again

Posted: Sat Oct 17, 2009 9:24 am
by Matthew
Did you check out the x86 example in ATAPI wiki page?

Re: ATAPI Again

Posted: Sat Oct 17, 2009 2:52 pm
by pguy
I did and I am not saying anything bad about the writer but I think the code is wrong, because it is said in ATAPI-6 that the 9th bit of the ATAPI packet was reserved, yet the example writes a 1 in the 9th bit. Also that example does not loop if DRQ is 1, instead it would get stuck waiting if it was. I have also seen Geezer's ATAPI example and he loops, but I still don't see why it is necessary. Is it in case that the drive attempts to read from the middle of a sector, that's when you need to loop? And, why can I only read a small portion of certain sectors such as 16, but I can read in full other sectors?

Re: ATAPI Again

Posted: Sat Oct 17, 2009 4:01 pm
by Matthew
Where does it write a 1 into the 9th bit of the ATAPI packet?

Re: ATAPI Again

Posted: Sat Oct 17, 2009 4:22 pm
by pguy
It doesn't that was my fault. Been working with several different resources and I think I am getting tired. Actually looking at the code again and based on the INF-8020 spec, the code is pretty much spot on. The only difference between it and mine is that it waits for INTRQ. I think I will go ahead and wait for that instead of just waiting for BSY=0 then reading. Can you see why that might be problem?

Re: ATAPI Again

Posted: Sat Oct 17, 2009 6:06 pm
by Matthew
It is necessary to wait for the IRQ before reading any data. There will also be another IRQ after the final block is transferred.

Re: ATAPI Again

Posted: Tue Oct 20, 2009 6:09 am
by pguy
I am now waiting for the irq and there is no difference in the amount of data that I am returning. I have tested this on both emulated and real hardware and the return is always the same.

For Example:

Code: Select all

Offset      0  1  2  3  4  5  6  7   8  9 10 11 12 13 14 15

   32768   01 43 44 30 30 31 01 00  43 44 2D 52 54 4F 53 20    CD001  CD-RTOS 
   32784   43 44 2D 42 52 49 44 47  45 20 20 20 20 20 20 20   CD-BRIDGE       
   32800   20 20 20 20 20 20 20 20  30 33 31 32 31 34 5F 31           031214_1
   32816   37 32 30 20 20 20 20 20  20 20 20 20 20 20 20 20   720             
This is a snippet of sector 16. The disc is a Data CD using the XA format (I'm not sure if this is the reason for all the trouble). I am using the packet command 0xA8 (READ (12)). I am using PIO mode to do the transfer in at one block per transfer and this is the return on sector 16.

Code: Select all

01 43 44 30 30 31 01
And the amounts returned continue to fluctuate between 0 and 7 bytes (which should be 2048) up until I read in sector 27:

Code: Select all

Offset      0  1  2  3  4  5  6  7   8  9 10 11 12 13 14 15

   55296   20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20                   
   55312   20 20 20 20 20 20 20 20  20 20 20 20 20 20 53 4E                 SN
   55328   4F 4F 50 45 52 28 74 6D  29 0D 0A 20 20 20 20 20   OOPER(tm)       
   55344   20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20                   
   55360   20 53 65 72 69 6F 75 73  20 53 79 73 74 65 6D 20    Serious System 
   55376   49 6E 66 6F 72 6D 61 74  69 6F 6E 0D 0A 0D 0A 20   Information     
   55392   20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 43                  C
   55408   6F 70 79 72 69 67 68 74  20 31 39 39 32 2D 31 39   opyright 1992-19
Another snipped example. When I reach this sector and sectors like it, I am able to read the entire sector.

:?: Why is this happening? Any ideas?

Re: ATAPI Again

Posted: Thu Oct 22, 2009 8:00 pm
by manic6745
So, the other day I got the ban for my hilarious prank to get some n00b to give up his password, as if I was serious (I did it all in public). I could have of course did it all in private (PM), but like I said, I was only joking. Like gaining access to his account means something anyway. Does it give me access to his email? Maybe. Do I want that kind of access? Not really. I mean, come on, the guy wasn't even a Mod or Admin!

At any rate, I thought I would come back to close this thread since now I have it solved. Unfortunately for you guys, I will not be explaining my solution or posting source for others to follow. You can blame OSDEV for that. You see, OSDEV is owned, operated, and supported by the world's largest collection of douche bags. These douche bags get high from insulting members and encouraging them to quit. And, for those reasons alone, OSDEV, I give to you what you deserve in return, absolutely NOTHING.

Now hurry up and ban this account too, and have a wonderful day. :twisted:

Re: ATAPI Again

Posted: Thu Oct 22, 2009 10:07 pm
by smeezekitty
manic6745 wrote:So, the other day I got the ban for my hilarious prank to get some n00b to give up his password, as if I was serious (I did it all in public). I could have of course did it all in private (PM), but like I said, I was only joking. Like gaining access to his account means something anyway. Does it give me access to his email? Maybe. Do I want that kind of access? Not really. I mean, come on, the guy wasn't even a Mod or Admin!

At any rate, I thought I would come back to close this thread since now I have it solved. Unfortunately for you guys, I will not be explaining my solution or posting source for others to follow. You can blame OSDEV for that. You see, OSDEV is owned, operated, and supported by the world's largest collection of douche bags. These douche bags get high from insulting members and encouraging them to quit. And, for those reasons alone, OSDEV, I give to you what you deserve in return, absolutely NOTHING.

Now hurry up and ban this account too, and have a wonderful day. :twisted:
i am not a mod but you better knock it off before you get banned again

Re: ATAPI Again

Posted: Fri Oct 23, 2009 1:32 am
by tantrikwizard
pguy wrote:I did and I am not saying anything bad about the writer but I think the code is wrong
this is good stuff, please update the wiki with your findings.

Re: ATAPI Again

Posted: Fri Oct 23, 2009 1:42 am
by tantrikwizard
manic6745 wrote:So, the other day I got the ban for my hilarious prank to get some n00b to give up his password, as if I was serious (I did it all in public). I could have of course did it all in private (PM), but like I said, I was only joking. Like gaining access to his account means something anyway. Does it give me access to his email? Maybe. Do I want that kind of access? Not really. I mean, come on, the guy wasn't even a Mod or Admin!

At any rate, I thought I would come back to close this thread since now I have it solved. Unfortunately for you guys, I will not be explaining my solution or posting source for others to follow. You can blame OSDEV for that. You see, OSDEV is owned, operated, and supported by the world's largest collection of douche bags. These douche bags get high from insulting members and encouraging them to quit. And, for those reasons alone, OSDEV, I give to you what you deserve in return, absolutely NOTHING.

Now hurry up and ban this account too, and have a wonderful day. :twisted:
it has nothing to do with being dicks. osdev is NOT a place for beginners, which is what we see most here and MUST weed out or else become a slave to idiots. Frankly, professional and seasoned engineers have no time for stupidity. Either you are a professional (requirement) or not. Osdev is no place for n00bs and they should be informed as such. I dont see a bunch of bashing, rather I see a series of seasoned and experienced engineers who have no time to deal with the stupidity which comes from inexperience (and often age.) All too often there comes along some goof ball 13 year old who thinks they can come up with the 'next greatest thing'. while this achievement is admirable, the likelhood is nearly 0%. I make over $60 an hour...dont waste my time with stupidity. This is OSDEV, not web pages. You had better get your guns loaded if youre attempting ANYTHING in this realm.

Re: ATAPI Again

Posted: Fri Oct 23, 2009 1:47 am
by Combuster
If you have to complain about the consequences of you breaking law, be my guest. Your freedom of speech is our freedom to ignore.

So that you know, there will be (and always was) no negotiation with terrorists/trolls/criminals. You fail. Goodbye.

Re: ATAPI Again

Posted: Fri Oct 23, 2009 2:02 am
by AJ
manic6745 wrote:So, the other day I got the ban for my hilarious prank...
That's a really odd sense of humour. You weren't just banned for that one prank, anyway. You had previously been warned for flamebaiting. Not many people can claim a warning and a PermBan after just 10 posts...
Unfortunately for you guys, I will not be explaining my solution or posting source for others to follow. You can blame OSDEV for that.
Oh, well. Life goes on...
These douche bags get high from insulting members and encouraging them to quit. And, for those reasons alone, OSDEV, I give to you what you deserve in return, absolutely NOTHING.
There has certainly been a lack of tolerance in some cases in the past. Some of this was brought on my a number of people failing to search the forum / wiki / Google as stated in the forum rules. As far as I can tell, this situation has improved. This improvement is mainly due to the help of forum regulars and through good use of the "Report This Post" button.
Now hurry up and ban this account too, and have a wonderful day. :twisted:
Ok.