Patch by Sebastian:

Missing EDD fixes for cdrom code
This commit is contained in:
Stanislav Shwartsman 2010-09-25 07:21:25 +00:00
parent 8308a47168
commit 3994761b08

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: rombios.c,v 1.250 2010-08-07 06:58:10 sshwarts Exp $
// $Id: rombios.c,v 1.251 2010-09-25 07:21:25 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -869,7 +869,7 @@ Bit16u cdrom_boot();
#endif // BX_ELTORITO_BOOT
static char bios_cvs_version_string[] = "$Revision: 1.250 $ $Date: 2010-08-07 06:58:10 $";
static char bios_cvs_version_string[] = "$Revision: 1.251 $ $Date: 2010-09-25 07:21:25 $";
#define BIOS_COPYRIGHT_STRING "(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team."
@ -5820,17 +5820,20 @@ int13_cdrom_rme_end:
size = read_word(DS,SI+(Bit16u)&Int13Ext->size);
// Buffer is too small
if(size < 0x1a)
if(size < 26)
goto int13_fail;
// EDD 1.x
if(size >= 0x1a) {
if(size >= 26) {
Bit16u cylinders, heads, spt, blksize;
blksize = read_word(ebda_seg, &EbdaData->ata.devices[device].blksize);
write_word(DS, SI+(Bit16u)&Int13DPT->size, 0x1a);
write_word(DS, SI+(Bit16u)&Int13DPT->infos, 0x74); // removable, media change, lockable, max values
write_word(DS, SI+(Bit16u)&Int13DPT->size, 26);
write_word(DS, SI+(Bit16u)&Int13DPT->infos, 1 << 2 | /* removable */
1 << 4 | /* media change */
1 << 5 | /* lockable */
1 << 6); /* max values */
write_dword(DS, SI+(Bit16u)&Int13DPT->cylinders, 0xffffffff);
write_dword(DS, SI+(Bit16u)&Int13DPT->heads, 0xffffffff);
write_dword(DS, SI+(Bit16u)&Int13DPT->spt, 0xffffffff);
@ -5840,11 +5843,11 @@ int13_cdrom_rme_end:
}
// EDD 2.x
if(size >= 0x1e) {
if(size >= 30) {
Bit8u channel, dev, irq, mode, checksum, i;
Bit16u iobase1, iobase2, options;
write_word(DS, SI+(Bit16u)&Int13DPT->size, 0x1e);
write_word(DS, SI+(Bit16u)&Int13DPT->size, 30);
write_word(DS, SI+(Bit16u)&Int13DPT->dpte_segment, ebda_seg);
write_word(DS, SI+(Bit16u)&Int13DPT->dpte_offset, &EbdaData->ata.dpte);
@ -5876,12 +5879,12 @@ int13_cdrom_rme_end:
checksum=0;
for (i=0; i<15; i++) checksum+=read_byte(ebda_seg, ((Bit8u*)(&EbdaData->ata.dpte)) + i);
checksum = ~checksum;
checksum = -checksum;
write_byte(ebda_seg, &EbdaData->ata.dpte.checksum, checksum);
}
// EDD 3.x
if(size >= 0x42) {
if(size >= 66) {
Bit8u channel, iface, checksum, i;
Bit16u iobase1;
@ -5889,9 +5892,8 @@ int13_cdrom_rme_end:
iface = read_byte(ebda_seg, &EbdaData->ata.channels[channel].iface);
iobase1 = read_word(ebda_seg, &EbdaData->ata.channels[channel].iobase1);
write_word(DS, SI+(Bit16u)&Int13DPT->size, 0x42);
write_word(DS, SI+(Bit16u)&Int13DPT->key, 0xbedd);
write_byte(DS, SI+(Bit16u)&Int13DPT->dpi_length, 0x24);
write_byte(DS, SI+(Bit16u)&Int13DPT->dpi_length, 36);
write_byte(DS, SI+(Bit16u)&Int13DPT->reserved1, 0);
write_word(DS, SI+(Bit16u)&Int13DPT->reserved2, 0);
@ -5922,9 +5924,11 @@ int13_cdrom_rme_end:
write_word(DS, SI+(Bit16u)&Int13DPT->device_path[2], 0);
write_dword(DS, SI+(Bit16u)&Int13DPT->device_path[4], 0L);
write_byte(DS, SI+(Bit16u)&Int13DPT->reserved3, 0);
checksum=0;
for (i=30; i<64; i++) checksum+=read_byte(DS, SI + i);
checksum = ~checksum;
for (i=30; i<65; i++) checksum+=read_byte(DS, SI + i);
checksum = -checksum;
write_byte(DS, SI+(Bit16u)&Int13DPT->checksum, checksum);
}