From 61b1a536e8e346af6559e8353786091b85629a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 14 Aug 2008 14:28:20 +0000 Subject: [PATCH] * Fixed the mix of bufferCount vs. max_segment_count with regards to B_BLOCK_DEVICE_MAX_SG_BLOCKS as pointed out by Ingo. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26972 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp | 2 +- .../kernel/drivers/disk/scsi/scsi_disk/scsi_disk.cpp | 2 +- src/system/kernel/device_manager/dma_resources.cpp | 7 +++---- src/system/kernel/device_manager/dma_resources.h | 3 ++- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp b/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp index 01efc6c1d4..cd7f0f96cf 100644 --- a/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp +++ b/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp @@ -817,7 +817,7 @@ cd_set_capacity(cd_driver_info *info, uint64 capacity, uint32 blockSize) } // TODO: we need to replace the DMAResource in our IOScheduler - status_t status = info->dma_resource->Init(info->node, blockSize); + status_t status = info->dma_resource->Init(info->node, blockSize, 32); if (status != B_OK) panic("initializing DMAResource failed: %s", strerror(status)); diff --git a/src/add-ons/kernel/drivers/disk/scsi/scsi_disk/scsi_disk.cpp b/src/add-ons/kernel/drivers/disk/scsi/scsi_disk/scsi_disk.cpp index 060f0cc39b..4d8ee0c4a5 100644 --- a/src/add-ons/kernel/drivers/disk/scsi/scsi_disk/scsi_disk.cpp +++ b/src/add-ons/kernel/drivers/disk/scsi/scsi_disk/scsi_disk.cpp @@ -363,7 +363,7 @@ das_set_capacity(das_driver_info* info, uint64 capacity, uint32 blockSize) } // TODO: we need to replace the DMAResource in our IOScheduler - status_t status = info->dma_resource->Init(info->node, blockSize); + status_t status = info->dma_resource->Init(info->node, blockSize, 32); if (status != B_OK) panic("initializing DMAResource failed: %s", strerror(status)); diff --git a/src/system/kernel/device_manager/dma_resources.cpp b/src/system/kernel/device_manager/dma_resources.cpp index dae96f5670..28d59070cf 100644 --- a/src/system/kernel/device_manager/dma_resources.cpp +++ b/src/system/kernel/device_manager/dma_resources.cpp @@ -115,7 +115,7 @@ DMAResource::~DMAResource() status_t -DMAResource::Init(device_node* node, size_t blockSize) +DMAResource::Init(device_node* node, size_t blockSize, uint32 bufferCount) { dma_restrictions restrictions; memset(&restrictions, 0, sizeof(dma_restrictions)); @@ -139,10 +139,9 @@ DMAResource::Init(device_node* node, size_t blockSize) B_BLOCK_DEVICE_MAX_BLOCKS_ITEM, &value, true) == B_OK) restrictions.max_transfer_size = value * blockSize; - uint32 bufferCount; if (gDeviceManagerModule.get_attr_uint32(node, - B_BLOCK_DEVICE_MAX_SG_BLOCKS, &bufferCount, true) != B_OK) - bufferCount = 16; + B_BLOCK_DEVICE_MAX_SG_BLOCKS, &value, true) == B_OK) + restrictions.max_segment_count = value; return Init(restrictions, blockSize, bufferCount); } diff --git a/src/system/kernel/device_manager/dma_resources.h b/src/system/kernel/device_manager/dma_resources.h index 9cf07bdf56..c5bc7b1dd3 100644 --- a/src/system/kernel/device_manager/dma_resources.h +++ b/src/system/kernel/device_manager/dma_resources.h @@ -72,7 +72,8 @@ public: status_t Init(const dma_restrictions& restrictions, size_t blockSize, uint32 bufferCount); - status_t Init(device_node* node, size_t blockSize); + status_t Init(device_node* node, size_t blockSize, + uint32 bufferCount); status_t CreateBuffer(DMABuffer** _buffer) { return CreateBuffer(0, _buffer); }