[current revisions] ATAPI/IDE handling bugs
[current revisions] ATAPI/IDE handling bugs
The current ATAPI/IDE code is handled in a way that prevents some accurate CD-ROM checks from passing, causing some software not to work.
OS used: NetBSD 6.1.5 Setup CD
Description:
I decided to install NetBSD 6.1.5 for random occasional reasons.
When booting it up, it unexpectedly hit "unknown device" trying to read the emulated CD.
Returns to a boot prompt where a boot device can be selected afterwards.
NOTE: NetBSD 4.0 passes the checks fine but cannot install it's own packages from it's CD. ends up with "mount_cd9660: /dev/cd0a on /mnt2: Device not configured".
Configuration - Award 430VX PCI with PCem's CD emulation + WinCDEmu (mounter)
Dynamic Recompiler used? - Yes
OS used: NetBSD 6.1.5 Setup CD
Description:
I decided to install NetBSD 6.1.5 for random occasional reasons.
When booting it up, it unexpectedly hit "unknown device" trying to read the emulated CD.
Returns to a boot prompt where a boot device can be selected afterwards.
NOTE: NetBSD 4.0 passes the checks fine but cannot install it's own packages from it's CD. ends up with "mount_cd9660: /dev/cd0a on /mnt2: Device not configured".
Configuration - Award 430VX PCI with PCem's CD emulation + WinCDEmu (mounter)
Dynamic Recompiler used? - Yes
- ppgrainbow
- Posts: 479
- Joined: Thu 04 Sep, 2014 7:03 am
- Contact:
Re: [current revisions] ATAPI/IDE handling bugs
That doesn't sound good. I bet that the ATAPI/IDE handline bug is also causing OS/2 Warp 3 and OS/2 Warp 4 CD emulation to not work correctly. I used IMDisk to mount the CD-ROM ISOs by the way. It may not work with some software, but it's worth it.kazblox wrote:The current ATAPI/IDE code is handled in a way that prevents some accurate CD-ROM checks from passing, causing some software not to work.
OS used: NetBSD 6.1.5 Setup CD
Description:
I decided to install NetBSD 6.1.5 for random occasional reasons.
When booting it up, it unexpectedly hit "unknown device" trying to read the emulated CD.
Returns to a boot prompt where a boot device can be selected afterwards.
NOTE: NetBSD 4.0 passes the checks fine but cannot install it's own packages from it's CD. ends up with "mount_cd9660: /dev/cd0a on /mnt2: Device not configured".
Configuration - Award 430VX PCI with PCem's CD emulation + WinCDEmu (mounter)
Dynamic Recompiler used? - Yes
Re: [current revisions] ATAPI/IDE handling bugs
use Daemon Tools.
Re: [current revisions] ATAPI/IDE handling bugs
I get same thing.SA1988 wrote:use Daemon Tools.
Also, screenshots with NetBSD 6.1.5:
Re: [current revisions] ATAPI/IDE handling bugs
Y'all going to need to run the DEBUG version and go through the log file to see what is going on.
Re: [current revisions] ATAPI/IDE handling bugs
Other ATAPI/IDE issues:
- I tried to add 430HX support to PCem, but the BIOS wouldn't detect the drive at all. It sens command A0 (send packet command) to the IDE controller but even if the currently selected drive is ATAPI, the command is not processed;
Edit: No, the A0 was on the other port and was the select drive thing. But still, something isn't done correctly so the BIOS doesn't even issue an PACKET DEVICE IDENTIFY command.
Edit #2: Turns out PCem only sets cylinder for ATAPI device to 0xEB14 when IDENTIFY command is issued, which however the Award 430HX BIOS I used (of an ASUS board) does not issue unless the device is not ATAPI. Having selecting drive at port 1F6h/176h also set cylinder to 0xEB14 if the device is a CD-ROM drive made it detect the CD-ROM correctly.
- All MS-DOS CD-ROM drivers other than versions of OAKCDROM.SYS cause freezes at random points, most noticably when running LBA 1.
- I tried to add 430HX support to PCem, but the BIOS wouldn't detect the drive at all. It sens command A0 (send packet command) to the IDE controller but even if the currently selected drive is ATAPI, the command is not processed;
Edit: No, the A0 was on the other port and was the select drive thing. But still, something isn't done correctly so the BIOS doesn't even issue an PACKET DEVICE IDENTIFY command.
Edit #2: Turns out PCem only sets cylinder for ATAPI device to 0xEB14 when IDENTIFY command is issued, which however the Award 430HX BIOS I used (of an ASUS board) does not issue unless the device is not ATAPI. Having selecting drive at port 1F6h/176h also set cylinder to 0xEB14 if the device is a CD-ROM drive made it detect the CD-ROM correctly.
- All MS-DOS CD-ROM drivers other than versions of OAKCDROM.SYS cause freezes at random points, most noticably when running LBA 1.
Last edited by Battler on Sun 06 Sep, 2015 7:25 pm, edited 2 times in total.
Re: [current revisions] ATAPI/IDE handling bugs
PCem's logger didn't report errors. The last command it reported was 28, which is Read (10).neozeed wrote:Y'all going to need to run the DEBUG version and go through the log file to see what is going on.
Re: [current revisions] ATAPI/IDE handling bugs
CD Audio gets stuck at playing! For example, run LBA 1, and get to the main menu. CD Audio will start playing (the background music). Quit the game. Restart it. Current subchannel will be returned as 0x1200 because it's still playing (or in paused mode), which cause VIDE-CDD.SYS to, for some reason, issue a "send DVD structure" command, which will return a packet error, and the game will freeze.
Edit: For some reason, PCem doesn't mark CD Audio as stopped on either the Atapi Reset command or a hard reset of the emulated machine. And I'm quite sure it should. LBA 1 deliberately resets the CD-ROM drive on quitting, and obviously CD Audio should be reset on hard reset.
Edit: For some reason, PCem doesn't mark CD Audio as stopped on either the Atapi Reset command or a hard reset of the emulated machine. And I'm quite sure it should. LBA 1 deliberately resets the CD-ROM drive on quitting, and obviously CD Audio should be reset on hard reset.
Last edited by Battler on Mon 07 Sep, 2015 12:38 am, edited 1 time in total.
Re: [current revisions] ATAPI/IDE handling bugs
I just tried NetBSD and saw this:kazblox wrote:PCem's logger didn't report errors. The last command it reported was 28, which is Read (10).neozeed wrote:Y'all going to need to run the DEBUG version and go through the log file to see what is going on.
ide.c Set multiple mode - 16
I just changed all the pclog stuff to say where it was.. maybe that is something that should be overall?
**edit looks like this is accessing the harddisk. Needs more debug stuff..
onesec
onesec
ide.c New IDE command - EC 0 0
ide.c win_identify
ide.c device is cdrom 0 command is 236
ide.c WIN_IDENTIFY DISK
ide.c New IDE command - EC 1 0
ide.c win_identify
ide.c device is cdrom 1 command is 236
ide.c WIN_IDENTIFY CDROM
onesec
onesec
So I can see it going through the motion of asking what is there. The CD-ROM passes it's magic...
Then it does an abort, which looks right. Still not sure why NetBSD isn't happy though. Maybe it's 'aborting too hard'??ide->secount=1;
ide->sector=1;
ide->cylinder=0xEB14; //ATAPI CD-ROM magic
ide->drive=ide->head=0x0;
I tried to match bochs
case WIN_IDENTIFY: /* Identify Device */
pclog("ide.c WIN_IDENTIFY\t");
if (IDE_DRIVE_IS_CDROM(ide)) {
pclog("CDROM\n");
ide->head=0; //missing...
ide->secount=1;
ide->sector=1;
ide->cylinder=0xEB14; //ATAPI CD-ROM magic
ide->drive=ide->head=0x0;
/* BOCHS
controller->status.busy = 0;
controller->status.drive_ready = 1;
controller->status.err = 1; */
ide->atastat = READY_STAT | ERR_STAT;// | DSC_STAT;
ide->error = ABRT_ERR; //0x04 command ABORTED
ide_irq_raise(ide);
return;
}
Code: Select all
onesec
onesec
onesec
onesec
onesec
ide.c New IDE command - EC 0 0
ide.c win_identify
ide.c device is cdrom 0 command is 236
ide.c WIN_IDENTIFY DISK
ide.c New IDE command - EC 1 0
ide.c win_identify
ide.c device is cdrom 1 command is 236
ide.c WIN_IDENTIFY CDROM
onesec
onesec
onesec
onesec
ide.c New IDE command - EC 1 0
ide.c win_identify
ide.c device is cdrom 1 command is 236
ide.c WIN_IDENTIFY CDROM
onesec
onesec
onesec
ide.c New IDE command - EC 0 0
ide.c win_identify
ide.c device is cdrom 0 command is 236
ide.c WIN_IDENTIFY DISK
ide.c New IDE command - EC 0 0
ide.c win_identify
ide.c device is cdrom 0 command is 236
ide.c WIN_IDENTIFY DISK
ide.c New IDE command - 10 0 0
ide.c New IDE command - C6 0 0
ide.c device is cdrom 0 command is 198
ide.c WIN_SET_MULTIPLE_MODE
ide.c Set multiple mode - 16
ide.c New IDE command - 20 0 0
ide.c device is cdrom 0 command is 32
ide.c WIN_READ
ide.c WIN_READ_NORETRY
ide.c New IDE command - C4 0 0
ide.c device is cdrom 0 command is 196
ide.c WIN_READ_MULTIPLE
Maybe an older NetBSD?
Re: [current revisions] ATAPI/IDE handling bugs
NetBSD 4.0 works actually, but fails to install it's packages due to a mounting error.neozeed wrote: Maybe an older NetBSD?
Battler conjured up some experimental private test patches to fix LBA1 CD reading, which somewhat also fixed NetBSD 4.0. The whole packages are now installable, meaning NetBSD 4 is installable.
Meanwhile, NetBSD 6.1.5 still refuses to boot, but atleast it recognizes the ATAPI now with the patch. But it's starting to spam ATAPI read warnings, and eventually, locking up the machine with it.
We're getting somewhere.
I think NetBSD 6's ATAPI code is expecting something we're missing completely, maybe an undocumented ioctl function? Someone should go check the cvs repository....
Re: [current revisions] ATAPI/IDE handling bugs
So far, I have managed to find solutions to two issues:
1. Some software not detecting the CD-ROM - make PCem set the cylinder to 0xEB14 when the drive is selected by write to port 1F6 or 176;
2. LBA 1 freezing at second run with, say, VIDE-CDD.SYS - make PCem set CD Audio status to STOPPED on both the ATAPI Reset command (which LBA 1 has the driver deliberately issue) and hard reset of the emulated machine.
1. Some software not detecting the CD-ROM - make PCem set the cylinder to 0xEB14 when the drive is selected by write to port 1F6 or 176;
2. LBA 1 freezing at second run with, say, VIDE-CDD.SYS - make PCem set CD Audio status to STOPPED on both the ATAPI Reset command (which LBA 1 has the driver deliberately issue) and hard reset of the emulated machine.
Re: [current revisions] ATAPI/IDE handling bugs
Sounds like you made a lot more progress than me! So 0xeb14 needs to be constantly placed in the cylinder on every CD access?Battler wrote:So far, I have managed to find solutions to two issues:
1. Some software not detecting the CD-ROM - make PCem set the cylinder to 0xEB14 when the drive is selected by write to port 1F6 or 176;
2. LBA 1 freezing at second run with, say, VIDE-CDD.SYS - make PCem set CD Audio status to STOPPED on both the ATAPI Reset command (which LBA 1 has the driver deliberately issue) and hard reset of the emulated machine.
Re: [current revisions] ATAPI/IDE handling bugs
- neozeed: No, constantly placing 0xEB14 as cylinder number makes DOS CD-ROM drivers such as OAKCDROM.SYS unable to detect the drive. I also tried by simply setting 0xEB14 as the initial cylinder value for the CD-ROM drive, but then got stuck at figuring out at how to make it also apply on soft reset. I made softresetx86() call resetide() but it behaved as if resetide() was never called.
Re: [current revisions] ATAPI/IDE handling bugs
Maybe the dozen+ sections that read likeBattler wrote:- neozeed: No, constantly placing 0xEB14 as cylinder number makes DOS CD-ROM drivers such as OAKCDROM.SYS unable to detect the drive. I also tried by simply setting 0xEB14 as the initial cylinder value for the CD-ROM drive, but then got stuck at figuring out at how to make it also apply on soft reset. I made softresetx86() call resetide() but it behaved as if resetide() was never called.
Code: Select all
if (IDE_DRIVE_IS_CDROM(ide)) {
goto abort_cmd;
Nah that would be crazy. Although looking at the soft reset.
Code: Select all
case WIN_SRST: /*ATAPI Device Reset */
pclog("ide.c WIN_SRST\n");
ide->atastat = READY_STAT | DSC_STAT;
ide->error=1; /*Device passed*/
ide->secount = ide->sector = 1;
if (IDE_DRIVE_IS_CDROM(ide)) {
ide->cylinder = 0xeb14;
ide->atastat = 0;
Code: Select all
case WIN_PIDENTIFY: /* Identify Packet Device */
pclog("ide.c WIN_PIDENTIFY\n");
if (IDE_DRIVE_IS_CDROM(ide)) {
pclog("ide.c ATAPI identify\n");
ide_atapi_identify(ide);
ide->pos=0;
ide->error=0;
ide->atastat = DRQ_STAT | READY_STAT | DSC_STAT;
ide_irq_raise(ide);
return;
Code: Select all
case WIN_IDENTIFY: /* Identify Device */
pclog("ide.c WIN_IDENTIFY\t");
if (IDE_DRIVE_IS_CDROM(ide)) {
pclog("CDROM\n");
ide->head=0; //missing...
ide->secount=1;
ide->sector=1;
ide->cylinder=0xEB14; //ATAPI CD-ROM magic
//ide->drive=ide->head=0x0;
//JASON goto abort_cmd; //CD-ROM's abort this command
/* BOCHS
controller->status.busy = 0;
controller->status.drive_ready = 1;
controller->status.err = 1; */
ide->atastat = READY_STAT | ERR_STAT;// | DSC_STAT;
ide->error = ABRT_ERR; //0x04 command ABORTED
ide_irq_raise(ide);
return;
}
Re: [current revisions] ATAPI/IDE handling bugs
ATAPI Device Reset != x86 CPU soft reset. I can set cylinder to 0xEB14 on the former without problems, but I am stuck making it happen on the latter.
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: [current revisions] ATAPI/IDE handling bugs
Absolutely nothing will happen to anything on the IDE bus on an x86 soft reset. An x86 soft reset only affects the processor, peripheral devices are not affected.
Re: [current revisions] ATAPI/IDE handling bugs
also, documentation of the "packet statuses"?
- ppgrainbow
- Posts: 479
- Joined: Thu 04 Sep, 2014 7:03 am
- Contact:
Re: [current revisions] ATAPI/IDE handling bugs
Speaking of soft reset, this happens on real PCs.
On PCem, however. If you select Ctrl+Alt+Del from the File menu, this soft resets the emulated PCem machine, but not in a appropriate matter. This is what happens on the AMI WinBIOS 486 66MHz machine for example: The Ctrl+Alt+Del bug (also known as the "soft reset bug") in the PCem emulation causes the keyboard, FDD and HDD controller to not recognise itself. In any event when the emulated machine stops responding (hang), the keyboard, FDD and HDD controllers are sometimes recognised in the BIOS.
So...it looks like that the Ctrl+Alt+Del soft reset is not handling ATAPI/IDE and keyboard features properly as it should. I sure hope that issue gets fixed.
On PCem, however. If you select Ctrl+Alt+Del from the File menu, this soft resets the emulated PCem machine, but not in a appropriate matter. This is what happens on the AMI WinBIOS 486 66MHz machine for example: The Ctrl+Alt+Del bug (also known as the "soft reset bug") in the PCem emulation causes the keyboard, FDD and HDD controller to not recognise itself. In any event when the emulated machine stops responding (hang), the keyboard, FDD and HDD controllers are sometimes recognised in the BIOS.
So...it looks like that the Ctrl+Alt+Del soft reset is not handling ATAPI/IDE and keyboard features properly as it should. I sure hope that issue gets fixed.
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: [current revisions] ATAPI/IDE handling bugs
Rev 336 should fix the issue with NetBSD 6.1.5, and possibly a few others.
- ppgrainbow
- Posts: 479
- Joined: Thu 04 Sep, 2014 7:03 am
- Contact:
Re: [current revisions] ATAPI/IDE handling bugs
Okay, I updated to r347, and pressing Ctrl+Alt+Del in the File menu still threw out the FDD and HDD controller failures as well as the keyboard not responding.
I hoping that you have the time to look into this bug and fix it soon.
I hoping that you have the time to look into this bug and fix it soon.
Re: [current revisions] ATAPI/IDE handling bugs
I also confirm the "Ctrl+Alt+Del" FDD and HDD bug. This is what appears in Award SiS 496/497 and Award 430VX PCI after a long pause:
- ppgrainbow
- Posts: 479
- Joined: Thu 04 Sep, 2014 7:03 am
- Contact:
Re: [current revisions] ATAPI/IDE handling bugs
Oh, no! That doesn't sound good. Thanks for the heads up.FredPJ wrote:I also confirm the "Ctrl+Alt+Del" FDD and HDD bug. This is what appears in Award SiS 496/497 and Award 430VX PCI after a long pause:
With the Award SiS 496/497 and 430VIX machines, you can expect the emulated machine to not respond for a long time if all four emulated hard drives are installed.
Last edited by ppgrainbow on Wed 16 Sep, 2015 5:32 pm, edited 1 time in total.
Re: [current revisions] ATAPI/IDE handling bugs
I have done some logging on the issue and it seems that sometimes, some IRQ's raised by the emulated IDE controller, get lost, and end up causing this kind of issue. I have observed that a very similar issue also causes LBA 1 to freeze on transferring speech files from the CD when the DOS CD-ROM driver used is GSCDROM.SYS. It issues a "write to hard disk" IDE command after reading from CD, and then gets stuck waiting for it.
Re: [current revisions] ATAPI/IDE handling bugs
Speaking of GSCDROM.SYS, I've noticed that when the driver is loading (from the hard drive or floppy) and the CD-ROM is set to "Empty", it will freeze for a long while. This only seems to happen in PCem.
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: [current revisions] ATAPI/IDE handling bugs
Got a fix for the reset issue. Just waiting for the repo to come back online.
Re: [current revisions] ATAPI/IDE handling bugs
- FredPJ: That happens with any DOS CD driver. It will freeze for a long while, and then I think claim no drive has been detected.
- TomWalker: Awesome, can't want for the repo to come back online.
- TomWalker: Awesome, can't want for the repo to come back online.
- ppgrainbow
- Posts: 479
- Joined: Thu 04 Sep, 2014 7:03 am
- Contact:
Re: [current revisions] ATAPI/IDE handling bugs
I too can't wait for the repository to come back online.
Re: [current revisions] ATAPI/IDE handling bugs
That sounds great, thanks!TomWalker wrote:Got a fix for the reset issue. Just waiting for the repo to come back online.
Yes, the following error messages appear:Battler wrote:- FredPJ: That happens with any DOS CD driver. It will freeze for a long while, and then I think claim no drive has been detected.
Error: No CD-ROM drives detected al all.
Error: Device driver aborts loading.
It also happens with an empty physical drive. The driver will fail to load and not enable the CD-ROM drive in DOS or Windows 3.11.
So you mean that it's a known bug? Shouldn't it be reporting a drive with no disc in it instead of a no drive at all?
Re: [current revisions] ATAPI/IDE handling bugs
- FredPJ: Yes, it's known bug in PCem. On real hardware but also in other emulators and virtualizers, when the CD-ROM drive is empty, the driver will still detect it normally.
- ppgrainbow
- Posts: 479
- Joined: Thu 04 Sep, 2014 7:03 am
- Contact:
Re: [current revisions] ATAPI/IDE handling bugs
Is the patch available for the reset issue especially since the repository isn't going to come back online?