Fixed XHDI, call to XHReadWrite() was commented out... now it can read :)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23615 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
960f8f2430
commit
3bf72d1955
@ -15,7 +15,7 @@
|
||||
#include "Handle.h"
|
||||
#include "toscalls.h"
|
||||
|
||||
//#define TRACE_DEVICES
|
||||
#define TRACE_DEVICES
|
||||
#ifdef TRACE_DEVICES
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
@ -435,6 +435,7 @@ add_block_devices(NodeList *devicesList, bool identifierMissing)
|
||||
uint16 major;
|
||||
uint16 minor;
|
||||
uint32 blocksize;
|
||||
uint32 blocksize2;
|
||||
uint32 blocks;
|
||||
uint32 devflags;
|
||||
uint32 lastacc;
|
||||
@ -470,6 +471,7 @@ add_block_devices(NodeList *devicesList, bool identifierMissing)
|
||||
|
||||
product[0] = '\0';
|
||||
blocksize = 0;
|
||||
blocksize2 = 0;
|
||||
#if 0
|
||||
err = XHLastAccess(major, minor, &lastacc);
|
||||
if (err < 0) {
|
||||
@ -484,12 +486,17 @@ add_block_devices(NodeList *devicesList, bool identifierMissing)
|
||||
dprintf("XHInqTarget(%d,%d) error %d\n", major, minor, err);
|
||||
continue;
|
||||
}
|
||||
err = XHGetCapacity(major, minor, &blocks, &blocksize);
|
||||
err = XHGetCapacity(major, minor, &blocks, &blocksize2);
|
||||
if (err < 0) {
|
||||
//dprintf("XHGetCapacity(%d,%d) error %d\n", major, minor, err);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (blocksize == 0) {
|
||||
dprintf("XHDI: blocksize for (%d,%d) is 0!\n", major, minor);
|
||||
}
|
||||
//dprintf("XHDI: (%d,%d) blocksize1 %ld blocksize2 %ld\n", major, minor, blocksize, blocksize2);
|
||||
|
||||
dprintf("XHDI(%d,%d): blksize %d, blocks %d, flags 0x%08lx, '%s'\n", major, minor, blocksize, blocks, devflags, product);
|
||||
driveID = (uint8)major;
|
||||
|
||||
@ -557,7 +564,7 @@ add_block_devices(NodeList *devicesList, bool identifierMissing)
|
||||
BlockHandle::BlockHandle(int handle)
|
||||
: Handle(handle)
|
||||
{
|
||||
TRACE(("drive ID %u\n", fHandle));
|
||||
TRACE(("BlockHandle::%s(): drive ID %u\n", __FUNCTION__, fHandle));
|
||||
}
|
||||
|
||||
|
||||
@ -572,6 +579,7 @@ BlockHandle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
|
||||
ssize_t ret;
|
||||
uint32 offset = pos % fBlockSize;
|
||||
pos /= fBlockSize;
|
||||
TRACE(("BlockHandle::%s: (%d) %Ld, %d\n", __FUNCTION__, fHandle, pos, bufferSize));
|
||||
|
||||
uint32 blocksLeft = (bufferSize + offset + fBlockSize - 1) / fBlockSize;
|
||||
int32 totalBytesRead = 0;
|
||||
@ -653,6 +661,8 @@ BlockHandle::FillIdentifier()
|
||||
BIOSDrive::BIOSDrive(int handle)
|
||||
: BlockHandle(handle)
|
||||
{
|
||||
TRACE(("BIOSDrive::%s(%d)\n", __FUNCTION__, fHandle));
|
||||
|
||||
/* first check if the drive exists */
|
||||
/* note floppy B can be reported present anyway... */
|
||||
uint32 map = Drvmap();
|
||||
@ -715,6 +725,7 @@ BIOSDrive::~BIOSDrive()
|
||||
status_t
|
||||
BIOSDrive::FillIdentifier()
|
||||
{
|
||||
TRACE(("BIOSDrive::%s: (%d)\n", __FUNCTION__, fHandle));
|
||||
#if 0
|
||||
if (HasParameters()) {
|
||||
// try all drive_parameters versions, beginning from the most informative
|
||||
@ -758,6 +769,7 @@ BIOSDrive::ReadBlocks(void *buffer, off_t first, int32 count)
|
||||
{
|
||||
int sectorsPerBlocks = (fBlockSize / 256);
|
||||
int32 ret;
|
||||
TRACE(("BIOSDrive::%s(%Ld,%ld) (%d)\n", __FUNCTION__, first, count, fHandle));
|
||||
// XXX: check for AHDI 3.0 before using long recno!!!
|
||||
ret = Rwabs(RW_READ | RW_NOTRANSLATE, buffer, sectorsPerBlocks, -1, fHandle, first * sectorsPerBlocks);
|
||||
if (ret < 0)
|
||||
@ -780,19 +792,25 @@ XHDIDrive::XHDIDrive(int handle, uint16 major, uint16 minor)
|
||||
int32 err;
|
||||
uint32 devflags;
|
||||
uint32 blocks;
|
||||
uint32 blocksize;
|
||||
char product[33];
|
||||
|
||||
fMajor = major;
|
||||
fMinor = minor;
|
||||
TRACE(("XHDIDrive::%s(%d, %d,%d)\n", __FUNCTION__, handle, fMajor, fMinor));
|
||||
|
||||
product[32] = '\0';
|
||||
err = XHInqTarget(major, minor, &fBlockSize, &devflags, product);
|
||||
if (err < 0)
|
||||
return;
|
||||
//XXX: check size
|
||||
err = XHGetCapacity(major, minor, &blocks, &fBlockSize);
|
||||
err = XHGetCapacity(major, minor, &blocks, &blocksize);
|
||||
if (err < 0)
|
||||
return;
|
||||
|
||||
if (fBlockSize == 0)
|
||||
fBlockSize = 512;
|
||||
|
||||
fSize = blocks * fBlockSize;
|
||||
fHasParameters = false;
|
||||
#if 0
|
||||
@ -849,6 +867,7 @@ XHDIDrive::~XHDIDrive()
|
||||
status_t
|
||||
XHDIDrive::FillIdentifier()
|
||||
{
|
||||
TRACE(("XHDIDrive::%s: (%d,%d)\n", __FUNCTION__, fMajor, fMinor));
|
||||
|
||||
fIdentifier.bus_type = UNKNOWN_BUS;
|
||||
fIdentifier.device_type = UNKNOWN_DEVICE;
|
||||
@ -877,9 +896,19 @@ XHDIDrive::ReadBlocks(void *buffer, off_t first, int32 count)
|
||||
int sectorsPerBlocks = (fBlockSize / 256);
|
||||
int32 ret;
|
||||
uint16 flags = RW_READ;
|
||||
//ret = XHReadWrite(fMajor, fMinor, flags, buffer, (uint32)first, (uint16)count, buffer);
|
||||
TRACE(("XHDIDrive::%s(%Ld, %d) (%d,%d)\n", __FUNCTION__, first, count, fMajor, fMinor));
|
||||
ret = XHReadWrite(fMajor, fMinor, flags, (uint32)first, (uint16)count, buffer);
|
||||
if (ret < 0)
|
||||
return toserror(ret);
|
||||
//TRACE(("XHReadWrite: %ld\n", ret));
|
||||
/*
|
||||
uint8 *b = (uint8 *)buffer;
|
||||
int i = 0;
|
||||
for (i = 0; i < 512; i+=8) {
|
||||
TRACE(("[%ld] %02x %02x %02x %02x %02x %02x %02x %02x\n", i, b[i], b[i+1], b[i+2], b[i+3], b[i+4], b[i+5], b[i+6], b[i+7]));
|
||||
//break;
|
||||
}
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -369,6 +369,8 @@ extern void *gXHDIEntryPoint;
|
||||
|
||||
extern status_t init_xhdi(void);
|
||||
|
||||
/* movem should not needed, but just to be safe. */
|
||||
|
||||
/* void (no) arg */
|
||||
#define xhdicallV(callnr) \
|
||||
({ \
|
||||
@ -376,9 +378,11 @@ extern status_t init_xhdi(void);
|
||||
\
|
||||
__asm__ volatile \
|
||||
("/* xhdicall(" #callnr ") */\n" \
|
||||
" movem.l %%d3-%%d7/%%a3-%%a6,-(%%sp)\n" \
|
||||
" move.w %[calln],-(%%sp)\n" \
|
||||
" jbsr (%[entry])\n" \
|
||||
" add.l #2,%%sp\n" \
|
||||
" movem.l (%%sp)+,%%d3-%%d7/%%a3-%%a6\n" \
|
||||
: "=r"(retvalue) /* output */ \
|
||||
: /* input */ \
|
||||
[entry]"a"(gXHDIEntryPoint), \
|
||||
@ -395,10 +399,12 @@ extern status_t init_xhdi(void);
|
||||
\
|
||||
__asm__ volatile \
|
||||
("/* xhdicall(" #callnr ") */\n" \
|
||||
" movem.l %%d3-%%d7/%%a3-%%a6,-(%%sp)\n" \
|
||||
" move.w %1,-(%%sp) \n" \
|
||||
" move.w %[calln],-(%%sp)\n" \
|
||||
" jbsr (%[entry])\n" \
|
||||
" add.l #4,%%sp \n" \
|
||||
" movem.l (%%sp)+,%%d3-%%d7/%%a3-%%a6\n" \
|
||||
: "=r"(retvalue) /* output */ \
|
||||
: "r"(_p1), /* input */ \
|
||||
[entry]"a"(gXHDIEntryPoint), \
|
||||
@ -417,12 +423,14 @@ extern status_t init_xhdi(void);
|
||||
\
|
||||
__asm__ volatile \
|
||||
("/* xhdicall(" #callnr ") */\n" \
|
||||
" movem.l %%d3-%%d7/%%a3-%%a6,-(%%sp)\n" \
|
||||
" move.l %3,-(%%sp) \n" \
|
||||
" move.w %2,-(%%sp) \n" \
|
||||
" move.w %1,-(%%sp) \n" \
|
||||
" move.w %[calln],-(%%sp)\n" \
|
||||
" jbsr (%[entry])\n" \
|
||||
" add.l #10,%%sp \n" \
|
||||
" movem.l (%%sp)+,%%d3-%%d7/%%a3-%%a6\n" \
|
||||
: "=r"(retvalue) /* output */ \
|
||||
: "r"(_p1), "r"(_p2), \
|
||||
"r"(_p3), /* input */ \
|
||||
@ -443,6 +451,7 @@ extern status_t init_xhdi(void);
|
||||
\
|
||||
__asm__ volatile \
|
||||
("/* xhdicall(" #callnr ") */\n" \
|
||||
" movem.l %%d3-%%d7/%%a3-%%a6,-(%%sp)\n" \
|
||||
" move.l %4,-(%%sp) \n" \
|
||||
" move.l %3,-(%%sp) \n" \
|
||||
" move.w %2,-(%%sp) \n" \
|
||||
@ -450,6 +459,7 @@ extern status_t init_xhdi(void);
|
||||
" move.w %[calln],-(%%sp)\n" \
|
||||
" jbsr (%[entry])\n" \
|
||||
" add.l #14,%%sp \n" \
|
||||
" movem.l (%%sp)+,%%d3-%%d7/%%a3-%%a6\n" \
|
||||
: "=r"(retvalue) /* output */ \
|
||||
: "r"(_p1), "r"(_p2), \
|
||||
"r"(_p3), "r"(_p4), /* input */ \
|
||||
@ -471,6 +481,7 @@ extern status_t init_xhdi(void);
|
||||
\
|
||||
__asm__ volatile \
|
||||
("/* xhdicall(" #callnr ") */\n" \
|
||||
" movem.l %%d3-%%d7/%%a3-%%a6,-(%%sp)\n" \
|
||||
" move.l %5,-(%%sp) \n" \
|
||||
" move.l %4,-(%%sp) \n" \
|
||||
" move.l %3,-(%%sp) \n" \
|
||||
@ -479,6 +490,7 @@ extern status_t init_xhdi(void);
|
||||
" move.w %[calln],-(%%sp)\n" \
|
||||
" jbsr (%[entry])\n" \
|
||||
" add.l #18,%%sp \n" \
|
||||
" movem.l (%%sp)+,%%d3-%%d7/%%a3-%%a6\n" \
|
||||
: "=r"(retvalue) /* output */ \
|
||||
: "r"(_p1), "r"(_p2), \
|
||||
"r"(_p3), "r"(_p4), \
|
||||
@ -501,6 +513,7 @@ extern status_t init_xhdi(void);
|
||||
\
|
||||
__asm__ volatile \
|
||||
("/* xhdicall(" #callnr ") */\n" \
|
||||
" movem.l %%d3-%%d7/%%a3-%%a6,-(%%sp)\n" \
|
||||
" move.l %5,-(%%sp) \n" \
|
||||
" move.l %4,-(%%sp) \n" \
|
||||
" move.l %3,-(%%sp) \n" \
|
||||
@ -509,6 +522,7 @@ extern status_t init_xhdi(void);
|
||||
" move.w %[calln],-(%%sp)\n" \
|
||||
" jbsr (%[entry])\n" \
|
||||
" add.l #20,%%sp \n" \
|
||||
" movem.l (%%sp)+,%%d3-%%d7/%%a3-%%a6\n" \
|
||||
: "=r"(retvalue) /* output */ \
|
||||
: "r"(_p1), "r"(_p2), \
|
||||
"r"(_p3), "r"(_p4), \
|
||||
@ -532,6 +546,7 @@ extern status_t init_xhdi(void);
|
||||
\
|
||||
__asm__ volatile \
|
||||
("/* xhdicall(" #callnr ") */\n" \
|
||||
" movem.l %%d3-%%d7/%%a3-%%a6,-(%%sp)\n" \
|
||||
" move.l %6,-(%%sp) \n" \
|
||||
" move.w %5,-(%%sp) \n" \
|
||||
" move.l %4,-(%%sp) \n" \
|
||||
@ -541,6 +556,7 @@ extern status_t init_xhdi(void);
|
||||
" move.w %[calln],-(%%sp)\n" \
|
||||
" jbsr (%[entry])\n" \
|
||||
" add.l #18,%%sp \n" \
|
||||
" movem.l (%%sp)+,%%d3-%%d7/%%a3-%%a6\n" \
|
||||
: "=r"(retvalue) /* output */ \
|
||||
: "r"(_p1), "r"(_p2), \
|
||||
"r"(_p3), "r"(_p4), \
|
||||
@ -553,18 +569,20 @@ extern status_t init_xhdi(void);
|
||||
})
|
||||
|
||||
#define xhdicallWWP(callnr, p1, p2, p3) \
|
||||
xhdicallWWL(callnr, p1, p2, (int32)p3)
|
||||
xhdicallWWL(callnr, p1, p2, (int32)(p3))
|
||||
#define xhdicallWWPP(callnr, p1, p2, p3, p4) \
|
||||
xhdicallWWLL(callnr, p1, p2, (int32)p3, (int32)p4)
|
||||
xhdicallWWLL(callnr, p1, p2, (int32)(p3), (int32)(p4))
|
||||
#define xhdicallWWPPP(callnr, p1, p2, p3, p4, p5) \
|
||||
xhdicallWWLLL(callnr, p1, p2, (int32)p3, (int32)p4, (int32)p5)
|
||||
xhdicallWWLLL(callnr, p1, p2, (int32)(p3), (int32)(p4), (int32)(p5))
|
||||
#define xhdicallWPPPP(callnr, p1, p2, p3, p4, p5) \
|
||||
xhdicallWLLLL(callnr, p1, (uint32)p2, (int32)p3, (int32)p4, (int32)p5)
|
||||
xhdicallWLLLL(callnr, p1, (uint32)(p2), (int32)(p3), (int32)(p4), (int32)(p5))
|
||||
#define xhdicallWWWLWP(callnr, p1, p2, p3, p4, p5, p6) \
|
||||
xhdicallWWWLWL(callnr, p1, p2, p3, (uint32)(p4), p5, (uint32)(p6))
|
||||
#define xhdicallWWWPWP(callnr, p1, p2, p3, p4, p5, p6) \
|
||||
xhdicallWWWLWL(callnr, p1, p2, p3, (int32)p4, p5, (uint32)p6)
|
||||
xhdicallWWWLWL(callnr, p1, p2, p3, (int32)(p4), p5, (uint32)(p6))
|
||||
|
||||
#define XHGetVersion() (uint16)xhdicallV(0)
|
||||
#define XHInqTarget(major, minor, bsize, flags, pname) xhdicallWWPPP(1, (uint16)major, (uint16)minor, (uint32 *)bsize, (uint32 *)flags, (char *)pname)
|
||||
#define XHInqTarget(major, minor, blocksize, flags, pname) xhdicallWWPPP(1, (uint16)major, (uint16)minor, (uint32 *)(blocksize), (uint32 *)flags, (char *)pname)
|
||||
//XHReserve 2
|
||||
//#define XHLock() 3
|
||||
//#define XHStop() 4
|
||||
@ -573,7 +591,7 @@ extern status_t init_xhdi(void);
|
||||
#define XHInqDev(dev,major,minor,startsect,bpb) xhdicallWPPPP(7,dev,(uint16 *)major,(uint16 *)minor,(uint32 *)startsect,(struct tos_bpb *)bpb)
|
||||
//XHInqDriver 8
|
||||
//XHNewCookie 9
|
||||
#define XHReadWrite(major, minor, rwflags, recno, count, buf) xhdicalWWWLWP(10, (uint16)major, (uint16)minor, (uint16)rwflags, (uint32)recno, (uint16)count, (void *)buf)
|
||||
#define XHReadWrite(major, minor, rwflags, recno, count, buf) xhdicallWWWLWP(10, (uint16)major, (uint16)minor, (uint16)rwflags, (uint32)recno, (uint16)count, (void *)buf)
|
||||
#define XHInqTarget2(major, minor, bsize, flags, pname, pnlen) xhdicallWWPPPW(11, (uint16)major, (uint16)minor, (uint32 *)bsize, (uint32 *)flags, (char *)pname, (uint16)pnlen)
|
||||
//XHInqDev2 12
|
||||
//XHDriverSpecial 13
|
||||
|
Loading…
Reference in New Issue
Block a user