All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi/cper: Fix endianness of PCI class code
@ 2017-05-05 18:38 ` Lukas Wunner
  0 siblings, 0 replies; 27+ messages in thread
From: Lukas Wunner @ 2017-05-05 18:38 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA, Ashok Raj
  Cc: linux-pci-u79uwXL29TY76Z2rM5mHXA, Huang Ying

The CPER parser assumes that the class code is big endian, but at least
on this edk2-derived Intel Purley platform it's little endian:

    efi: EFI v2.50 by EDK II BIOS ID:PLYDCRB1.86B.0119.R05.1701181843
    DMI: Intel Corporation PURLEY/PURLEY, BIOS PLYDCRB1.86B.0119.R05.1701181843 01/18/2017

    {1}[Hardware Error]:   device_id: 0000:5d:00.0
    {1}[Hardware Error]:   slot: 0
    {1}[Hardware Error]:   secondary_bus: 0x5e
    {1}[Hardware Error]:   vendor_id: 0x8086, device_id: 0x2030
    {1}[Hardware Error]:   class_code: 000406
                                       ^^^^^^ (should be 060400)

Cc: Huang Ying <ying.huang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Ashok Raj <ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
---

@Ashok Raj: Could you test if this patch results in the correct
PCI class being logged? Thanks!

 drivers/firmware/efi/cper.c | 5 ++---
 include/linux/cper.h        | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
index d42537425438..e360c8b77bd9 100644
--- a/drivers/firmware/efi/cper.c
+++ b/drivers/firmware/efi/cper.c
@@ -364,7 +364,6 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
 		printk("%s""command: 0x%04x, status: 0x%04x\n", pfx,
 		       pcie->command, pcie->status);
 	if (pcie->validation_bits & CPER_PCIE_VALID_DEVICE_ID) {
-		const __u8 *p;
 		printk("%s""device_id: %04x:%02x:%02x.%x\n", pfx,
 		       pcie->device_id.segment, pcie->device_id.bus,
 		       pcie->device_id.device, pcie->device_id.function);
@@ -374,8 +373,8 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
 		       pcie->device_id.secondary_bus);
 		printk("%s""vendor_id: 0x%04x, device_id: 0x%04x\n", pfx,
 		       pcie->device_id.vendor_id, pcie->device_id.device_id);
-		p = pcie->device_id.class_code;
-		printk("%s""class_code: %02x%02x%02x\n", pfx, p[0], p[1], p[2]);
+		printk("%s""class_code: 0x%06x\n", pfx,
+		       pcie->device_id.class_code);
 	}
 	if (pcie->validation_bits & CPER_PCIE_VALID_SERIAL_NUMBER)
 		printk("%s""serial number: 0x%04x, 0x%04x\n", pfx,
diff --git a/include/linux/cper.h b/include/linux/cper.h
index dcacb1a72e26..fbfb50f52362 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -416,7 +416,7 @@ struct cper_sec_pcie {
 	struct {
 		__u16	vendor_id;
 		__u16	device_id;
-		__u8	class_code[3];
+		__u32	class_code:24;
 		__u8	function;
 		__u8	device;
 		__u16	segment;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-05-26 10:45 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 18:38 [PATCH] efi/cper: Fix endianness of PCI class code Lukas Wunner
2017-05-05 18:38 ` Lukas Wunner
     [not found] ` <771bc335fb5856792d086ae7db288dcf244cb4cd.1493964354.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-05-06  7:46   ` Ard Biesheuvel
2017-05-06  7:46     ` Ard Biesheuvel
2017-05-06  9:07     ` Lukas Wunner
2017-05-10  8:03       ` Ard Biesheuvel
2017-05-10  8:12         ` Arnd Bergmann
2017-05-10  8:41         ` Lukas Wunner
2017-05-11 14:06           ` Ard Biesheuvel
     [not found]             ` <CAKv+Gu81gvNL1jkb3T35=-5fr_x-BmSg9X2CcQ97xv5JTZ-c1A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-11 14:48               ` David Daney
2017-05-11 14:48                 ` David Daney
2017-05-25 12:30               ` Lukas Wunner
2017-05-25 12:30                 ` Lukas Wunner
     [not found]                 ` <20170525123047.GA4172-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-05-25 12:36                   ` Ard Biesheuvel
2017-05-25 12:36                     ` Ard Biesheuvel
     [not found]                     ` <CAKv+Gu_3vYKGOrzC8+Y3QwXOtV8Tbm8HC7nzQCdKVB1Qbdoriw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-25 12:44                       ` Lukas Wunner
2017-05-25 12:44                         ` Lukas Wunner
2017-05-25 12:47                         ` Ard Biesheuvel
2017-05-25 12:56                           ` Lukas Wunner
     [not found]                             ` <20170525125650.GA4196-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-05-25 13:07                               ` Ard Biesheuvel
2017-05-25 13:07                                 ` Ard Biesheuvel
2017-05-26  6:08                                 ` Lukas Wunner
2017-05-26  8:01                                   ` Arnd Bergmann
2017-05-26 10:45                                     ` Lukas Wunner
2017-05-26  9:16                                   ` Ard Biesheuvel
     [not found]                                     ` <CAKv+Gu_fbNSK+LuWmQGqLHtu3rF9BdYwNB+K-myNXS=X+goXkQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-26 10:43                                       ` Lukas Wunner
2017-05-26 10:43                                         ` Lukas Wunner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.