* Added Dump() method to IORequest, IOOperation, IOBuffer, and DMABuffer.
* Added KDL commands "io_request", "io_operation", "io_buffer", and "dma_buffer". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26838 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "BaseDevice.h"
|
||||
#include "devfs_private.h"
|
||||
#include "id_generator.h"
|
||||
#include "io_requests.h"
|
||||
#include "io_resources.h"
|
||||
|
||||
|
||||
@@ -268,7 +269,63 @@ dump_attribute(device_attr* attr, int32 level)
|
||||
|
||||
|
||||
static int
|
||||
dump_device_nodes(int argc, char **argv)
|
||||
dump_io_request(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2 || !strcmp(argv[1], "--help")) {
|
||||
kprintf("usage: %s <ptr-to-io-request>\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
IORequest* request = (IORequest*)parse_expression(argv[1]);
|
||||
request->Dump();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dump_io_operation(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2 || !strcmp(argv[1], "--help")) {
|
||||
kprintf("usage: %s <ptr-to-io-operation>\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
IOOperation* operation = (IOOperation*)parse_expression(argv[1]);
|
||||
operation->Dump();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dump_io_buffer(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2 || !strcmp(argv[1], "--help")) {
|
||||
kprintf("usage: %s <ptr-to-io-buffer>\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
IOBuffer* buffer = (IOBuffer*)parse_expression(argv[1]);
|
||||
buffer->Dump();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dump_dma_buffer(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2 || !strcmp(argv[1], "--help")) {
|
||||
kprintf("usage: %s <ptr-to-dma-buffer>\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DMABuffer* buffer = (DMABuffer*)parse_expression(argv[1]);
|
||||
buffer->Dump();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dump_device_nodes(int argc, char** argv)
|
||||
{
|
||||
sRootNode->Dump();
|
||||
return 0;
|
||||
@@ -2160,10 +2217,16 @@ device_manager_init(struct kernel_args* args)
|
||||
sRootNode->Dump();
|
||||
#endif
|
||||
|
||||
add_debugger_command("dm_tree", &dump_device_nodes,
|
||||
"dump device node tree");
|
||||
register_generic_syscall(DEVICE_MANAGER_SYSCALLS, control_device_manager,
|
||||
1, 0);
|
||||
|
||||
add_debugger_command("dm_tree", &dump_device_nodes,
|
||||
"dump device node tree");
|
||||
add_debugger_command("io_request", &dump_io_request, "dump an I/O request");
|
||||
add_debugger_command("io_operation", &dump_io_operation,
|
||||
"dump an I/O operation");
|
||||
add_debugger_command("io_buffer", &dump_io_buffer, "dump an I/O buffer");
|
||||
add_debugger_command("dma_buffer", &dump_dma_buffer, "dump a DMA buffer");
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,22 @@ DMABuffer::UsesBounceBufferAt(uint32 index)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DMABuffer::Dump() const
|
||||
{
|
||||
kprintf("DMABuffer at %p\n", this);
|
||||
|
||||
kprintf(" bounce buffer: %p (physical %#lx)\n", fBounceBuffer,
|
||||
fPhysicalBounceBuffer);
|
||||
kprintf(" bounce buffer size: %lu\n", fBounceBufferSize);
|
||||
kprintf(" vecs: %lu\n", fVecCount);
|
||||
|
||||
for (uint32 i = 0; i < fVecCount; i++) {
|
||||
kprintf(" [%lu] %p, %lu\n", i, fVecs[i].iov_base, fVecs[i].iov_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ public:
|
||||
bool UsesBounceBufferAt(uint32 index);
|
||||
void SetToBounceBuffer(size_t length);
|
||||
|
||||
void Dump() const;
|
||||
|
||||
private:
|
||||
void* fBounceBuffer;
|
||||
addr_t fPhysicalBounceBuffer;
|
||||
|
||||
@@ -122,6 +122,23 @@ IOBuffer::UnlockMemory(team_id team, bool isWrite)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IOBuffer::Dump() const
|
||||
{
|
||||
kprintf("IOBuffer at %p\n", this);
|
||||
|
||||
kprintf(" origin: %s\n", fUser ? "user" : "kernel");
|
||||
kprintf(" kind: %s\n", fPhysical ? "physical" : "virtual");
|
||||
kprintf(" length: %lu\n", fLength);
|
||||
kprintf(" capacity: %lu\n", fCapacity);
|
||||
kprintf(" vecs: %lu\n", fVecCount);
|
||||
|
||||
for (uint32 i = 0; i < fVecCount; i++) {
|
||||
kprintf(" [%lu] %p, %lu\n", i, fVecs[i].iov_base, fVecs[i].iov_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
@@ -496,6 +513,35 @@ IOOperation::_CopyPartialEnd(bool isWrite)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IOOperation::Dump() const
|
||||
{
|
||||
kprintf("io_operation at %p\n", this);
|
||||
|
||||
kprintf(" parent: %p\n", fParent);
|
||||
kprintf(" status: %s\n", strerror(fStatus));
|
||||
kprintf(" dma buffer: %p\n", fDMABuffer);
|
||||
kprintf(" offset: %-8Ld (original: %Ld)\n", fOffset,
|
||||
fOriginalOffset);
|
||||
kprintf(" length: %-8lu (original: %lu)\n", fLength,
|
||||
fOriginalLength);
|
||||
kprintf(" transferred: %lu\n", fTransferredBytes);
|
||||
kprintf(" block size: %lu\n", fBlockSize);
|
||||
kprintf(" saved vec index: %u\n", fSavedVecIndex);
|
||||
kprintf(" saved vec length: %u\n", fSavedVecLength);
|
||||
kprintf(" r/w: %s\n", IsWrite() ? "write" : "read");
|
||||
kprintf(" phase: %s\n", fPhase == PHASE_READ_BEGIN
|
||||
? "read begin" : fPhase == PHASE_READ_END ? "read end"
|
||||
: fPhase == PHASE_DO_ALL ? "do all" : "unknown");
|
||||
kprintf(" partial begin: %s\n", fPartialBegin ? "yes" : "no");
|
||||
kprintf(" partial end: %s\n", fPartialEnd ? "yes" : "no");
|
||||
kprintf(" bounce buffer: %s\n", fUsesBounceBuffer ? "yes" : "no");
|
||||
|
||||
set_debug_variable("_parent", (addr_t)fParent);
|
||||
set_debug_variable("_buffer", (addr_t)fDMABuffer);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
@@ -1055,6 +1101,47 @@ IORequest::_CopyUser(void* _bounceBuffer, void* _external, size_t size,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IORequest::Dump() const
|
||||
{
|
||||
kprintf("io_request at %p\n", this);
|
||||
|
||||
kprintf(" parent: %p\n", fParent);
|
||||
kprintf(" status: %s\n", strerror(fStatus));
|
||||
kprintf(" mutex: %p\n", &fLock);
|
||||
kprintf(" IOBuffer: %p\n", fBuffer);
|
||||
kprintf(" offset: %Ld\n", fOffset);
|
||||
kprintf(" length: %lu\n", fLength);
|
||||
kprintf(" transfer size: %lu\n", fTransferSize);
|
||||
kprintf(" relative offset: %lu\n", fRelativeParentOffset);
|
||||
kprintf(" pending children: %ld\n", fPendingChildren);
|
||||
kprintf(" flags: %#lx\n", fFlags);
|
||||
kprintf(" team: %ld\n", fTeam);
|
||||
kprintf(" r/w: %s\n", fIsWrite ? "write" : "read");
|
||||
kprintf(" partial transfer: %s\n", fPartialTransfer ? "yes" : "no");
|
||||
kprintf(" finished cvar: %p\n", &fFinishedCondition);
|
||||
kprintf(" iteration:\n");
|
||||
kprintf(" vec index: %lu\n", fVecIndex);
|
||||
kprintf(" vec offset: %lu\n", fVecOffset);
|
||||
kprintf(" remaining bytes: %lu\n", fRemainingBytes);
|
||||
kprintf(" callbacks:\n");
|
||||
kprintf(" finished %p, cookie %p\n", fFinishedCallback, fFinishedCookie);
|
||||
kprintf(" iteration %p, cookie %p\n", fIterationCallback,
|
||||
fIterationCookie);
|
||||
kprintf(" children:\n");
|
||||
|
||||
IORequestChunkList::ConstIterator iterator = fChildren.GetIterator();
|
||||
while (iterator.HasNext()) {
|
||||
kprintf(" %p\n", iterator.Next());
|
||||
}
|
||||
|
||||
set_debug_variable("_parent", (addr_t)fParent);
|
||||
set_debug_variable("_mutex", (addr_t)&fLock);
|
||||
set_debug_variable("_buffer", (addr_t)fBuffer);
|
||||
set_debug_variable("_cvar", (addr_t)&fFinishedCondition);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
status_t LockMemory(team_id team, bool isWrite);
|
||||
void UnlockMemory(team_id team, bool isWrite);
|
||||
|
||||
void Dump() const;
|
||||
|
||||
private:
|
||||
IOBuffer();
|
||||
~IOBuffer();
|
||||
@@ -155,6 +157,8 @@ public:
|
||||
void SetBuffer(DMABuffer* buffer)
|
||||
{ fDMABuffer = buffer; }
|
||||
|
||||
void Dump() const;
|
||||
|
||||
protected:
|
||||
void _PrepareVecs();
|
||||
status_t _CopyPartialBegin(bool isWrite,
|
||||
@@ -268,6 +272,8 @@ struct IORequest : IORequestChunk, DoublyLinkedListLinkImpl<IORequest> {
|
||||
status_t CopyData(const void* buffer, off_t offset,
|
||||
size_t size);
|
||||
|
||||
void Dump() const;
|
||||
|
||||
private:
|
||||
status_t _CopyData(void* buffer, off_t offset,
|
||||
size_t size, bool copyIn);
|
||||
|
||||
Reference in New Issue
Block a user