IOCache implements IOScheduler, now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36494 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2eab54201c
commit
5060d7980f
@ -40,12 +40,10 @@ struct IOCache::Operation : IOOperation {
|
|||||||
|
|
||||||
IOCache::IOCache(DMAResource* resource, size_t cacheLineSize)
|
IOCache::IOCache(DMAResource* resource, size_t cacheLineSize)
|
||||||
:
|
:
|
||||||
|
IOScheduler(resource),
|
||||||
fDeviceCapacity(0),
|
fDeviceCapacity(0),
|
||||||
fLineSize(cacheLineSize),
|
fLineSize(cacheLineSize),
|
||||||
fPagesPerLine(cacheLineSize / B_PAGE_SIZE),
|
fPagesPerLine(cacheLineSize / B_PAGE_SIZE),
|
||||||
fDMAResource(resource),
|
|
||||||
fIOCallback(NULL),
|
|
||||||
fIOCallbackData(NULL),
|
|
||||||
fArea(-1),
|
fArea(-1),
|
||||||
fCache(NULL),
|
fCache(NULL),
|
||||||
fPages(NULL),
|
fPages(NULL),
|
||||||
@ -89,6 +87,10 @@ IOCache::Init(const char* name)
|
|||||||
{
|
{
|
||||||
TRACE("%p->IOCache::Init(\"%s\")\n", this, name);
|
TRACE("%p->IOCache::Init(\"%s\")\n", this, name);
|
||||||
|
|
||||||
|
status_t error = IOScheduler::Init(name);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
// create the area for mapping cache lines
|
// create the area for mapping cache lines
|
||||||
fArea = vm_create_null_area(B_SYSTEM_TEAM, "I/O cache line", &fAreaBase,
|
fArea = vm_create_null_area(B_SYSTEM_TEAM, "I/O cache line", &fAreaBase,
|
||||||
B_ANY_KERNEL_ADDRESS, fLineSize, 0);
|
B_ANY_KERNEL_ADDRESS, fLineSize, 0);
|
||||||
@ -121,21 +123,6 @@ IOCache::Init(const char* name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
IOCache::SetCallback(IOCallback& callback)
|
|
||||||
{
|
|
||||||
SetCallback(&IOCallback::WrapperFunction, &callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
IOCache::SetCallback(io_callback callback, void* data)
|
|
||||||
{
|
|
||||||
fIOCallback = callback;
|
|
||||||
fIOCallbackData = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
IOCache::SetDeviceCapacity(off_t deviceCapacity)
|
IOCache::SetDeviceCapacity(off_t deviceCapacity)
|
||||||
{
|
{
|
||||||
@ -194,6 +181,13 @@ IOCache::ScheduleRequest(IORequest* request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
IOCache::AbortRequest(IORequest* request, status_t status)
|
||||||
|
{
|
||||||
|
// TODO:...
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
IOCache::OperationCompleted(IOOperation* operation, status_t status,
|
IOCache::OperationCompleted(IOOperation* operation, status_t status,
|
||||||
size_t transferredBytes)
|
size_t transferredBytes)
|
||||||
@ -207,6 +201,14 @@ IOCache::OperationCompleted(IOOperation* operation, status_t status,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
IOCache::Dump() const
|
||||||
|
{
|
||||||
|
kprintf("IOCache at %p\n", this);
|
||||||
|
kprintf(" DMA resource: %p\n", fDMAResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
IOCache::_DoRequest(IORequest* request, size_t& _bytesTransferred)
|
IOCache::_DoRequest(IORequest* request, size_t& _bytesTransferred)
|
||||||
{
|
{
|
||||||
|
@ -10,32 +10,32 @@
|
|||||||
#include <vm/vm_page.h>
|
#include <vm/vm_page.h>
|
||||||
|
|
||||||
#include "dma_resources.h"
|
#include "dma_resources.h"
|
||||||
#include "IOCallback.h"
|
#include "IOScheduler.h"
|
||||||
#include "IORequest.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct VMCache;
|
struct VMCache;
|
||||||
struct vm_page;
|
struct vm_page;
|
||||||
|
|
||||||
|
|
||||||
class IOCache {
|
class IOCache : public IOScheduler {
|
||||||
public:
|
public:
|
||||||
IOCache(DMAResource* resource,
|
IOCache(DMAResource* resource,
|
||||||
size_t cacheLineSize);
|
size_t cacheLineSize);
|
||||||
~IOCache();
|
virtual ~IOCache();
|
||||||
|
|
||||||
status_t Init(const char* name);
|
virtual status_t Init(const char* name);
|
||||||
|
|
||||||
void SetCallback(IOCallback& callback);
|
virtual void SetDeviceCapacity(off_t deviceCapacity);
|
||||||
void SetCallback(io_callback callback, void* data);
|
|
||||||
|
|
||||||
void SetDeviceCapacity(off_t deviceCapacity);
|
virtual status_t ScheduleRequest(IORequest* request);
|
||||||
|
|
||||||
status_t ScheduleRequest(IORequest* request);
|
virtual void AbortRequest(IORequest* request,
|
||||||
|
status_t status = B_CANCELED);
|
||||||
void OperationCompleted(IOOperation* operation,
|
virtual void OperationCompleted(IOOperation* operation,
|
||||||
status_t status, size_t transferredBytes);
|
status_t status, size_t transferredBytes);
|
||||||
|
|
||||||
|
virtual void Dump() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Operation;
|
struct Operation;
|
||||||
|
|
||||||
@ -70,9 +70,6 @@ private:
|
|||||||
size_t fLineSize;
|
size_t fLineSize;
|
||||||
uint32 fLineSizeShift;
|
uint32 fLineSizeShift;
|
||||||
size_t fPagesPerLine;
|
size_t fPagesPerLine;
|
||||||
DMAResource* fDMAResource;
|
|
||||||
io_callback fIOCallback;
|
|
||||||
void* fIOCallbackData;
|
|
||||||
area_id fArea;
|
area_id fArea;
|
||||||
void* fAreaBase;
|
void* fAreaBase;
|
||||||
vm_page_reservation fMappingReservation;
|
vm_page_reservation fMappingReservation;
|
||||||
|
Loading…
Reference in New Issue
Block a user