summaryrefslogtreecommitdiffstats
path: root/sys/isa/pnp.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2005-09-28 15:01:58 +0000
committermarius <marius@FreeBSD.org>2005-09-28 15:01:58 +0000
commit5c195d91b5e8d4ec053712dc4c5ee968128fe09e (patch)
tree7b348a1285cab3077d05b838b62c8f303def890d /sys/isa/pnp.c
parentfe0a34c8f15fa82e0fec35f34ee9c6efe4abdcc4 (diff)
downloadFreeBSD-src-5c195d91b5e8d4ec053712dc4c5ee968128fe09e.zip
FreeBSD-src-5c195d91b5e8d4ec053712dc4c5ee968128fe09e.tar.gz
Fix an endianness issue in pnp_eisaformat(). This corrects printing PnP IDs
on big-endian archs like sparc64, e.g.: uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 43 pnpid @HEd041 on isa0 is now correctly printed as: uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 43 pnpid PNP0501 on isa0 There are probably other endianness issues lurking in the PnP code which however aren't exhibited on sparc64 as the PnP devices there are sort of PnP BIOS devices rather than ISA PnP devices. Tested on: i386, sparc64 MFC after: 1 week
Diffstat (limited to 'sys/isa/pnp.c')
-rw-r--r--sys/isa/pnp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/isa/pnp.c b/sys/isa/pnp.c
index d57e49e..2b9db6b 100644
--- a/sys/isa/pnp.c
+++ b/sys/isa/pnp.c
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
+#include <sys/endian.h>
#include <sys/malloc.h>
#include <isa/isavar.h>
#include <isa/pnpreg.h>
@@ -114,10 +115,12 @@ static int pnp_isolation_protocol(device_t parent);
char *
pnp_eisaformat(uint32_t id)
{
- uint8_t *data = (uint8_t *) &id;
+ uint8_t *data;
static char idbuf[8];
const char hextoascii[] = "0123456789abcdef";
+ id = htole32(id);
+ data = (uint8_t *)&id;
idbuf[0] = '@' + ((data[0] & 0x7c) >> 2);
idbuf[1] = '@' + (((data[0] & 0x3) << 3) + ((data[1] & 0xe0) >> 5));
idbuf[2] = '@' + (data[1] & 0x1f);
OpenPOWER on IntegriCloud