Fix PiSCSI LUN/address things, maybe.

This commit is contained in:
beeanyew
2021-07-09 15:53:06 +02:00
parent 64bf0169b0
commit fc8f293732
4 changed files with 10 additions and 12 deletions

View File

@@ -121,7 +121,7 @@ static struct Library __attribute__((used)) *init_device(uint8_t *seg_list asm("
dev_base->units[i].present = r;
dev_base->units[i].valid = r;
dev_base->units[i].unit_num = i;
dev_base->units[i].scsi_num = i * 10;
dev_base->units[i].scsi_num = i;
if (dev_base->units[i].present) {
READLONG(PISCSI_CMD_CYLS, dev_base->units[i].c);
READSHORT(PISCSI_CMD_HEADS, dev_base->units[i].h);
@@ -150,13 +150,13 @@ static uint8_t* __attribute__((used)) expunge(struct Library *dev asm("a6"))
static void __attribute__((used)) open(struct Library *dev asm("a6"), struct IOExtTD *iotd asm("a1"), uint32_t num asm("d0"), uint32_t flags asm("d1"))
{
//struct Node* node = (struct Node*)iotd;
int io_err = IOERR_OPENFAIL;
int io_err = TDERR_BadUnitNum;
//WRITESHORT(PISCSI_CMD_DEBUGME, 1);
int unit_num = 0;
WRITELONG(PISCSI_CMD_DRVNUM, num);
READLONG(PISCSI_CMD_DRVNUM, unit_num);
int unit_num = num;
//WRITELONG(PISCSI_CMD_DRVNUM, num);
//READLONG(PISCSI_CMD_DRVNUM, unit_num);
debugval(PISCSI_DBG_VAL1, unit_num);
debugval(PISCSI_DBG_VAL2, flags);

View File

@@ -165,7 +165,7 @@ next_partition:;
struct PartitionBlock *pb = (struct PartitionBlock *)block;
tmp = pb->pb_DriveName[0];
pb->pb_DriveName[tmp + 1] = 0x00;
DEBUG("[PISCSI] Partition %d: %s (%d)\n", cur_partition, pb->pb_DriveName + 1, pb->pb_DriveName[0]);
printf("[PISCSI] Partition %d: %s (%d)\n", cur_partition, pb->pb_DriveName + 1, pb->pb_DriveName[0]);
DEBUG("Checksum: %.8X HostID: %d\n", BE(pb->pb_ChkSum), BE(pb->pb_HostID));
DEBUG("Flags: %d (%.8X) Devflags: %d (%.8X)\n", BE(pb->pb_Flags), BE(pb->pb_Flags), BE(pb->pb_DevFlags), BE(pb->pb_DevFlags));
d->pb[cur_partition] = pb;
@@ -702,13 +702,11 @@ void handle_piscsi_write(uint32_t addr, uint32_t val, uint8_t type) {
break;
}
case PISCSI_CMD_DRVNUM:
if (val % 10 != 0) {
if (val > 6) {
piscsi_cur_drive = 255;
}
else
piscsi_cur_drive = val / 10;
if (piscsi_cur_drive > NUM_UNITS) {
piscsi_cur_drive = 255;
else {
piscsi_cur_drive = val;
}
if (piscsi_cur_drive != 255) {
DEBUG("[PISCSI] (%s) Drive number set to %d (%d)\n", op_type_names[type], piscsi_cur_drive, val);
@@ -760,7 +758,7 @@ void handle_piscsi_write(uint32_t addr, uint32_t val, uint8_t type) {
p_offs += 0x20;
PUTNODELONG(addr2 + cfg->map_offset[r]);
PUTNODELONG(data_addr + cfg->map_offset[r]);
PUTNODELONG((i * 10));
PUTNODELONG(i);
PUTNODELONG(0);
uint32_t nodesize = (be32toh(devs[i].pb[j]->pb_Environment[0]) + 1) * 4;
memcpy(dst_data + p_offs, devs[i].pb[j]->pb_Environment, nodesize);

Binary file not shown.