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
This commit is contained in:
Marius Strobl 2005-09-28 15:01:58 +00:00
parent b7c96c0d0b
commit c7974ff135
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150687

View File

@ -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);