From 70a66689fc2e44e7cd693947ed5f3f2acb4b6587 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 22 May 2006 16:10:37 +0000 Subject: [PATCH] Fix foolish endianess bug. Bump to version 0.4.1. --- ChangeLog | 10 +++++++++- src/Makefile.am | 2 +- src/linux_sysfs.c | 11 ++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3aa3d3d..f5b2497 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-05-09 Ian Romanick + + * src/linux_sysfs.c: (pci_device_linux_sysfs_probe): + Fix foolish endianess bug. + + * src/Makefile.am: + Bump to version 0.4.1. + 2006-04-12 Ian Romanick * configure.ac: @@ -23,7 +31,7 @@ * src/linux_sysfs.c: (pci_device_linux_sysfs_read_rom), (pci_device_linux_sysfs_map_region), (pci_device_linux_sysfs_unmap_region): - Fix serious bus in the reading of ROMs and in the unmapping of + Fix serious bugs in the reading of ROMs and in the unmapping of regions. The main point is that the map routine depens on the pci_mem_region::memory pointer being non-NULL only when the region is mapped. Therefore, the unmap routine should set it to NULL after diff --git a/src/Makefile.am b/src/Makefile.am index d8d5472..20b864f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,7 +34,7 @@ INCLUDES = -I$(top_srcdir)/include libpciaccess_la_LIBADD = @PCIACCESS_LIBS@ -libpciaccess_la_LDFLAGS = -version-number 0:4:0 -no-undefined +libpciaccess_la_LDFLAGS = -version-number 0:4:1 -no-undefined libpciaccessincludedir = $(includedir) libpciaccessinclude_HEADERS = \ diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c index 7008cef..d510734 100644 --- a/src/linux_sysfs.c +++ b/src/linux_sysfs.c @@ -179,12 +179,13 @@ pci_device_linux_sysfs_probe( struct pci_device * dev ) err = pci_device_linux_sysfs_read( dev, config, 0, 256, & bytes ); if ( bytes >= 64 ) { - dev->vendor_id = ((uint16_t *) config)[0]; - dev->device_id = ((uint16_t *) config)[1]; - dev->device_class = (((uint32_t *) config)[2]) >> 8; + dev->vendor_id = (uint16_t)config[0] + ((uint16_t)config[1] << 8); + dev->device_id = (uint16_t)config[2] + ((uint16_t)config[3] << 8); + dev->device_class = (uint32_t)config[11] + ((uint32_t)config[10] << 8) + + ((uint16_t)config[9] << 16); dev->revision = config[8]; - dev->subvendor_id = ((uint16_t *) config)[22]; - dev->subdevice_id = ((uint16_t *) config)[23]; + dev->subvendor_id = (uint16_t)config[44] + ((uint16_t)config[45] << 8); + dev->subdevice_id = (uint16_t)config[46] + ((uint16_t)config[47] << 8); dev->irq = config[60]; -- 2.7.4