The head and sector numbers passed to the SCSI BIOS command handler are now correctly masked for the appropriate number of bits.

This commit is contained in:
OBattler
2017-08-26 07:21:33 +02:00
parent 5b02d3a90b
commit 86ff061f23
3 changed files with 9 additions and 10 deletions

View File

@@ -320,7 +320,7 @@ typedef struct
} BIOSCMD; } BIOSCMD;
#pragma pack(pop) #pragma pack(pop)
extern uint8_t HACommand03Handler(uint8_t last_id, uint8_t max_heads, BIOSCMD *BiosCmd); extern uint8_t HACommand03Handler(uint8_t last_id, BIOSCMD *BiosCmd);
/* /*

View File

@@ -1180,6 +1180,8 @@ aha_0x01:
temp = BiosCmd->id; temp = BiosCmd->id;
BiosCmd->id = BiosCmd->lun; BiosCmd->id = BiosCmd->lun;
BiosCmd->lun = temp; BiosCmd->lun = temp;
BiosCmd->head &= 0xf;
BiosCmd->sector &= 0x1f;
pclog("C: %04X, H: %02X, S: %02X\n", BiosCmd->cylinder, BiosCmd->head, BiosCmd->sector); pclog("C: %04X, H: %02X, S: %02X\n", BiosCmd->cylinder, BiosCmd->head, BiosCmd->sector);
dev->DataBuf[0] = HACommand03Handler(7, (dev->type == AHA_1640) ? 64 : 32, BiosCmd); dev->DataBuf[0] = HACommand03Handler(7, (dev->type == AHA_1640) ? 64 : 32, BiosCmd);
pclog("BIOS Completion/Status Code %x\n", dev->DataBuf[0]); pclog("BIOS Completion/Status Code %x\n", dev->DataBuf[0]);

View File

@@ -1421,7 +1421,7 @@ static void BuslogicIDCheck(uint8_t id, uint8_t lun)
} }
/* This returns the completion code. */ /* This returns the completion code. */
uint8_t HACommand03Handler(uint8_t last_id, uint8_t max_heads, BIOSCMD *BiosCmd) uint8_t HACommand03Handler(uint8_t last_id, BIOSCMD *BiosCmd)
{ {
uint32_t dma_address; uint32_t dma_address;
int lba = (BiosCmd->cylinder << 9) + (BiosCmd->head << 5) + BiosCmd->sector; int lba = (BiosCmd->cylinder << 9) + (BiosCmd->head << 5) + BiosCmd->sector;
@@ -1430,11 +1430,6 @@ uint8_t HACommand03Handler(uint8_t last_id, uint8_t max_heads, BIOSCMD *BiosCmd)
uint8_t ret = 0; uint8_t ret = 0;
uint8_t cdb[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; uint8_t cdb[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
if (max_heads == 64)
{
lba = (BiosCmd->cylinder << 11) + (BiosCmd->head << 5) + BiosCmd->sector;
}
SpecificLog("BIOS Command = 0x%02X\n", BiosCmd->command); SpecificLog("BIOS Command = 0x%02X\n", BiosCmd->command);
if ((BiosCmd->id > last_id) || (BiosCmd->lun > 7)) { if ((BiosCmd->id > last_id) || (BiosCmd->lun > 7)) {
@@ -1979,15 +1974,17 @@ BuslogicWrite(uint16_t Port, uint8_t Val, void *p)
BiosCmd->id = BiosCmd->lun; BiosCmd->id = BiosCmd->lun;
BiosCmd->lun = temp; BiosCmd->lun = temp;
} }
BiosCmd->head &= 0xf;
BiosCmd->sector &= 0x1f;
SpecificLog("C: %04X, H: %02X, S: %02X\n", BiosCmd->cylinder, BiosCmd->head, BiosCmd->sector); SpecificLog("C: %04X, H: %02X, S: %02X\n", BiosCmd->cylinder, BiosCmd->head, BiosCmd->sector);
bl->DataBuf[0] = HACommand03Handler(15, (bl->chip == CHIP_BUSLOGIC_MCA) ? 64 : 32, BiosCmd); bl->DataBuf[0] = HACommand03Handler(15, BiosCmd);
SpecificLog("BIOS Completion/Status Code %x\n", bl->DataBuf[0]); SpecificLog("BIOS Completion/Status Code %x\n", bl->DataBuf[0]);
bl->DataReplyLeft = 1; bl->DataReplyLeft = 1;
break; break;
case 0x04: case 0x04:
pclog("Inquire Board\n"); pclog("Inquire Board\n");
bl->DataBuf[0] = 0x41; bl->DataBuf[0] = (bl->chip == CHIP_BUSLOGIC_MCA) ? 0x42 : 0x41;
bl->DataBuf[1] = 0x41; bl->DataBuf[1] = 0x41;
bl->DataBuf[2] = (bl->chip == CHIP_BUSLOGIC_PCI) ? '5' : '2'; bl->DataBuf[2] = (bl->chip == CHIP_BUSLOGIC_PCI) ? '5' : '2';
bl->DataBuf[3] = (bl->chip == CHIP_BUSLOGIC_PCI) ? '0' : '2'; bl->DataBuf[3] = (bl->chip == CHIP_BUSLOGIC_PCI) ? '0' : '2';