* Fix natfeat debugprintf, it actually works now.
* XHDI fixes, unfinished. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23593 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -125,8 +125,13 @@ class BlockHandle : public Handle {
|
||||
bool HasParameters() const { return fHasParameters; }
|
||||
const drive_parameters &Parameters() const { return fParameters; }
|
||||
|
||||
virtual status_t FillIdentifier();
|
||||
|
||||
disk_identifier &Identifier() { return fIdentifier; }
|
||||
uint8 DriveID() const { return fHandle; }
|
||||
status_t InitCheck() const { return fSize > 0 ? B_OK : B_ERROR; };
|
||||
|
||||
|
||||
|
||||
virtual ssize_t ReadBlocks(void *buffer, off_t first, int32 count);
|
||||
|
||||
@@ -478,13 +483,6 @@ BlockHandle::~BlockHandle()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BlockHandle::InitCheck() const
|
||||
{
|
||||
return fSize > 0 ? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
BlockHandle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
|
||||
{
|
||||
@@ -500,9 +498,9 @@ BlockHandle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
|
||||
|
||||
// read partial block
|
||||
if (offset) {
|
||||
ret = Rwabs(RW_READ | RW_NOTRANSLATE, gScratchBuffer, fBlockSize/256, -1, fHandle, pos * fBlockSize/256);
|
||||
ret = ReadBlocks(gScratchBuffer, pos, 1);
|
||||
if (ret < 0)
|
||||
return toserror(ret);
|
||||
return ret;
|
||||
totalBytesRead += fBlockSize - offset;
|
||||
memcpy(buffer, gScratchBuffer + offset, totalBytesRead);
|
||||
|
||||
@@ -552,11 +550,11 @@ BlockHandle::ReadBlocks(void *buffer, off_t first, int32 count)
|
||||
}
|
||||
|
||||
|
||||
/*status_t
|
||||
status_t
|
||||
BlockHandle::FillIdentifier()
|
||||
{
|
||||
return B_NOT_ALLOWED;
|
||||
}*/
|
||||
}
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
@@ -631,69 +629,6 @@ BIOSDrive::~BIOSDrive()
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
BIOSDrive::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
|
||||
{
|
||||
int32 ret;
|
||||
int sectorsPerBlocks = (fBlockSize / 256);
|
||||
uint32 offset = pos % fBlockSize;
|
||||
pos /= fBlockSize;
|
||||
|
||||
uint32 blocksLeft = (bufferSize + offset + fBlockSize - 1) / fBlockSize;
|
||||
int32 totalBytesRead = 0;
|
||||
|
||||
//TRACE(("BIOS reads %lu bytes from %Ld (offset = %lu), drive %u\n",
|
||||
// blocksLeft * fBlockSize, pos * fBlockSize, offset, fDriveID));
|
||||
|
||||
// read partial block
|
||||
if (offset) {
|
||||
ret = Rwabs(RW_READ | RW_NOTRANSLATE, gScratchBuffer, fBlockSize/256, -1, fHandle, pos * fBlockSize/256);
|
||||
if (ret < 0)
|
||||
return toserror(ret);
|
||||
totalBytesRead += fBlockSize - offset;
|
||||
memcpy(buffer, gScratchBuffer + offset, totalBytesRead);
|
||||
|
||||
}
|
||||
|
||||
uint32 scratchSize = SCRATCH_SIZE / fBlockSize;
|
||||
|
||||
while (blocksLeft > 0) {
|
||||
uint32 blocksRead = blocksLeft;
|
||||
if (blocksRead > scratchSize)
|
||||
blocksRead = scratchSize;
|
||||
|
||||
int32 ret;
|
||||
// XXX: check for AHDI 3.0 before using long recno!!!
|
||||
ret = Rwabs(RW_READ | RW_NOTRANSLATE, gScratchBuffer, blocksRead * sectorsPerBlocks, -1, fHandle, pos * sectorsPerBlocks);
|
||||
if (ret < 0)
|
||||
return toserror(ret);
|
||||
|
||||
uint32 bytesRead = fBlockSize * blocksRead - offset;
|
||||
// copy no more than bufferSize bytes
|
||||
if (bytesRead > bufferSize)
|
||||
bytesRead = bufferSize;
|
||||
|
||||
memcpy(buffer, (void *)(gScratchBuffer + offset), bytesRead);
|
||||
pos += blocksRead;
|
||||
offset = 0;
|
||||
blocksLeft -= blocksRead;
|
||||
bufferSize -= bytesRead;
|
||||
buffer = (void *)((addr_t)buffer + bytesRead);
|
||||
totalBytesRead += bytesRead;
|
||||
}
|
||||
|
||||
return totalBytesRead;
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
BIOSDrive::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize)
|
||||
{
|
||||
// we don't have to know how to write
|
||||
return B_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BIOSDrive::FillIdentifier()
|
||||
{
|
||||
@@ -837,7 +772,6 @@ XHDIDrive::FillIdentifier()
|
||||
fIdentifier.device.unknown.check_sums[i].offset = -1;
|
||||
fIdentifier.device.unknown.check_sums[i].sum = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -81,22 +81,6 @@ real_entry:
|
||||
bsr putx
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
//_membot
|
||||
//move.l #0x432,%a0
|
||||
//move.l (%a0),%d0
|
||||
//bsr putx
|
||||
|
||||
//_memtop
|
||||
//move.l #0x436,%a0
|
||||
//move.l (%a0),%d0
|
||||
//bsr putx
|
||||
|
||||
//_v_bas_ad
|
||||
move.l #0x44e,%a0
|
||||
move.l (%a0),%d0
|
||||
bsr putx
|
||||
#endif
|
||||
|
||||
// first, determine if .prg (user) or bootsect (super)
|
||||
// Super()
|
||||
@@ -125,9 +109,12 @@ floppy_start:
|
||||
lea str,%a0
|
||||
bsr puts
|
||||
//bra floppy_start
|
||||
|
||||
// no interrupt
|
||||
or.w #0x0700,%sr
|
||||
|
||||
//XXX: check for enough RAM
|
||||
|
||||
// load the rest
|
||||
move.w sNumSectors,%d2
|
||||
// load at base + this code.
|
||||
@@ -220,8 +207,24 @@ prg_start:
|
||||
addq.l #6,%sp
|
||||
move.l %d0,saved_super_stack
|
||||
|
||||
#if 1
|
||||
//_membot
|
||||
move.l #0x432,%a0
|
||||
move.l (%a0),%d0
|
||||
bsr putx
|
||||
|
||||
//_memtop
|
||||
move.l #0x436,%a0
|
||||
move.l (%a0),%d0
|
||||
bsr putx
|
||||
|
||||
//_v_bas_ad
|
||||
move.l #0x44e,%a0
|
||||
move.l (%a0),%d0
|
||||
bsr putx
|
||||
#endif
|
||||
// disable interrupts
|
||||
or.w #0x0700,%sr
|
||||
//or.w #0x0700,%sr
|
||||
|
||||
lea h5,%a0
|
||||
bsr puts
|
||||
|
||||
@@ -108,14 +108,17 @@ void
|
||||
_start(void)
|
||||
{
|
||||
stage2_args args;
|
||||
Bconout(DEV_CON, 'H');
|
||||
|
||||
|
||||
//asm("cld"); // Ain't nothing but a GCC thang.
|
||||
//asm("fninit"); // initialize floating point unit
|
||||
|
||||
clear_bss();
|
||||
Bconout(DEV_CON, 'A');
|
||||
call_ctors();
|
||||
// call C++ constructors before doing anything else
|
||||
Bconout(DEV_CON, 'I');
|
||||
|
||||
args.heap_size = HEAP_SIZE;
|
||||
|
||||
@@ -124,7 +127,9 @@ _start(void)
|
||||
|
||||
//serial_init();
|
||||
console_init();
|
||||
Bconout(DEV_CON, 'K');
|
||||
cpu_init();
|
||||
Bconout(DEV_CON, 'U');
|
||||
//mmu_init();
|
||||
|
||||
// wait a bit to give the user the opportunity to press a key
|
||||
|
||||
@@ -119,7 +119,7 @@ xhdierror(int32 err)
|
||||
if (ide & (1 << 1)) { // track 0 not found
|
||||
return B_DEV_FORMAT_ERROR;
|
||||
} else if (ide & (1 << 0)) { // DAM not found
|
||||
return B_DEV_FORMAT_ERROR,;
|
||||
return B_DEV_FORMAT_ERROR;
|
||||
} else if (ide & (1 << 4)) { // ID field not found
|
||||
return B_DEV_ID_ERROR;
|
||||
} else if (ide & (1 << 7)) { // bad block mark
|
||||
@@ -160,11 +160,11 @@ xhdierror(int32 err)
|
||||
return toserror(err);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dump_tos_cookie(const struct tos_cookie *c)
|
||||
{
|
||||
if (c)
|
||||
dprintf("%4.4s: 0x%08lx, %d\n", &c->cookie, c->ivalue, c->ivalue);
|
||||
dprintf("%4.4s: 0x%08lx, %ld\n", (const char *)&c->cookie, c->ivalue, c->ivalue);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,14 @@ dump_tos_cookies(void)
|
||||
status_t
|
||||
init_xhdi(void)
|
||||
{
|
||||
|
||||
struct tos_cookie *c;
|
||||
c = tos_find_cookie(XHDI_COOKIE);
|
||||
if (!c)
|
||||
return ENOENT;
|
||||
if (((uint32 *)c->pvalue)[-1] != XHDI_MAGIC)
|
||||
return EINVAL;
|
||||
gXHDIEntryPoint = c->pvalue;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -366,6 +366,8 @@ static inline int Bconputs(int16 handle, const char *string)
|
||||
/* pointer to the XHDI dispatch function */
|
||||
extern void *gXHDIEntryPoint;
|
||||
|
||||
extern status_t init_xhdi(void);
|
||||
|
||||
/* void (no) arg */
|
||||
#define xhdicallV(callnr) \
|
||||
({ \
|
||||
@@ -541,11 +543,10 @@ static inline int32 nat_feat_getid(const char *name)
|
||||
|
||||
#define nat_feat_call(id, code, a...) \
|
||||
({ \
|
||||
int32 ret; \
|
||||
int32 ret = -1; \
|
||||
NatFeatCookie *c = nat_features(); \
|
||||
if (!c) \
|
||||
return -1; \
|
||||
ret = c->nfCall(id | code, a##...); \
|
||||
if (c) \
|
||||
ret = c->nfCall(id | code, a); \
|
||||
ret; \
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user