X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffbsd-device.c;h=ba3337c84c18c13b3ce5cb4f6f5573e3c0c17f78;hb=d1058e9dee26b0ae0f8a595e07bfdee20a5fecef;hp=13dc91a47cef88ae799c826195f2a60b0d7cc9e6;hpb=168b4f4612e4524fe68cacbd036df01cdbdbd007;p=pciutils.git diff --git a/lib/fbsd-device.c b/lib/fbsd-device.c index 13dc91a..ba3337c 100644 --- a/lib/fbsd-device.c +++ b/lib/fbsd-device.c @@ -2,28 +2,41 @@ * The PCI Library -- FreeBSD /dev/pci access * * Copyright (c) 1999 Jari Kirma + * Updated in 2003 by Samy Al Bahra * * Can be freely distributed and used under the terms of the GNU GPL. */ -/* - * Read functionality of this driver is briefly tested, and seems - * to supply basic information correctly, but I promise no more. - */ - #include #include #include - -#include -#include +#include +#include + +#ifdef __FreeBSD_kernel_version +# ifndef __FreeBSD_version +# define __FreeBSD_version __FreeBSD_kernel_version +# endif +#endif + +#if __FreeBSD_version < 500000 +# include +#else +# include +#endif + +#if __FreeBSD_version < 430000 +# include +#else +# include +#endif #include "internal.h" static void fbsd_config(struct pci_access *a) { - a->method_params[PCI_ACCESS_FBSD_DEVICE] = PATH_FBSD_DEVICE; + a->method_params[PCI_ACCESS_FBSD_DEVICE] = PCI_PATH_FBSD_DEVICE; } static int @@ -68,6 +81,9 @@ fbsd_read(struct pci_dev *d, int pos, byte *buf, int len) return pci_generic_block_read(d, pos, buf, len); } + if (pos >= 256) + return 0; + pi.pi_sel.pc_bus = d->bus; pi.pi_sel.pc_dev = d->dev; pi.pi_sel.pc_func = d->func; @@ -103,6 +119,9 @@ fbsd_write(struct pci_dev *d, int pos, byte *buf, int len) return pci_generic_block_write(d, pos, buf, len); } + if (pos >= 256) + return 0; + pi.pi_sel.pc_bus = d->bus; pi.pi_sel.pc_dev = d->dev; pi.pi_sel.pc_func = d->func;