Reading ATA status port always gives 0xFF (IDENTIFY command)
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Reading ATA status port always gives 0xFF (IDENTIFY command)
Hello,
Im tring to read from my boot cdrom, but its always responding 0xFF , and I've checked and i think that all the logic is right, can anyone help me have a look? thanks!
https://github.com/cheyao/AchiveOS/blob ... b/cd.c#L33
Im tring to read from my boot cdrom, but its always responding 0xFF , and I've checked and i think that all the logic is right, can anyone help me have a look? thanks!
https://github.com/cheyao/AchiveOS/blob ... b/cd.c#L33
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
Does your virtual machine's debug log show that you're accessing the hardware? Bochs is very talkative if you enable debug messages.
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
Nope, no messages after the 00035981151i[BIOS ] Booting from 07c0:0000 messageOctocontrabass wrote:Does your virtual machine's debug log show that you're accessing the hardware? Bochs is very talkative if you enable debug messages.
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
0xFF is the open bus value. You seem to think it was 0, but no, if no hardware is there, you get all 1-bits. Unfortunately, for some hardware ports, 0xFF is also a valid register value. Anyway, you do not seem to be detecting ATA, but are just assuming an ATA controller to be at a predetermined address.
0xFF being the open-bus value is also why most A20 enabling code using the keyboard controller is wrong on systems that don't have a keyboard controller. But that is a question for another time.
0xFF being the open-bus value is also why most A20 enabling code using the keyboard controller is wrong on systems that don't have a keyboard controller. But that is a question for another time.
Carpe diem!
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
I think that shouldn't be the case, it reports 0xff for all 4 ports, but atleast one should have something since i've got a cdrom connectednullplan wrote:0xFF is the open bus value. You seem to think it was 0, but no, if no hardware is there, you get all 1-bits. Unfortunately, for some hardware ports, 0xFF is also a valid register value. Anyway, you do not seem to be detecting ATA, but are just assuming an ATA controller to be at a predetermined address.
0xFF being the open-bus value is also why most A20 enabling code using the keyboard controller is wrong on systems that don't have a keyboard controller. But that is a question for another time.
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
And now I just used changed it to use a pointer, but now it gets 0 out of the pointer when using -O2, but -O1 and -O0 works. Is there some kind of UB that im overlooking?
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
Its only 19 sectors, enough for now.Octocontrabass wrote:How big is your kernel binary?
And I found the problem, some how i needed a delay after the inb, dunno why, but its fixed
but thanks for the help!
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
Are you sure? I checked a recently-generated disk image and the kernel binary in that one is at least 30 sectors...cyao1234 wrote:Its only 19 sectors, enough for now.
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
That's weird, on my pc it's only 19 sectors, anywas im going to increase it a little bitOctocontrabass wrote:Are you sure? I checked a recently-generated disk image and the kernel binary in that one is at least 30 sectors...cyao1234 wrote:Its only 19 sectors, enough for now.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Reading ATA status port always gives 0xFF (IDENTIFY comm
You should figure out a way to automatically load the correct number of sectors. Otherwise, you'll keep running into problems whenever your kernel outgrows your bootloader.