From: Andrew Morton <akpm@linux-foundation.org>
To: Borislav Petkov <borislav.petkov@amd.com>
Cc: greg@kroah.com, linux-kernel@vger.kernel.org,
dougthompson@xmission.com, borislav.petkov@amd.com
Subject: Re: [PATCH 19/21] amd64_edac: add debugging/testing code
Date: Tue, 28 Apr 2009 11:30:50 -0700 [thread overview]
Message-ID: <20090428113050.25f4b445.akpm@linux-foundation.org> (raw)
In-Reply-To: <1240931173-17477-20-git-send-email-borislav.petkov@amd.com>
On Tue, 28 Apr 2009 17:06:11 +0200
Borislav Petkov <borislav.petkov@amd.com> wrote:
> From: Doug Thompson <dougthompson@xmission.com>
>
> This is for dumping different registers and testing the address mapping
> logic using the ECC syndromes.
>
>
> ...
>
> +static ssize_t amd64_nbea_store(struct mem_ctl_info *mci,
> + const char *data, size_t count)
> +{
> + struct amd64_pvt *pvt = mci->pvt_info;
> + unsigned long long value;
> + int rc;
> +
> + rc = strict_strtoull(data, 16, &value);
> + if (rc != -EINVAL) {
> + debugf0("%s() received NBEA= 0x%llx\n", __func__, value);
> +
> + /* place the value into the virtual error packet */
> + pvt->ctl_error_info.nbeal = (u32) value;
> + value >>= 32;
> + pvt->ctl_error_info.nbeah = (u32) value;
> +
> + /* Process the Mapping request */
> + /* TODO: Add race preventation */
> + amd64_process_error_info(mci, &pvt->ctl_error_info, 1);
> +
> + return count;
> + }
> + return 0;
I think we want to return `rc' here, not zero?
> +}
> +
> +/*
> + * amd64_nbea_show
> + *
> + * display back what the last NBEA address was written
> + */
> +static ssize_t amd64_nbea_show(struct mem_ctl_info *mci, char *data)
> +{
> + struct amd64_pvt *pvt = mci->pvt_info;
> + u64 value;
> +
> + value = pvt->ctl_error_info.nbeah;
> + value <<= 32;
> + value |= pvt->ctl_error_info.nbeal;
> +
> + return sprintf(data, "%lx\n", (unsigned long) value);
fyi, you could simply do
return sprintf(data, "%llx\n", value);
here (and in all the other places). `u64' will always be implemented
as `unsigned long long' on this architecture. One day _all_ 64-bit
architectures will use ull for u64 and zillions of these typecasts will
no longer be needed. You'll be safe preparing for that day in this
driver ;)
> +}
> +
> +/*
> + * amd64_nbsl_store
> + *
> + * accept and store the NBSL value user desires
> + */
> +static ssize_t amd64_nbsl_store(struct mem_ctl_info *mci,
> + const char *data, size_t count)
> +{
> + struct amd64_pvt *pvt = mci->pvt_info;
> + unsigned long value;
> + int rc;
> +
> + rc = strict_strtoul(data, 16, &value);
> + if (rc != -EINVAL) {
> + debugf0("%s() received NBSL= 0x%lx\n", __func__, value);
> +
> + /* place the NBSL value into the virtual error packet */
> + pvt->ctl_error_info.nbsl = (u32) value;
> +
> + return count;
> + }
> + return 0;
Again, this should report the error.
> +}
> +
>
> ...
>
> +/*
> + * amd64_nbsh_store
> + *
> + * accept and store the NBSH value user desires
> + */
> +static ssize_t amd64_nbsh_store(struct mem_ctl_info *mci,
> + const char *data, size_t count)
> +{
> + struct amd64_pvt *pvt = mci->pvt_info;
> + unsigned long value;
> + int rc;
> +
> + rc = strict_strtoul(data, 16, &value);
> + if (rc != -EINVAL) {
> + debugf0("%s() received NBSL= 0x%lx\n", __func__, value);
> +
> + /* place the NBSL value into the virtual error packet */
> + pvt->ctl_error_info.nbsh = (u32) value;
> +
> + return count;
> + }
Many instances...
> + return 0;
> +}
> +
>
> ...
>
> +static ssize_t amd64_hole_show(struct mem_ctl_info *mci, char *data)
> +{
> + u64 hole_base = 0;
> + u64 hole_offset = 0;
> + u64 hole_size = 0;
> +
> + amd64_get_dram_hole_info(mci, &hole_base, &hole_offset, &hole_size);
> +
> + return sprintf(data, "%lx %lx %lx\n",
> + (long unsigned int) hole_base,
> + (long unsigned int) hole_offset,
> + (long unsigned int) hole_size);
hm, odd. We'd normally use plain old `unsigned long' here. But as
mentioned above, we can remove these casts.
> +}
>
> ...
>
next prev parent reply other threads:[~2009-04-28 18:33 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-28 15:05 [RFC PATCH 00/21] amd64_edac: EDAC module for AMD64 Borislav Petkov
2009-04-28 15:05 ` [PATCH 01/21] amd64_edac: add PCI config register defines Borislav Petkov
2009-04-28 15:05 ` [PATCH 02/21] amd64_edac: add driver structs Borislav Petkov
2009-04-28 18:13 ` Andrew Morton
2009-04-28 19:02 ` Borislav Petkov
2009-04-28 15:05 ` [PATCH 03/21] amd64_edac: add memory scrubber interface Borislav Petkov
2009-04-28 15:05 ` [PATCH 04/21] amd64_edac: add sys addr to memory controller mapping helpers Borislav Petkov
2009-04-28 15:05 ` [PATCH 05/21] amd64_edac: add functionality to compute the DRAM hole Borislav Petkov
2009-04-28 15:05 ` [PATCH 06/21] amd64_edac: add DRAM address type conversion facilities Borislav Petkov
2009-04-28 15:05 ` [PATCH 07/21] amd64_edac: add helper to dump relevant registers Borislav Petkov
2009-04-28 15:06 ` [PATCH 08/21] amd64_edac: assign DRAM chip select base and mask in a family-specific way Borislav Petkov
2009-04-28 15:06 ` [PATCH 09/21] amd64_edac: add k8-specific methods Borislav Petkov
2009-04-28 15:06 ` [PATCH 10/21] amd64_edac: add f10-and-later methods-p1 Borislav Petkov
2009-04-28 15:06 ` [PATCH 11/21] amd64_edac: add f10-and-later methods-p2 Borislav Petkov
2009-04-28 15:06 ` [PATCH 12/21] amd64_edac: add f10-and-later methods-p3 Borislav Petkov
2009-04-28 15:06 ` [PATCH 13/21] amd64_edac: add per-family descriptors Borislav Petkov
2009-04-28 15:06 ` [PATCH 14/21] amd64_edac: add msr accessors operating on all cpus Borislav Petkov
2009-04-28 18:21 ` Andrew Morton
2009-04-28 18:31 ` H. Peter Anvin
2009-04-28 19:23 ` Borislav Petkov
2009-04-28 15:06 ` [PATCH 15/21] amd64_edac: add x4 chipkill syndrome mapping table Borislav Petkov
2009-04-28 15:06 ` [PATCH 16/21] amd64_edac: add error decoding logic Borislav Petkov
2009-04-28 15:06 ` [PATCH 17/21] amd64_edac: add EDAC core-related initializers Borislav Petkov
2009-04-28 15:06 ` [PATCH 18/21] amd64_edac: add ECC reporting initializers Borislav Petkov
2009-04-28 15:06 ` [PATCH 19/21] amd64_edac: add debugging/testing code Borislav Petkov
2009-04-28 18:30 ` Andrew Morton [this message]
2009-04-28 15:06 ` [PATCH 20/21] amd64_edac: add DRAM error injection logic using sysfs Borislav Petkov
2009-04-28 15:06 ` [PATCH 21/21] amd64_edac: add module registration routines Borislav Petkov
2009-04-28 15:58 ` [RFC PATCH 00/21] amd64_edac: EDAC module for AMD64 Greg KH
2009-04-28 16:06 ` Borislav Petkov
2009-04-28 18:34 ` Andrew Morton
2009-04-28 19:58 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2009-04-29 16:54 [RFC PATCH 00/21 v2] " Borislav Petkov
2009-04-29 16:55 ` [PATCH 19/21] amd64_edac: add debugging/testing code Borislav Petkov
2009-04-29 18:18 ` Ingo Molnar
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=20090428113050.25f4b445.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=borislav.petkov@amd.com \
--cc=dougthompson@xmission.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/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