mirror of
https://github.com/captain-amygdala/pistorm.git
synced 2026-02-11 10:34:45 +00:00
Add TD_GETGEOMETRY support to PiSCSI driver
This lets for instance giggledisk properly grab the geometry for drives with no valid RDB, allowing for easier mounting of non-Amiga friendly disks.
This commit is contained in:
@@ -1 +1 @@
|
||||
m68k-amigaos-gcc piscsi-amiga-2.c -m68020 -O2 -o pi-scsi.device -m68000 -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer -nostdlib -nostartfiles
|
||||
m68k-amigaos-gcc piscsi-amiga-2.c -m68020 -O2 -o pi-scsi.device -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer -nostdlib -nostartfiles
|
||||
|
||||
Binary file not shown.
@@ -93,6 +93,9 @@ uint8_t piscsi_perform_io(struct piscsi_unit *u, struct IORequest *io);
|
||||
uint8_t piscsi_rw(struct piscsi_unit *u, struct IORequest *io);
|
||||
uint8_t piscsi_scsi(struct piscsi_unit *u, struct IORequest *io);
|
||||
|
||||
//#define uint32_t unsigned int
|
||||
//#define uint16_t unsigned short
|
||||
|
||||
#define debug(...)
|
||||
#define debugval(...)
|
||||
//#define debug(c, v) WRITESHORT(c, v)
|
||||
@@ -559,6 +562,7 @@ uint16_t ns_support[] = {
|
||||
};
|
||||
|
||||
#define DUMMYCMD iostd->io_Actual = 0; break;
|
||||
|
||||
uint8_t piscsi_perform_io(struct piscsi_unit *u, struct IORequest *io) {
|
||||
struct IOStdReq *iostd = (struct IOStdReq *)io;
|
||||
struct IOExtTD *iotd = (struct IOExtTD *)io;
|
||||
@@ -566,7 +570,6 @@ uint8_t piscsi_perform_io(struct piscsi_unit *u, struct IORequest *io) {
|
||||
//uint8_t *data;
|
||||
//uint32_t len;
|
||||
//uint32_t offset;
|
||||
//struct DriveGeometry *geom;
|
||||
uint8_t err = 0;
|
||||
|
||||
if (!u->enabled) {
|
||||
@@ -589,7 +592,7 @@ uint8_t piscsi_perform_io(struct piscsi_unit *u, struct IORequest *io) {
|
||||
case NSCMD_DEVICEQUERY: {
|
||||
struct NSDeviceQueryResult *res = (struct NSDeviceQueryResult *)iotd->iotd_Req.io_Data;
|
||||
res->DevQueryFormat = 0;
|
||||
res->SizeAvailable = 16;;
|
||||
res->SizeAvailable = 16;
|
||||
res->DeviceType = NSDEVTYPE_TRACKDISK;
|
||||
res->DeviceSubType = 0;
|
||||
res->SupportedCommands = ns_support;
|
||||
@@ -620,6 +623,22 @@ uint8_t piscsi_perform_io(struct piscsi_unit *u, struct IORequest *io) {
|
||||
iostd->io_Actual = u->motor;
|
||||
u->motor = iostd->io_Length ? 1 : 0;
|
||||
break;
|
||||
case TD_GETGEOMETRY: {
|
||||
struct DriveGeometry *res = (struct DriveGeometry *)iostd->io_Data;
|
||||
WRITESHORT(PISCSI_CMD_DRVNUMX, u->unit_num);
|
||||
READLONG(PISCSI_CMD_BLOCKSIZE, res->dg_SectorSize);
|
||||
READLONG(PISCSI_CMD_BLOCKS, res->dg_TotalSectors);
|
||||
res->dg_Cylinders = u->c;
|
||||
res->dg_CylSectors = u->s * u->h;
|
||||
res->dg_Heads = u->h;
|
||||
res->dg_TrackSectors = u->s;
|
||||
res->dg_BufMemType = MEMF_PUBLIC;
|
||||
res->dg_DeviceType = 0;
|
||||
res->dg_Flags = 0;
|
||||
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case TD_FORMAT:
|
||||
case TD_FORMAT64:
|
||||
|
||||
@@ -953,7 +953,7 @@ uint32_t handle_piscsi_read(uint32_t addr, uint8_t type) {
|
||||
uint32_t val = piscsi_u32[1];
|
||||
int32_t r = get_mapped_item_by_address(cfg, val);
|
||||
if (r != -1) {
|
||||
#ifdef DEBUG_PISCSI
|
||||
#ifdef PISCSI_DEBUG
|
||||
uint32_t addr = val - cfg->map_offset[r];
|
||||
char *dosID = (char *)&rom_partition_dostype[rom_cur_partition];
|
||||
DEBUG("[PISCSI-GET-FS-INFO] Partition DOSType is %c%c%c/%d\n", dosID[0], dosID[1], dosID[2], dosID[3]);
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user