Various 64-bit fixes to SCSI and ATA bus managers/drivers.
Mostly compilation fixes, as well as a few 64-bit safety fixes. I've briefly looked through everything for any obvious issues and fixed the ones I've found, and it seems like they're working properly, though there could be some more well hidden ones that I've missed.
This commit is contained in:
@@ -29,7 +29,7 @@ ATAChannel::ATAChannel(device_node *node)
|
||||
|
||||
gDeviceManager->get_attr_uint32(node, ATA_CHANNEL_ID_ITEM, &fChannelID,
|
||||
true);
|
||||
snprintf(fDebugContext, sizeof(fDebugContext), " %lu", fChannelID);
|
||||
snprintf(fDebugContext, sizeof(fDebugContext), " %" B_PRIu32, fChannelID);
|
||||
|
||||
if (fUseDMA) {
|
||||
void *settings = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS);
|
||||
@@ -879,7 +879,7 @@ ATAChannel::_FlushAndWait(bigtime_t waitTime)
|
||||
status_t
|
||||
ATAChannel::_ReadPIOBlock(ATARequest *request, size_t length)
|
||||
{
|
||||
uint32 transferred = 0;
|
||||
size_t transferred = 0;
|
||||
status_t result = _TransferPIOBlock(request, length, &transferred);
|
||||
request->CCB()->data_resid -= transferred;
|
||||
|
||||
|
||||
@@ -574,7 +574,7 @@ ATADevice::Configure()
|
||||
status_t
|
||||
ATADevice::Identify()
|
||||
{
|
||||
snprintf(fDebugContext, sizeof(fDebugContext), "%s %lu-%u",
|
||||
snprintf(fDebugContext, sizeof(fDebugContext), "%s %" B_PRIu32 "-%u",
|
||||
IsATAPI() ? "pi" : "", fChannel->ChannelID(), fIndex);
|
||||
|
||||
ATARequest request(false);
|
||||
|
||||
@@ -51,7 +51,7 @@ is_sg_list_dma_safe(scsi_ccb *request)
|
||||
}
|
||||
|
||||
// if there are no further restrictions - be happy
|
||||
if (dma_boundary == ~0UL && alignment == 0 && max_sg_block_size == 0)
|
||||
if (dma_boundary == ~(uint32)0 && alignment == 0 && max_sg_block_size == 0)
|
||||
return true;
|
||||
|
||||
// argh - controller is a bit picky, so make sure he likes us
|
||||
|
||||
@@ -55,7 +55,8 @@ static void scsi_insert_new_request( scsi_device_info *device,
|
||||
{
|
||||
scsi_ccb *first, *last, *before, *next;
|
||||
|
||||
SHOW_FLOW( 3, "inserting new_request=%p, pos=%Ld", new_request, new_request->sort );
|
||||
SHOW_FLOW( 3, "inserting new_request=%p, pos=%" B_PRId64, new_request,
|
||||
new_request->sort );
|
||||
|
||||
first = device->queued_reqs;
|
||||
|
||||
@@ -65,7 +66,7 @@ static void scsi_insert_new_request( scsi_device_info *device,
|
||||
return;
|
||||
}
|
||||
|
||||
SHOW_FLOW( 3, "first=%p, pos=%Ld, last_pos=%Ld",
|
||||
SHOW_FLOW( 3, "first=%p, pos=%" B_PRId64 ", last_pos=%" B_PRId64,
|
||||
first, first->sort, device->last_sort );
|
||||
|
||||
// don't let syncs bypass others
|
||||
@@ -153,7 +154,7 @@ static void scsi_insert_new_request( scsi_device_info *device,
|
||||
return;
|
||||
}
|
||||
|
||||
SHOW_FLOW( 1, "inserting after %p (pos=%Ld) and before %p (pos=%Ld)",
|
||||
SHOW_FLOW( 1, "inserting after %p (pos=%" B_PRId64 ") and before %p (pos=%" B_PRId64 ")",
|
||||
before, before->sort, next, next->sort );
|
||||
|
||||
// if we haven't found a proper position, we automatically insert
|
||||
|
||||
@@ -51,7 +51,7 @@ fill_temp_sg(scsi_ccb *ccb)
|
||||
if (mapped_len != ccb->data_length)
|
||||
goto too_complex;
|
||||
|
||||
if (dma_boundary != ~0UL || ccb->data_length > max_sg_block_size) {
|
||||
if (dma_boundary != ~(uint32)0 || ccb->data_length > max_sg_block_size) {
|
||||
// S/G list may not be controller-compatible:
|
||||
// we have to split offending entries
|
||||
SHOW_FLOW(3, "Checking violation of dma boundary 0x%x and entry size 0x%x",
|
||||
@@ -64,7 +64,7 @@ fill_temp_sg(scsi_ccb *ccb)
|
||||
max_len = (dma_boundary + 1) -
|
||||
(temp_sg[cur_idx].address & dma_boundary);
|
||||
// restrict size per sg item
|
||||
max_len = std::min(max_len, max_sg_block_size);
|
||||
max_len = std::min(max_len, (addr_t)max_sg_block_size);
|
||||
|
||||
SHOW_FLOW(4, "addr=%#" B_PRIxPHYSADDR ", size=%x, max_len=%x, "
|
||||
"idx=%d, num=%d", temp_sg[cur_idx].address,
|
||||
@@ -107,7 +107,8 @@ create_temp_sg(scsi_ccb *ccb)
|
||||
physical_entry *temp_sg;
|
||||
status_t res;
|
||||
|
||||
SHOW_FLOW(3, "ccb=%p, data=%p, data_length=%lu", ccb, ccb->data, ccb->data_length);
|
||||
SHOW_FLOW(3, "ccb=%p, data=%p, data_length=%" B_PRIu32, ccb, ccb->data,
|
||||
ccb->data_length);
|
||||
|
||||
ccb->sg_list = temp_sg = (physical_entry*)locked_pool->alloc(temp_sg_pool);
|
||||
if (temp_sg == NULL) {
|
||||
|
||||
@@ -121,21 +121,21 @@ typedef struct scsi_bus_info {
|
||||
typedef struct dma_buffer {
|
||||
area_id area; // area of DMA buffer
|
||||
uchar *address; // address of DMA buffer
|
||||
uint32 size; // size of DMA buffer
|
||||
size_t size; // size of DMA buffer
|
||||
area_id sg_list_area; // area of S/G list
|
||||
physical_entry *sg_list; // address of S/G list
|
||||
uint32 sg_count; // number of entries in S/G list
|
||||
size_t sg_count; // number of entries in S/G list
|
||||
bool inuse; // true, if in use
|
||||
bigtime_t last_use; // timestamp of last usage
|
||||
|
||||
area_id sg_orig; // area of S/G list to original data
|
||||
physical_entry *sg_list_orig; // S/G list to original data
|
||||
uint32 sg_count_max_orig; // maximum size (in entries)
|
||||
uint32 sg_count_orig; // current size (in entries)
|
||||
size_t sg_count_max_orig; // maximum size (in entries)
|
||||
size_t sg_count_orig; // current size (in entries)
|
||||
|
||||
uchar *orig_data; // pointer to original data
|
||||
const physical_entry *orig_sg_list; // original S/G list
|
||||
uint32 orig_sg_count; // size of original S/G list
|
||||
size_t orig_sg_count; // size of original S/G list
|
||||
} dma_buffer;
|
||||
|
||||
|
||||
|
||||
@@ -367,7 +367,7 @@ scsi_check_enqueue_request(scsi_ccb *request)
|
||||
|
||||
if (request->sort >= 0) {
|
||||
device->last_sort = request->sort;
|
||||
SHOW_FLOW(1, "%Ld", device->last_sort);
|
||||
SHOW_FLOW(1, "%" B_PRId64, device->last_sort);
|
||||
}
|
||||
|
||||
execute = true;
|
||||
@@ -618,7 +618,7 @@ scsi_check_exec_service(scsi_bus_info *bus)
|
||||
|
||||
if (request->sort >= 0) {
|
||||
device->last_sort = request->sort;
|
||||
SHOW_FLOW(1, "%Ld", device->last_sort);
|
||||
SHOW_FLOW(1, "%" B_PRId64, device->last_sort);
|
||||
}
|
||||
|
||||
RELEASE_BEN(&bus->mutex);
|
||||
|
||||
@@ -56,8 +56,8 @@ get_iovec_memory_map(iovec *vec, size_t vec_count, size_t vec_offset, size_t len
|
||||
range_start = (char *)vec->iov_base + vec_offset;
|
||||
range_len = std::min(vec->iov_len - vec_offset, left_len);
|
||||
|
||||
SHOW_FLOW( 3, "range_start=%x, range_len=%x",
|
||||
(int)range_start, (int)range_len );
|
||||
SHOW_FLOW( 3, "range_start=%" B_PRIxADDR ", range_len=%" B_PRIxSIZE,
|
||||
(addr_t)range_start, range_len );
|
||||
|
||||
vec_offset = 0;
|
||||
|
||||
|
||||
@@ -184,8 +184,8 @@ test_capacity(cd_driver_info *info)
|
||||
}
|
||||
|
||||
if (info->capacity != info->original_capacity) {
|
||||
dprintf("scsi_cd: adjusted capacity from %llu to %llu blocks.\n",
|
||||
info->original_capacity, info->capacity);
|
||||
dprintf("scsi_cd: adjusted capacity from %" B_PRIu64 " to %" B_PRIu64
|
||||
" blocks.\n", info->original_capacity, info->capacity);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
@@ -981,7 +981,8 @@ cd_set_capacity(cd_driver_info* info, uint64 capacity, uint32 blockSize)
|
||||
}
|
||||
|
||||
if (info->block_size != 0) {
|
||||
dprintf("old %ld, new %ld\n", info->block_size, blockSize);
|
||||
dprintf("old %" B_PRId32 ", new %" B_PRId32 "\n", info->block_size,
|
||||
blockSize);
|
||||
panic("updating DMAResource not yet implemented...");
|
||||
}
|
||||
|
||||
|
||||
@@ -417,7 +417,8 @@ das_set_capacity(das_driver_info* info, uint64 capacity, uint32 blockSize)
|
||||
|
||||
if (info->block_size != blockSize) {
|
||||
if (info->block_size != 0) {
|
||||
dprintf("old %ld, new %ld\n", info->block_size, blockSize);
|
||||
dprintf("old %" B_PRId32 ", new %" B_PRId32 "\n", info->block_size,
|
||||
blockSize);
|
||||
panic("updating DMAResource not yet implemented...");
|
||||
}
|
||||
|
||||
|
||||
@@ -250,8 +250,8 @@ ata_adapter_prepare_dma(ata_adapter_channel_info *channel,
|
||||
writeToDevice ? "write" : "read", sgListCount);
|
||||
|
||||
for (i = sgListCount - 1, prd = channel->prdt; i >= 0; --i, ++prd, ++sgList) {
|
||||
prd->address = B_HOST_TO_LENDIAN_INT32((uint32)pci->ram_address(device,
|
||||
(void*)(addr_t)sgList->address));
|
||||
prd->address = B_HOST_TO_LENDIAN_INT32((uint32)(addr_t)pci->ram_address(
|
||||
device, (void*)(addr_t)sgList->address));
|
||||
// 0 means 64K - this is done automatically be discarding upper 16 bits
|
||||
prd->count = B_HOST_TO_LENDIAN_INT16((uint16)sgList->size);
|
||||
prd->EOT = i == 0;
|
||||
@@ -266,8 +266,8 @@ ata_adapter_prepare_dma(ata_adapter_channel_info *channel,
|
||||
|
||||
pci->write_io_32(device, channel->bus_master_base + ATA_BM_PRDT_ADDRESS,
|
||||
(pci->read_io_32(device, channel->bus_master_base + ATA_BM_PRDT_ADDRESS) & 3)
|
||||
| (B_HOST_TO_LENDIAN_INT32((uint32)pci->ram_address(device,
|
||||
(void *)channel->prdt_phys)) & ~3));
|
||||
| (B_HOST_TO_LENDIAN_INT32((uint32)(addr_t)pci->ram_address(device,
|
||||
(void*)(addr_t)channel->prdt_phys)) & ~3));
|
||||
|
||||
// reset interrupt and error signal
|
||||
status = pci->read_io_8(device, channel->bus_master_base
|
||||
|
||||
@@ -92,7 +92,8 @@ periph_check_capacity(scsi_periph_device_info *device, scsi_ccb *request)
|
||||
blockSize = 0;
|
||||
}
|
||||
|
||||
SHOW_FLOW(3, "capacity = %lld, block_size = %ld", capacity, blockSize);
|
||||
SHOW_FLOW(3, "capacity = %" B_PRId64 ", block_size = %" B_PRId32, capacity,
|
||||
blockSize);
|
||||
|
||||
device->block_size = blockSize;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ periph_compose_device_name(device_node *node, const char *prefix)
|
||||
// this is actually an IDE device, so we ignore the prefix
|
||||
|
||||
// a bus device for those
|
||||
snprintf(name, sizeof(name), "disk/ata%s/%ld/%s/raw",
|
||||
snprintf(name, sizeof(name), "disk/ata%s/%" B_PRId32 "/%s/raw",
|
||||
type == scsi_dev_CDROM ? "pi" : "", channel,
|
||||
targetID == 0 ? "master" : "slave");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user