From: jack_wang <jack_wang@usish.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
Mark Salyzyn <mark_salyzyn@xyratex.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
crystal_yu <crystal_yu@usish.com>,
lindar_liu <lindar_liu@usish.com>
Subject: Re: Re: [PATCH] pm8001: enhance firmware event log retrieval
Date: Sun, 19 Feb 2012 14:55:13 +0800 [thread overview]
Message-ID: <201202191454024304010@usish.com> (raw)
In-Reply-To: 1329578412.2862.24.camel@dabdike
James,
Thanks for fix, looks OK for me.
--------------
jack_wang
>On Wed, 2012-01-18 at 10:48 -0500, Mark Salyzyn wrote:
>> -static ssize_t pm8001_ctl_aap_log_show(struct device *cdev,
>> - struct device_attribute *attr, char *buf)
>> +static ssize_t pm8001_ctl_log_show(struct device *cdev, char *buf, int ind)
>> {
>> struct Scsi_Host *shost = class_to_shost(cdev);
>> struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
>> struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
>> + struct eventlog_entry entry;
>> + char *str = buf;
>> int i;
>> -#define AAP1_MEMMAP(r, c) \
>> - (*(u32 *)((u8*)pm8001_ha->memoryMap.region[AAP1].virt_ptr + (r) * 32 \
>> - + (c)))
>>
>> - char *str = buf;
>> - int max = 2;
>> - for (i = 0; i < max; i++) {
>> - str += sprintf(str, "0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x"
>> - "0x%08x 0x%08x\n",
>> - AAP1_MEMMAP(i, 0),
>> - AAP1_MEMMAP(i, 4),
>> - AAP1_MEMMAP(i, 8),
>> - AAP1_MEMMAP(i, 12),
>> - AAP1_MEMMAP(i, 16),
>> - AAP1_MEMMAP(i, 20),
>> - AAP1_MEMMAP(i, 24),
>> - AAP1_MEMMAP(i, 28));
>> + memset(&entry, 0, sizeof(entry));
>> + do {
>> + i = pm8001_readlog(
>> + (struct eventlog_header *)(
>> + pm8001_ha->memoryMap.region[ind].virt_ptr),
>> + &entry,
>> + (ind == AAP1) ?
>> + &pm8001_ha->aap1_consumer :
>> + &pm8001_ha->iop_consumer);
>> + } while ((i == 0) && !pm8001_validlog(&entry));
>> + if ((i >= 0) && pm8001_validlog(&entry)) {
>> + u32 *lp;
>> + unsigned long long timestamp =
>> + (((unsigned long long)entry.timestamp_upper) << 32) |
>> + entry.timestamp_lower;
>> + str += snprintf(str, PAGE_SIZE - (str - buf),
>> + "%u %llu.%09llu %u",
>> + entry.severity,
>> + timestamp / (1000000000 / 8),
>> + (timestamp % (1000000000 / 8)) * 8,
>> + entry.sequence);
>
>You can't do this. It produces this error on a 32 bit compile:
>
> MODPOST 1540 modules
>ERROR: "__udivdi3" [drivers/scsi/pm8001/pm8001.ko] undefined!
>ERROR: "__umoddi3" [drivers/scsi/pm8001/pm8001.ko] undefined!
>make[1]: *** [__modpost] Error 1
>make: *** [drivers/scsi/pm8001/pm8001.ko] Error 2
>
>because the compiler can't natively do 64 bit division.
>
>The fix is something like this (compile tested only)
>
>James
>
>---
>
>diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
>index 3fe3d93..0edfe86 100644
>--- a/drivers/scsi/pm8001/pm8001_ctl.c
>+++ b/drivers/scsi/pm8001/pm8001_ctl.c
>@@ -335,12 +335,13 @@ static ssize_t pm8001_ctl_log_show(struct device *cdev, char *buf, int ind)
> u32 *lp;
> unsigned long long timestamp =
> (((unsigned long long)entry.timestamp_upper) << 32) |
>- entry.timestamp_lower;
>+ entry.timestamp_lower, remainder;
>+ remainder = do_div(timestamp, 1000000000 / 8) * 8;
> str += snprintf(str, PAGE_SIZE - (str - buf),
> "%u %llu.%09llu %u",
> entry.severity,
>- timestamp / (1000000000 / 8),
>- (timestamp % (1000000000 / 8)) * 8,
>+ timestamp,
>+ remainder,
> entry.sequence);
> for (lp = entry.log, i = entry.size; i > 0; --i)
> str += snprintf(str, PAGE_SIZE - (str - buf),
>
>
>__________ Information from ESET NOD32 Antivirus, version of virus signature database 5659 (20101129) __________
>
>The message was checked by ESET NOD32 Antivirus.
>
>http://www.eset.com
>
>
>
next prev parent reply other threads:[~2012-02-19 6:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-18 15:48 [PATCH] pm8001: enhance firmware event log retrieval Mark Salyzyn
2012-01-19 7:37 ` Jack Wang
2012-01-19 13:46 ` Mark Salyzyn
2012-01-19 14:09 ` jack_wang
2012-02-18 15:20 ` James Bottomley
2012-02-19 6:55 ` jack_wang [this message]
2012-02-20 16:04 ` Mark Salyzyn
2012-02-20 16:13 ` James Bottomley
2012-02-20 16:31 ` Mark Salyzyn
2012-02-20 16:43 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201202191454024304010@usish.com \
--to=jack_wang@usish.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=crystal_yu@usish.com \
--cc=lindar_liu@usish.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mark_salyzyn@xyratex.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox