From 66cb8f0ede064ffd22000e3ce0472c73e11e3b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 29 Apr 2008 08:11:43 +0000 Subject: [PATCH] * Use dprintf_no_syslog() for FLOW and everything in scsi2ata.c - this prevents endless writing to the syslog. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25237 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/ata/scsi2ata.c | 36 +++++++++--------- .../drivers/disk/scsi/scsi_dsk/scsi_dsk.c | 37 ++++++++++--------- .../drivers/disk/scsi/scsi_dsk/wrapper.h | 6 +-- 3 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/ata/scsi2ata.c b/src/add-ons/kernel/bus_managers/ata/scsi2ata.c index 703f179236..4f4a29eb48 100644 --- a/src/add-ons/kernel/bus_managers/ata/scsi2ata.c +++ b/src/add-ons/kernel/bus_managers/ata/scsi2ata.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007, Haiku, Inc. All RightsReserved. + * Copyright 2004-2008, Haiku, Inc. All RightsReserved. * Copyright 2002/03, Thomas Kurschel. All rights reserved. * * Distributed under the terms of the MIT License. @@ -8,7 +8,7 @@ /* Part of Open IDE bus manager - Converts SCSI commands to ATA commands. + Converts SCSI commands to ATA commands. */ @@ -18,8 +18,8 @@ #include -#define TRACE dprintf -#define FLOW dprintf +#define TRACE dprintf_no_syslog +#define FLOW dprintf_no_syslog @@ -80,7 +80,7 @@ scsi_mode_sense_10(ide_device_info *device, ata_request *request) copy_sg_data(ccb, 0, allocationLength, ¶m_header, sizeof(param_header), false); - /*block_desc = (scsi_mode_param_block_desc *)(ccb->data + /*block_desc = (scsi_mode_param_block_desc *)(ccb->data + sizeof(*param_header));*/ memset(&block_desc, 0, sizeof(block_desc)); // density is reserved (0), descriptor apply to entire medium (num_blocks=0) @@ -92,16 +92,16 @@ scsi_mode_sense_10(ide_device_info *device, ata_request *request) copy_sg_data(ccb, sizeof(param_header), allocationLength, &block_desc, sizeof(block_desc), false); - /*contr = (scsi_modepage_contr *)(ccb->data + /*contr = (scsi_modepage_contr *)(ccb->data + sizeof(*param_header) - + ((uint16)param_header->high_block_desc_len << 8) + + ((uint16)param_header->high_block_desc_len << 8) + param_header->low_block_desc_len);*/ memset(&control, 0, sizeof(control)); control.RLEC = false; control.DQue = 1;//!device->CQ_enabled; control.QErr = false; - // when a command fails we requeue all + // when a command fails we requeue all // lost commands automagically control.QAM = SCSI_QAM_UNRESTRICTED; @@ -167,7 +167,7 @@ scsi_mode_select_10(ide_device_info *device, ata_request *request) modepageOffset = sizeof(param_header) + B_BENDIAN_TO_HOST_INT16(param_header.block_desc_length); - // go through list of pages + // go through list of pages while (modepageOffset < totalLength) { uint32 pageLength; @@ -226,7 +226,7 @@ scsi_test_unit_ready(ide_device_info *device, ata_request *request) || device->infoblock._127_RMSN_support != 1) return; - // ask device about status + // ask device about status device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; @@ -238,7 +238,7 @@ scsi_test_unit_ready(ide_device_info *device, ata_request *request) // bits ide_error_mcr | ide_error_mc | ide_error_wp are also valid // but not requested by TUR; ide_error_wp can safely be ignored, but // we don't want to loose media change (request) reports - ata_finish_command(device, request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, + ata_finish_command(device, request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_nm | ide_error_abrt | ide_error_mcr | ide_error_mc); // SCSI spec is unclear here: we shouldn't report "media change (request)" // but what to do if there is one? anyway - we report them @@ -258,7 +258,7 @@ scsi_synchronize_cache(ide_device_info *device, ata_request *request) return true; device->tf_param_mask = 0; - device->tf.lba.command = device->use_48bits ? IDE_CMD_FLUSH_CACHE_EXT + device->tf.lba.command = device->use_48bits ? IDE_CMD_FLUSH_CACHE_EXT : IDE_CMD_FLUSH_CACHE; // spec says that this may take more then 30s, how much more? @@ -350,9 +350,9 @@ scsi_inquiry(ide_device_info *device, ata_request *request) data.relative_address = false; // the following fields are *much* to small, sigh... - memcpy(data.vendor_ident, device->infoblock.model_number, + memcpy(data.vendor_ident, device->infoblock.model_number, sizeof(data.vendor_ident)); - memcpy(data.product_ident, device->infoblock.model_number + 8, + memcpy(data.product_ident, device->infoblock.model_number + 8, sizeof(data.product_ident)); memcpy(data.product_rev, " ", sizeof(data.product_rev)); @@ -428,9 +428,9 @@ void ata_exec_io(ide_device_info *device, ata_request *request) { scsi_ccb *ccb = request->ccb; - + //FLOW("ata_exec_io: scsi command 0x%02x\n", ccb->cdb[0]); - + // ATA devices have one LUN only if (ccb->target_lun != 0) { FLOW("ata_exec_io: wrong target lun\n"); @@ -463,7 +463,7 @@ ata_exec_io(ide_device_info *device, ata_request *request) ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); break; - case SCSI_OP_INQUIRY: + case SCSI_OP_INQUIRY: scsi_inquiry(device, request); break; @@ -523,7 +523,7 @@ ata_exec_io(ide_device_info *device, ata_request *request) break; case SCSI_OP_SYNCHRONIZE_CACHE: - // we ignore range and immediate bit, we always immediately flush everything + // we ignore range and immediate bit, we always immediately flush everything scsi_synchronize_cache(device, request); break; diff --git a/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/scsi_dsk.c b/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/scsi_dsk.c index 6f72dc08f3..009ec5437d 100644 --- a/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/scsi_dsk.c +++ b/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/scsi_dsk.c @@ -7,7 +7,7 @@ Part of Open SCSI Disk Driver Main file. - + You'll find das_... all over the place. This stands for "Direct Access Storage" which is the official SCSI name for normal (floppy/hard/ZIP)-disk drives. @@ -62,7 +62,7 @@ update_capacity(das_device_info *device) device->scsi->free_ccb(ccb); - return res; + return res; } @@ -104,9 +104,9 @@ get_geometry(das_handle_info *handle, void *buf, size_t len) geometry->removable, geometry->read_only, geometry->write_once); - + SHOW_FLOW0(3, "done"); - + return B_OK; } @@ -121,7 +121,7 @@ load_eject(das_device_info *device, bool load) ccb = device->scsi->alloc_ccb(device->scsi_device); - res = scsi_periph->send_start_stop(device->scsi_periph_device, + res = scsi_periph->send_start_stop(device->scsi_periph_device, ccb, load, true); device->scsi->free_ccb(ccb); @@ -135,18 +135,19 @@ synchronize_cache(das_device_info *device) { scsi_ccb *ccb; err_res res; - - SHOW_FLOW0( 0, "" ); - + + SHOW_FLOW0(0, ""); + ccb = device->scsi->alloc_ccb(device->scsi_device); res = scsi_periph->synchronize_cache(device->scsi_periph_device, ccb); - + device->scsi->free_ccb(ccb); - + return res.error_code; } + static int log2(uint32 x) { @@ -166,7 +167,7 @@ das_set_capacity(das_device_info *device, uint64 capacity, { uint32 ld_block_size; - SHOW_FLOW(3, "device=%p, capacity=%Ld, block_size=%ld", + SHOW_FLOW(3, "device=%p, capacity=%Ld, block_size=%ld", device, capacity, block_size); // get log2, if possible @@ -178,7 +179,7 @@ das_set_capacity(das_device_info *device, uint64 capacity, device->capacity = capacity; device->block_size = block_size; - gBlockIO->set_media_params(device->block_io_device, block_size, + gBlockIO->set_media_params(device->block_io_device, block_size, ld_block_size, capacity); } @@ -218,7 +219,7 @@ das_ioctl(das_handle_info *handle, int op, void *buf, size_t len) break; case B_GET_ICON: - res = scsi_periph->get_icon(device->removable ? icon_type_floppy : icon_type_disk, + res = scsi_periph->get_icon(device->removable ? icon_type_floppy : icon_type_disk, (device_icon *)buf); break; @@ -231,9 +232,9 @@ das_ioctl(das_handle_info *handle, int op, void *buf, size_t len) res = load_eject(device, true); break; - case B_FLUSH_DRIVE_CACHE: - res = synchronize_cache(device); - break; + case B_FLUSH_DRIVE_CACHE: + res = synchronize_cache(device); + break; default: res = scsi_periph->ioctl(handle->scsi_periph_handle, op, buf, len); @@ -265,7 +266,7 @@ das_supports_device(device_node_handle parent, bool *_noConnection) || device_type != scsi_dev_direct_access) { free(bus); return 0.0; - } + } free(bus); return 0.6; @@ -333,7 +334,7 @@ block_device_interface scsi_dsk_module = { }; #if !_BUILDING_kernel && !BOOT -_EXPORT +_EXPORT module_info *modules[] = { (module_info *)&scsi_dsk_module, NULL diff --git a/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/wrapper.h b/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/wrapper.h index c2154db825..7e93b87b21 100644 --- a/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/wrapper.h +++ b/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/wrapper.h @@ -17,7 +17,7 @@ #ifdef DEBUG_WAIT_ON_MSG # define DEBUG_WAIT snooze( DEBUG_WAIT_ON_MSG ); #else -# define DEBUG_WAIT +# define DEBUG_WAIT #endif #ifdef DEBUG_WAIT_ON_ERROR @@ -58,12 +58,12 @@ #define SHOW_FLOW(seriousness, format, param...) \ do { if( seriousness <= debug_level_flow && seriousness <= DEBUG_MAX_LEVEL_FLOW ) { \ - dprintf( "%s%s: "format"\n", FUNC_NAME, param ); DEBUG_WAIT \ + dprintf_no_syslog( "%s%s: "format"\n", FUNC_NAME, param ); DEBUG_WAIT \ }} while( 0 ) #define SHOW_FLOW0(seriousness, format) \ do { if( seriousness <= debug_level_flow && seriousness <= DEBUG_MAX_LEVEL_FLOW ) { \ - dprintf( "%s%s: "format"\n", FUNC_NAME); DEBUG_WAIT \ + dprintf_no_syslog( "%s%s: "format"\n", FUNC_NAME); DEBUG_WAIT \ }} while( 0 ) #define SHOW_INFO(seriousness, format, param...) \