From a479459113a5536cae45de8392993d8f04ebad53 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Thu, 10 Sep 2009 21:11:36 +0000 Subject: [PATCH] Write device identification into syslog. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33042 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/ata/ATAChannel.cpp | 1 + .../kernel/bus_managers/ata/ATADevice.cpp | 16 ++++++++++++++++ .../kernel/bus_managers/ata/ATAHelper.cpp | 12 ++++++++++++ src/add-ons/kernel/bus_managers/ata/ATAPrivate.h | 2 ++ 4 files changed, 31 insertions(+) diff --git a/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp b/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp index 463f5cc165..fee70aa382 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp +++ b/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp @@ -832,6 +832,7 @@ ATAChannel::_WriteRegs(ata_task_file *taskFile, ata_reg_mask mask) return fController->write_command_block_regs(fCookie, taskFile, mask); } + uint8 ATAChannel::_Status() { diff --git a/src/add-ons/kernel/bus_managers/ata/ATADevice.cpp b/src/add-ons/kernel/bus_managers/ata/ATADevice.cpp index d617c1ab1c..b7f754fd59 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATADevice.cpp +++ b/src/add-ons/kernel/bus_managers/ata/ATADevice.cpp @@ -512,6 +512,22 @@ ATADevice::Identify() return B_ERROR; } + if (1) { + // print device information + char modelNumber[sizeof(fInfoBlock.model_number) + 1]; + char serialNumber[sizeof(fInfoBlock.serial_number) + 1]; + char firmwareRev[sizeof(fInfoBlock.firmware_revision) + 1]; + strlcpy(modelNumber, fInfoBlock.model_number, sizeof(modelNumber)); + strlcpy(serialNumber, fInfoBlock.serial_number, sizeof(serialNumber)); + strlcpy(firmwareRev, fInfoBlock.firmware_revision, sizeof(firmwareRev)); + swap_words(modelNumber, sizeof(modelNumber) - 1); + swap_words(serialNumber, sizeof(serialNumber) - 1); + swap_words(firmwareRev, sizeof(firmwareRev) - 1); + TRACE_ALWAYS("model number: %s\n", modelNumber); + TRACE_ALWAYS("serial number: %s\n", serialNumber); + TRACE_ALWAYS("firmware rev.: %s\n", firmwareRev); + } + return B_OK; } diff --git a/src/add-ons/kernel/bus_managers/ata/ATAHelper.cpp b/src/add-ons/kernel/bus_managers/ata/ATAHelper.cpp index 462229a5bc..ee1aa2344a 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATAHelper.cpp +++ b/src/add-ons/kernel/bus_managers/ata/ATAHelper.cpp @@ -64,3 +64,15 @@ copy_sg_data(scsi_ccb *ccb, uint offset, uint allocationLength, return size == 0; } + + +void +swap_words(void *data, size_t size) +{ + uint16 *word = (uint16 *)data; + size_t count = size / 2; + while (count--) { + *word = (*word << 8) | (*word >> 8); + word++; + } +} diff --git a/src/add-ons/kernel/bus_managers/ata/ATAPrivate.h b/src/add-ons/kernel/bus_managers/ata/ATAPrivate.h index 1ecc02e313..c59ae4f685 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATAPrivate.h +++ b/src/add-ons/kernel/bus_managers/ata/ATAPrivate.h @@ -55,6 +55,8 @@ extern device_manager_info *gDeviceManager; bool copy_sg_data(scsi_ccb *ccb, uint offset, uint allocationLength, void *buffer, int size, bool toBuffer); +void swap_words(void *data, size_t size); + class ATAChannel { public: