Merge libpciaccess 0.10.2, including kettenis@ OpenBSD port.
This commit is contained in:
parent
a8393f0f0c
commit
b9c810fd57
@ -1,98 +1,606 @@
|
||||
2006-05-09 Ian Romanick <idr@us.ibm.com>
|
||||
commit 4586bb6766983d040bff38b43dc458c47e0ca21f
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Wed May 21 13:44:38 2008 -0400
|
||||
|
||||
* src/linux_sysfs.c: (pci_device_linux_sysfs_probe):
|
||||
Fix foolish endianess bug.
|
||||
Linux: Fail gracefully on machines without PCI.
|
||||
|
||||
* src/Makefile.am:
|
||||
Bump to version 0.4.1.
|
||||
commit 26400575a2a2d10b1014eaf0bfca6cfbf5d9b93b
|
||||
Author: Dave Airlie <airlied@redhat.com>
|
||||
Date: Wed May 21 16:10:37 2008 +1000
|
||||
|
||||
2006-04-12 Ian Romanick <idr@us.ibm.com>
|
||||
pciaccess: bump to 0.10.1
|
||||
|
||||
* configure.ac:
|
||||
* src/Makefile.am:
|
||||
Bump to version 0.4.0.
|
||||
commit 4bc9292ff9338e759eb9a73f12edfa5ca87353e0
|
||||
Author: Dave Airlie <airlied@redhat.com>
|
||||
Date: Wed May 21 16:10:24 2008 +1000
|
||||
|
||||
* include/pciaccess.h:
|
||||
Add multiple-inclusion protection.
|
||||
linux: add pci_device_enable entrypoint and sysfs support for it
|
||||
|
||||
* src/common_interface.c: (pci_device_cfg_write_bits):
|
||||
Add new function to write masked bits to PCI config space.
|
||||
This mirrors functionality currently available in X.org that is slated
|
||||
to be removed.
|
||||
commit ded8326f2adadc773b34889474a0d4fc20ef387a
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Fri May 9 15:15:42 2008 -0700
|
||||
|
||||
* src/common_iterator.c: (pci_slot_match_iterator_create),
|
||||
(pci_id_match_iterator_create), (pci_iterator_destroy),
|
||||
(pci_device_next), (pci_device_find_by_slot):
|
||||
Gut old regex based search mechanism with a new mechanism that is
|
||||
modeled after the Linux kernel. In addition to searching for
|
||||
devices by device / vendor ID, it is possible to search for devices
|
||||
by their domain / bus / slot / function.
|
||||
Fix lint warnings in solx_devfs.c
|
||||
|
||||
* src/linux_sysfs.c: (pci_device_linux_sysfs_read_rom),
|
||||
(pci_device_linux_sysfs_map_region),
|
||||
(pci_device_linux_sysfs_unmap_region):
|
||||
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
|
||||
unmapping.
|
||||
commit 74c976a7bcee3102993cf788850d0b803cf15afd
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Fri May 9 15:05:46 2008 -0700
|
||||
|
||||
* src/scanpci.c: (main):
|
||||
Update to use new search API.
|
||||
Add pci_system_solx_devfs_create prototype to pciaccess_private.h
|
||||
|
||||
2006-03-27 Ian Romanick <idr@us.ibm.com>
|
||||
commit 2ac461b2eca788fa0559312d45efd3caf6eea9bb
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Fri May 9 14:49:32 2008 -0700
|
||||
|
||||
* Makefile.am:
|
||||
Remove src/pcils.c and src/Makefile.foo. Add src/scanpci.c.
|
||||
Initialize err to 0 in pci_device_solx_devfs_map_range
|
||||
|
||||
Prevents returning errors when mapping actually succeeds
|
||||
|
||||
* configure.ac:
|
||||
* src/Makefile.am:
|
||||
Bump version to 0.3.0.
|
||||
commit b30d458202bc0304c705eb081b12ead860584bea
|
||||
Author: Keith Packard <keithp@keithp.com>
|
||||
Date: Wed Apr 16 12:10:52 2008 -0700
|
||||
|
||||
* include/pciaccess.h:
|
||||
* src/common_device_name.c: (pci_get_strings):
|
||||
Replace pci_get_name with pci_get_strings. This function
|
||||
matches the functionality provided by the Xorg scanpci module
|
||||
almost identically.
|
||||
Kludge around linux bug and turn off write-through and cache-disable bits
|
||||
|
||||
When mmaping the PCI device, the kernel turns on the write-through and
|
||||
cache-disable bits in the allocated PTEs. This disables write-combining mode
|
||||
and dramatically reduces write bandwidth to the frame buffer. While that
|
||||
should be fixed in the kernel, we'll kludge around it here by using mprotect
|
||||
to rewrite the PTEs and get those bits turned off.
|
||||
|
||||
2006-03-24 Ian D. Romanick <idr@us.ibm.com>
|
||||
commit a3b63c43b960e3b37e1b303214e63c5155192a5d
|
||||
Author: Hasso Tepper <hasso@estpak.ee>
|
||||
Date: Mon Apr 7 15:28:44 2008 +0300
|
||||
|
||||
* src/Makefile.foo: Drop from CVS.
|
||||
Add DragonFly BSD support
|
||||
|
||||
DragonFly behaves exactly like FreeBSD, so no problem here.
|
||||
|
||||
2006-03-20 Kristian Høgsberg <krh@redhat.com>
|
||||
commit ec53d6ef2bdf0e7a087ffd45fe112290f2181656
|
||||
Author: Danny van Dyk <danny.dyk@uni-dortmund.de>
|
||||
Date: Fri Mar 28 17:01:29 2008 -0700
|
||||
|
||||
* src/Makefile.am (noinst_PROGRAMS): Add scanpci as a noinst target.
|
||||
* src/Makefile.in: Drop from CVS.
|
||||
Fix function prototypes for C++
|
||||
|
||||
2006-03-17 Ian D. Romanick <idr@us.ibm.com>
|
||||
commit a5c862029846ddd5cecf44819f2a967e2a1672a9
|
||||
Author: Stuart Bennett <sb476@cam.ac.uk>
|
||||
Date: Fri Mar 14 11:58:33 2008 -0400
|
||||
|
||||
* configure.ac, src/common_device_name.c
|
||||
Added configure option (--with-pciids-path) to set the default
|
||||
place to look for the pci.ids file.
|
||||
Bug #13988: Fix reads from "0"-sized ROMs.
|
||||
|
||||
2006-03-16 Ian D. Romanick <idr@us.ibm.com>
|
||||
commit d898072e28ac35f5b3569f48f2e90a9ef8eee2ca
|
||||
Author: Mark Kettenis <mark.kettenis@xs4all.nl>
|
||||
Date: Wed Mar 12 21:29:58 2008 +0100
|
||||
|
||||
* src/pcils.c, src/scanpci.c, src/Makefile.foo
|
||||
Made pcils more like XFree86's scanpci utility than lspci. Changed
|
||||
the name of the source file from pcils.c to scanpci.c. Eventually
|
||||
this will be it's own project somewhere else (or it will whither and
|
||||
die).
|
||||
OpenBSD support for libpciaccess.
|
||||
|
||||
xserver and libpciaccess both need to open /dev/xf86, which can only
|
||||
be opened once. I implemented pci_system_init_dev_mem() like Ian
|
||||
suggested. This requires some minor changes to the BSD-specific
|
||||
os-support code. Since pci_system_init_dev_mem() is a no-op on
|
||||
FreeBSD this should be no problem.
|
||||
|
||||
2006-03-15 Ian D. Romanick <idr@us.ibm.com>
|
||||
commit 4224ff23794500e1455f28fd5689bd0549b72367
|
||||
Author: Julien Cristau <jcristau@debian.org>
|
||||
Date: Fri Mar 7 14:41:47 2008 +0100
|
||||
|
||||
* First round of autotools madness.
|
||||
solaris: add pci_tools.h to OS_SUPPORT
|
||||
|
||||
pci_tools.h was missing from the tarball, but is needed by solx_devfs.c
|
||||
|
||||
2006-02-24 Ian D. Romanick <idr@us.ibm.com>
|
||||
commit ac119e0b1d5fdbb6bd447b6cef1ddca59840fe40
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Thu Mar 6 15:31:51 2008 -0500
|
||||
|
||||
* common_device_name.c, pciaccess.h, pcils.c:
|
||||
Add interfaces for querying the device, vendor, subdevice, and
|
||||
subvendor name strings from pci.ids.
|
||||
libpciaccess 0.10
|
||||
|
||||
2006-02-20 Ian D. Romanick <idr@us.ibm.com>
|
||||
commit 0ac748d0da1361075efa48a6238f2328d24ba1a8
|
||||
Author: Doug Chapman <doug.chapman@hp.com>
|
||||
Date: Thu Mar 6 14:22:17 2008 -0500
|
||||
|
||||
* common_agp.c:
|
||||
Removed this file. It was an old version of what became
|
||||
common_capability.c.
|
||||
Bug #14818: Actually return the PCI vendor name, instead of NULL.
|
||||
|
||||
* common_capability.c:
|
||||
Fixed an issue with AGP rate detection for AGP3 devices.
|
||||
commit adc46f65d7a097ea0e8427a2496586a420c99d55
|
||||
Author: Julien Cristau <jcristau@debian.org>
|
||||
Date: Tue Feb 19 14:45:40 2008 +0100
|
||||
|
||||
Don't export private symbols.
|
||||
|
||||
commit 25de45d250811474e86cb9a09caf258aef699196
|
||||
Author: Julien Cristau <jcristau@debian.org>
|
||||
Date: Tue Feb 19 14:26:54 2008 +0100
|
||||
|
||||
Use <byteswap.h> when using glibc, not just on linux
|
||||
|
||||
This fixes the build on GNU/kFreeBSD.
|
||||
|
||||
commit ceda00d33fbf3d491e3f7e53302acd2b8b74a305
|
||||
Author: James Cloos <cloos@jhcloos.com>
|
||||
Date: Thu Dec 6 16:38:51 2007 -0500
|
||||
|
||||
Replace static ChangeLog with dist-hook to generate from git log
|
||||
|
||||
commit e392082abb5696c8837224da86cc0af4f21d7010
|
||||
Author: Matthias Hopf <mhopf@suse.de>
|
||||
Date: Tue Oct 23 15:19:36 2007 +0200
|
||||
|
||||
Bit-fields have to have type _Bool, signed int, or unsigned int.
|
||||
|
||||
ISO/IEC 9899:1999 (E), 6.7.2.1 Structure and union specifiers, (4).
|
||||
_Bool is only supported for C99 and up, and 1-bit signed types don't make
|
||||
sense -> unsigned int.
|
||||
|
||||
commit 5b9ca552a17de37bbac84f0cf5b4430d108e576c
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Thu Oct 18 15:59:14 2007 -0700
|
||||
|
||||
Update bug reporting link.
|
||||
|
||||
commit 57a942b3cca314a56735e0a4198cac2f25b653dd
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Wed Oct 10 15:20:51 2007 -0700
|
||||
|
||||
FreeBSD: for 64-bit BARs, skip the resource slot used for the upper 32 bits.
|
||||
|
||||
This gets us the same resource numbering as on Linux.
|
||||
|
||||
commit 127ae628a2090bb00df81adce831b8b031d3b4a8
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Wed Oct 10 14:55:45 2007 -0700
|
||||
|
||||
FreeBSD: Don't try to unset an MTRR if we didn't set it.
|
||||
|
||||
commit 28fea32f987a74d365d01bc5870a8bce1c393d59
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Wed Oct 10 14:32:38 2007 -0700
|
||||
|
||||
Add domain output to scanpci.
|
||||
|
||||
commit 393145db90578d7d598fccf949b249217066a67c
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Wed Oct 10 14:32:09 2007 -0700
|
||||
|
||||
FreeBSD: Add support for multiple PCI domains.
|
||||
|
||||
commit 7d809e149b59f22e24723db7360a4c38a9145b45
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Tue Oct 9 12:13:49 2007 -0700
|
||||
|
||||
FreeBSD: Fix unmap_range to return an error value.
|
||||
|
||||
commit 042735df2aa5846fcabfd74c5f73877132728b25
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Tue Oct 9 12:12:34 2007 -0700
|
||||
|
||||
FreeBSD: don't set the MTRR if it's the default mode (uncacheable).
|
||||
|
||||
commit 4bdaca5295eeacdaeb80f2e7d0fa17674dcbc77a
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Thu Sep 27 15:22:51 2007 -0700
|
||||
|
||||
Need to link with -ldevinfo on Solaris
|
||||
|
||||
commit 63983e2397d813246b851771c13397ff700e239e
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Wed Sep 26 17:26:47 2007 -0700
|
||||
|
||||
Fix Solaris build: missing static prototype & typo in variable name
|
||||
|
||||
commit 8c77862e70eac7f61cd402e9ef33a5b0ca1c6426
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Tue Sep 11 15:07:55 2007 +0000
|
||||
|
||||
Add FreeBSD MTRR setting support.
|
||||
|
||||
commit 82a2ff0bb091e097bacb66273f55a287afb15abf
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Tue Sep 4 16:13:24 2007 -0700
|
||||
|
||||
Add stub version of pci_device_map_memory_range
|
||||
|
||||
This stub version of pci_device_map_memory_range allows the vesa driver and
|
||||
other users of this interface to continue functioning with current
|
||||
libpciaccess bits. That said, users of this interface should convert over
|
||||
to pci_device_map_range as soon as possible.
|
||||
|
||||
commit 9d1596cba90c8fd273e9d1d5488747cc0f34fdc7
|
||||
Merge: b1e9117... 5cf29b0...
|
||||
Author: James Cloos <cloos@jhcloos.com>
|
||||
Date: Mon Sep 3 06:15:58 2007 -0400
|
||||
|
||||
Merge branch 'master' of ssh://git.freedesktop.org/git/xorg/lib/libpciaccess
|
||||
|
||||
commit b1e911784d314fdbd8d938e5fe3671bec128fb61
|
||||
Author: James Cloos <cloos@jhcloos.com>
|
||||
Date: Mon Sep 3 05:53:57 2007 -0400
|
||||
|
||||
Add *~ to .gitignore to skip patch/emacs droppings
|
||||
|
||||
commit 5cf29b06b9b5806056a0b04160b2286eb4158748
|
||||
Author: Keith Packard <keithp@koto.keithp.com>
|
||||
Date: Fri Aug 31 13:43:18 2007 -0700
|
||||
|
||||
Don't add MTRR for uncached regions. Remove MTRR on unmap.
|
||||
|
||||
MTRR regions aren't needed for uncached mappings, so don't add them. Also,
|
||||
when unmapping memory, remove the MTRR entry.
|
||||
|
||||
commit ebc618e7508847307713a59aeeed337a9277629d
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Fri Aug 31 12:40:03 2007 -0700
|
||||
|
||||
Update / add comments in struct pci_mem_region.
|
||||
|
||||
commit 08ff9f7fbd26dd2d0e30351b556c71c272f6be6c
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Thu Aug 30 17:52:02 2007 -0700
|
||||
|
||||
New interfaces to map memory with MTRR (or similar) support.
|
||||
|
||||
Added new functions pci_device_map_range and pci_device_unmap_range to
|
||||
handle mapping of PCI device BARs. These new interfaces allow the
|
||||
possiblity of MTRRs on platforms that support them.
|
||||
|
||||
These additional APIs necessitated changing some internal interfaces. The
|
||||
code for FreeBSD and Solaris has been updated but has not been compiled or
|
||||
tested.
|
||||
|
||||
Old interfaces are marked deprecated and will eventually be removed.
|
||||
|
||||
commit c87273e8e20c8bff892ded31295dba103f27dd35
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Tue Aug 28 16:02:46 2007 -0700
|
||||
|
||||
Make the base address printout of scanpci more usable.
|
||||
|
||||
commit 47d625ccea7dbcd6b69009aa1ec64a96e97513f6
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Mon Aug 27 16:41:52 2007 -0700
|
||||
|
||||
Bump version to 0.9.1 (sigh).
|
||||
|
||||
commit 73197e09c924dabc18b8839180508584b97e03df
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Mon Aug 27 16:41:21 2007 -0700
|
||||
|
||||
Add linux_devmem.h to file list.
|
||||
|
||||
commit 5e595d09e7011b82a90f74b149a97bea23ddfbf0
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Mon Aug 27 16:39:00 2007 -0700
|
||||
|
||||
Bump version to 0.9.0.
|
||||
|
||||
commit b0c9558c97ee861af240a948c364807e628e49de
|
||||
Author: James Cloos <cloos@jhcloos.com>
|
||||
Date: Thu Aug 23 21:31:50 2007 -0400
|
||||
|
||||
Remove deprecated .cvsignore files
|
||||
|
||||
commit 4e6be0466ad973ee6f63e0cbed466a974908dce8
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Aug 3 16:47:09 2007 -0700
|
||||
|
||||
FreeBSD: Add VGA rom reading through /dev/mem.
|
||||
|
||||
commit ae4aed2821161028dabd8381273f3803a24340ad
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Aug 3 10:46:55 2007 -0700
|
||||
|
||||
FreeBSD: Fill in the subdevice ID.
|
||||
|
||||
commit 14e62c77bd1ae6ef1d4048df2da96eeff8f7538f
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Aug 3 10:40:53 2007 -0700
|
||||
|
||||
Make scanpci exit cleanly if pci_system_init() fails.
|
||||
|
||||
commit a7faac3d2dc49a2130906fbeea3298f32bb9349f
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Mon Jun 18 12:56:40 2007 -0700
|
||||
|
||||
Initial support for reading expansion ROM via VGA BIOS address.
|
||||
|
||||
commit 206e29213f92dd639fb4814ed2f3b6ec27e6f985
|
||||
Author: edward shu <edward.shu@sun.com>
|
||||
Date: Wed Jun 6 23:05:56 2007 +0800
|
||||
|
||||
Libpciaccess on Solaris Initial integration
|
||||
|
||||
Libpciaccess on Solaris Initial integration. It depends on devfs to access
|
||||
pci configuration space, also xsvc is used for memory map.
|
||||
|
||||
commit db56c640028d2f8072274f3eb603caa481103f4f
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Tue Mar 27 08:01:39 2007 -0700
|
||||
|
||||
Whitespace police.
|
||||
|
||||
commit c6e72deddb3055167fff8007bf039be61e45849e
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Tue Mar 27 07:57:35 2007 -0700
|
||||
|
||||
Don't pci_device_probe until absolutely necessary.
|
||||
|
||||
commit 28dc34c2a6045ab95183d708500009bd1eea1659
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Tue Mar 27 07:57:00 2007 -0700
|
||||
|
||||
Make sure header_type is available in read_bridge_info.
|
||||
|
||||
commit 061a011ceffc13db3b147dd105d8b7c2edcc3bc8
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Tue Mar 27 07:56:16 2007 -0700
|
||||
|
||||
Populate device and vendor ID fields at device list creation.
|
||||
|
||||
commit b36d737d92dbeee7951aded990fa52bac39b2a79
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Tue Mar 6 10:48:51 2007 -0800
|
||||
|
||||
FreeBSD: Fix a couple of minor issues in cleanup paths.
|
||||
|
||||
commit 09be109c223b93d74ea3cc7a12d9a22b44990a14
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Thu Mar 1 10:49:13 2007 -0800
|
||||
|
||||
FreeBSD: Add system cleanup function.
|
||||
|
||||
commit f6502eee20205ec14ce6499251a28962cc36fdd6
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Wed Feb 28 16:25:07 2007 -0800
|
||||
|
||||
FreeBSD: When mapping regions, use the region's base address, not 0.
|
||||
|
||||
commit a4ec2f35ea5b4f74cf455be24f8ad25d4096ab98
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Wed Feb 28 16:13:44 2007 -0800
|
||||
|
||||
Fix inverted protection typo for mmap in region mapping.
|
||||
|
||||
commit 9819ae0c376db57a9de5fcbb2f1d4c3ee1ed2ea8
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Wed Feb 28 15:42:24 2007 -0800
|
||||
|
||||
scanpci prototype warning fix
|
||||
|
||||
commit e70b710133cc552df266d5046a53f7a241a569eb
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Wed Feb 28 15:39:38 2007 -0800
|
||||
|
||||
Update freebsd code for pci_device_cfg_write API change.
|
||||
|
||||
commit d86245be3bd57b29e5b7561b3facecb3298fea3b
|
||||
Author: George Sapountzis <gsap7@yahoo.gr>
|
||||
Date: Wed Nov 15 02:49:50 2006 +0200
|
||||
|
||||
scanpci: BIST line offsets were off by 4.
|
||||
|
||||
commit cc1d08f113140010f49503adc4e7afe5db892a02
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Tue Jan 16 21:24:12 2007 -0800
|
||||
|
||||
Fix bad parameter to pci_device_cfg_write in pci_device_cfg_write_u8.
|
||||
|
||||
When changing the interface of the pci_device_cfg_write_u* functions
|
||||
in commit 37ce43c1804bad9c52b8316eaefd3a57b670ee29, I forgot to modify
|
||||
pci_device_cfg_write_u8 to pass a pointer to data to
|
||||
pci_device_cfg_write instead of just passing data.
|
||||
|
||||
commit 54d40b528ab769c4e89aaca87d1728a6194e4378
|
||||
Merge: 37ce43c... 335d42f...
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Mon Jan 15 11:18:29 2007 -0800
|
||||
|
||||
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/lib/libpciaccess
|
||||
|
||||
commit 37ce43c1804bad9c52b8316eaefd3a57b670ee29
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Mon Jan 15 11:18:19 2007 -0800
|
||||
|
||||
Convert pci_device_write_u* funtions to take a value instead of a pointer.
|
||||
|
||||
At anholt's request, the pci_device_write_u* functions have been
|
||||
converted to take the value to be written as a parameter instead of a
|
||||
pointer to the value.
|
||||
|
||||
Bump the version to 0.8.0.
|
||||
|
||||
commit 335d42f637dd44461bc20ba599ca5dc4971b6eaa
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Jan 12 16:32:51 2007 -0800
|
||||
|
||||
Add support for getting region information on FreeBSD.
|
||||
|
||||
This could stand a lot more testing -- all it has received is visual inspection
|
||||
of scanpci output on one machine, with some differing results from XFree86
|
||||
scanpci output.
|
||||
|
||||
commit 94355b6f49a61e7424ddc7ddfc70a9b344233a47
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Jan 12 14:15:29 2007 -0800
|
||||
|
||||
Open the pci device read-write so we can read and write config regs.
|
||||
|
||||
With this, we can hook up the IRQ line information. It would probably be nice
|
||||
to have an unpriveleged mode, but for now, write access is required.
|
||||
|
||||
commit 253e7f672b8b311b18cf827cd12c9147bba8eb4c
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Jan 12 13:33:51 2007 -0800
|
||||
|
||||
Remove extra fallback definition of PCIIDS_PATH.
|
||||
|
||||
PCIIDS_PATH should always be provided by configure.ac and config.h.
|
||||
|
||||
commit 87ec7de307ab5bd395d01cdb4f8fdf231d9e769e
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Jan 12 13:13:27 2007 -0800
|
||||
|
||||
Fix many warnings and bugs in the freebsd implementation.
|
||||
|
||||
With this, scanpci gives partially-sane results.
|
||||
|
||||
commit 4f6e1a61fc0abe1865e147509af5f7f2bfcaf8f7
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Jan 12 13:11:21 2007 -0800
|
||||
|
||||
Enable more warnings when the compiler is GCC.
|
||||
|
||||
commit c7ce8ee140b01931994030900c0e8238fbb0caa2
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Fri Jan 12 13:06:50 2007 -0800
|
||||
|
||||
Add pciaccess_private.h to _SOURCES so it gets included in the dist.
|
||||
|
||||
commit c65aa7630802c8dfcc06a20e515ace31ab0d0e48
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Thu Jan 11 21:40:57 2007 -0800
|
||||
|
||||
Add interfaces to map / unmap specific memory ranges, bump lib version to 0.7.0.
|
||||
|
||||
Add pci_device_map_memory_range and pci_device_unmap_memory_range to
|
||||
map and unmap specific memory ranges. The unmap bit is still a bit
|
||||
hinkey (unmaps the whole BAR). Works so far for initial conversion of
|
||||
VESA driver. Will need to be revisited.
|
||||
|
||||
commit db4a12d09fba381f39af024418e913fb99c34935
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Thu Jan 11 21:39:15 2007 -0800
|
||||
|
||||
Fix bad cast that caused bit truncation.
|
||||
|
||||
commit 8948a6c3593d92a50a09baf568b69f164d7e7f59
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Tue Nov 14 14:38:48 2006 -0800
|
||||
|
||||
Update .gitignores.
|
||||
|
||||
commit 1d227d67d35aba4601c4ffd6a2947ee746d5dc47
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Tue Nov 14 14:37:53 2006 -0800
|
||||
|
||||
Add missing newline at the end of the file.
|
||||
|
||||
commit e29843d3b0ff5d32d8ab4bc84c58300782d189d3
|
||||
Merge: 07b09d9... d05da65...
|
||||
Author: Eric Anholt <eric@anholt.net>
|
||||
Date: Tue Nov 14 14:37:46 2006 -0800
|
||||
|
||||
Merge branch 'origin'
|
||||
|
||||
Conflicts:
|
||||
|
||||
src/Makefile.am
|
||||
|
||||
commit 07b09d930ed2b7eae299ae036ec30099374b95aa
|
||||
Author: Eric Anholt <anholt@FreeBSD.org>
|
||||
Date: Sun Jul 30 16:19:50 2006 -0700
|
||||
|
||||
Add the beginnings of a FreeBSD port.
|
||||
|
||||
commit d05da6520a273ee4c2f0e11b5a9bac65b51835fe
|
||||
Author: Ian Romanick <idr@localhost.localdomain>
|
||||
Date: Thu Aug 10 09:46:07 2006 -0700
|
||||
|
||||
Fix a segfault in populate_vendor that was triggered when the pci.ids file
|
||||
could not be opened. Thanks to Aaron Plattner for reporting this. Fix a
|
||||
couple possible memory leaks in the same function.
|
||||
|
||||
commit 27f0ffca71277371a0b6c0cd1a720a9ce9519da5
|
||||
Author: Ian Romanick <idr@localhost.localdomain>
|
||||
Date: Sun Jul 30 15:35:41 2006 -0700
|
||||
|
||||
Added some function preamble comments.
|
||||
|
||||
commit cf1b4d3ddfcdbaeddefc42b6eb19eb85a0a1e454
|
||||
Author: Eric Anholt <anholt@FreeBSD.org>
|
||||
Date: Sun Jul 30 14:29:58 2006 -0700
|
||||
|
||||
Add endian macros for BSD.
|
||||
|
||||
commit edf3908958eacc20162563b68aa45964f0e38b2c
|
||||
Author: Eric Anholt <anholt@FreeBSD.org>
|
||||
Date: Sun Jul 30 14:26:38 2006 -0700
|
||||
|
||||
Use ENXIO instead of ENODATA for pci reads returning less than desired.
|
||||
|
||||
commit c0e31708e0446b33240d3e1ba3e36c26a618544c
|
||||
Author: Ian Romanick <idr@umwelt.(none)>
|
||||
Date: Tue Jul 25 15:36:52 2006 -0700
|
||||
|
||||
Add pci_device_get_bridge_buses, bump API version to 0.5.0.
|
||||
|
||||
commit 2ba1a0e42928f82e678987c84598e1b9d8ba1ef9
|
||||
Author: Ian Romanick <idr@umwelt.(none)>
|
||||
Date: Thu Jul 6 17:18:14 2006 -0700
|
||||
|
||||
Files missed (for reasons I still don't understand) on the previous
|
||||
commit. REALLY add support for querying bridge information. Bump to
|
||||
version 0.5.0.
|
||||
|
||||
commit c0ff6e6141ee6ebb1f628931ae62f0fa8ef87061
|
||||
Author: Ian Romanick <idr@umwelt.(none)>
|
||||
Date: Thu Jul 6 17:09:47 2006 -0700
|
||||
|
||||
Add support for querying bridge information. Bump to version 0.5.0.
|
||||
|
||||
commit 2467b3c509c7e5b771ca21ee6317b2d72d481439
|
||||
Author: Ian Romanick <idr@umwelt.(none)>
|
||||
Date: Thu Jul 6 17:07:18 2006 -0700
|
||||
|
||||
Fix byte ordering of the PCI class.
|
||||
|
||||
commit 70a66689fc2e44e7cd693947ed5f3f2acb4b6587
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Mon May 22 16:10:37 2006 +0000
|
||||
|
||||
Fix foolish endianess bug. Bump to version 0.4.1.
|
||||
|
||||
commit 64af050c3803ed61837d9e9109c7a4e239a5c0b8
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Wed Apr 12 22:56:50 2006 +0000
|
||||
|
||||
Bump to version 0.4.0.
|
||||
Add multiple-inclusion protection.
|
||||
Add new function to write masked bits to PCI config space. This mirrors
|
||||
functionality currently available in X.org that is slated to be
|
||||
removed.
|
||||
Gut old regex based search mechanism with a new mechanism that is modeled
|
||||
after the Linux kernel. In addition to searching for devices by device
|
||||
/ vendor ID, it is possible to search for devices by their domain / bus
|
||||
/ slot / function.
|
||||
Fix serious bus 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 unmapping.
|
||||
Update to use new search API.
|
||||
|
||||
commit 5b4db5c392c123f71a7933bd94c789b5e23dd69a
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Mon Mar 27 18:08:42 2006 +0000
|
||||
|
||||
Remove src/pcils.c and src/Makefile.foo. Add src/scanpci.c.
|
||||
Bump version to 0.3.0.
|
||||
Replace pci_get_name with pci_get_strings. This function matches the
|
||||
functionality provided by the Xorg scanpci module almost identically.
|
||||
|
||||
commit 6b1e9fae2ab9979b2a3bb3137c5db4d92d2905c8
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Fri Mar 24 16:57:17 2006 +0000
|
||||
|
||||
Remove src/Makefile.foo from CVS since the generated Makefile can do
|
||||
everything now.
|
||||
|
||||
commit d890ded5312dc88455fd332e03a4f212ba587e9d
|
||||
Author: Kristian Høgsberg <krh@redhat.com>
|
||||
Date: Mon Mar 20 20:13:34 2006 +0000
|
||||
|
||||
Add scanpci as a noinst target.
|
||||
Drop from CVS.
|
||||
|
||||
commit 5a04522a921cd8737ef921dfd49b750a8c64dfc9
|
||||
Author: Ian Romanick <idr@us.ibm.com>
|
||||
Date: Sat Mar 18 00:12:48 2006 +0000
|
||||
|
||||
Initial import of libpciaccess.
|
||||
|
@ -27,3 +27,13 @@ pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = pciaccess.pc
|
||||
|
||||
EXTRA_DIST = pciaccess.pc.in autogen.sh src/scanpci.c
|
||||
|
||||
EXTRA_DIST += ChangeLog
|
||||
MAINTAINERCLEANFILES = ChangeLog
|
||||
|
||||
.PHONY: ChangeLog
|
||||
|
||||
ChangeLog:
|
||||
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
||||
|
||||
dist-hook: ChangeLog
|
||||
|
@ -126,6 +126,7 @@ CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
@ -152,6 +153,7 @@ MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENBSD_FALSE = @OPENBSD_FALSE@
|
||||
OPENBSD_TRUE = @OPENBSD_TRUE@
|
||||
@ -166,6 +168,7 @@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
|
||||
PCIACCESS_LIBS = @PCIACCESS_LIBS@
|
||||
PCIIDS_PATH = @PCIIDS_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SOLARIS_FALSE = @SOLARIS_FALSE@
|
||||
@ -175,7 +178,9 @@ VERSION = @VERSION@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_NMEDIT = @ac_ct_NMEDIT@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
@ -218,7 +223,8 @@ target_alias = @target_alias@
|
||||
SUBDIRS = src
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = pciaccess.pc
|
||||
EXTRA_DIST = pciaccess.pc.in autogen.sh src/scanpci.c
|
||||
EXTRA_DIST = pciaccess.pc.in autogen.sh src/scanpci.c ChangeLog
|
||||
MAINTAINERCLEANFILES = ChangeLog
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
@ -480,6 +486,9 @@ distdir: $(DISTFILES)
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
@ -609,6 +618,7 @@ distclean-generic:
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
@ -664,7 +674,7 @@ uninstall-info: uninstall-info-recursive
|
||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
|
||||
check-am clean clean-generic clean-libtool clean-recursive \
|
||||
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
|
||||
dist-shar dist-tarZ dist-zip distcheck distclean \
|
||||
dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \
|
||||
distclean-generic distclean-hdr distclean-libtool \
|
||||
distclean-recursive distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
@ -678,6 +688,13 @@ uninstall-info: uninstall-info-recursive
|
||||
uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-pkgconfigDATA
|
||||
|
||||
|
||||
.PHONY: ChangeLog
|
||||
|
||||
ChangeLog:
|
||||
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
||||
|
||||
dist-hook: ChangeLog
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
771
lib/libpciaccess/aclocal.m4
vendored
771
lib/libpciaccess/aclocal.m4
vendored
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,9 @@
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Use MTRRs on mappings */
|
||||
#undef HAVE_MTRR
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
|
1783
lib/libpciaccess/configure
vendored
1783
lib/libpciaccess/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
||||
|
||||
dnl (C) Copyright IBM Corporation 2006
|
||||
dnl All Rights Reserved.
|
||||
dnl
|
||||
@ -41,7 +40,7 @@ dnl refers to ${prefix}. Thus we have to use `eval' twice.
|
||||
|
||||
AC_PREREQ([2.57])
|
||||
|
||||
AC_INIT(libpciaccess, 0.8.0, [none yet], libpciaccess)
|
||||
AC_INIT(libpciaccess, 0.10.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess], libpciaccess)
|
||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
@ -72,7 +71,7 @@ if test "x$GCC" = "xyes"; then
|
||||
fi
|
||||
|
||||
case $host_os in
|
||||
*freebsd*)
|
||||
*freebsd* | *dragonfly*)
|
||||
freebsd=yes
|
||||
;;
|
||||
*linux*)
|
||||
@ -83,6 +82,7 @@ case $host_os in
|
||||
;;
|
||||
*solaris*)
|
||||
solaris=yes
|
||||
PCIACCESS_LIBS="$PCIACCESS_LIBS -ldevinfo"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -91,6 +91,12 @@ AM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes])
|
||||
AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
|
||||
AM_CONDITIONAL(SOLARIS, [test "x$solaris" = xyes])
|
||||
|
||||
AC_CHECK_FILE([/usr/include/asm/mtrr.h],
|
||||
[have_mtrr_h="yes"], [have_mtrr_h="no"])
|
||||
if test "x$have_mtrr_h" = xyes; then
|
||||
AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
|
||||
fi
|
||||
|
||||
AC_SUBST(PCIACCESS_CFLAGS)
|
||||
AC_SUBST(PCIACCESS_LIBS)
|
||||
|
||||
|
@ -33,6 +33,12 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
#define __deprecated __attribute__((deprecated))
|
||||
#else
|
||||
#define __deprecated
|
||||
#endif
|
||||
|
||||
typedef uint64_t pciaddr_t;
|
||||
|
||||
struct pci_device;
|
||||
@ -40,19 +46,30 @@ struct pci_device_iterator;
|
||||
struct pci_id_match;
|
||||
struct pci_slot_match;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int pci_device_read_rom(struct pci_device *dev, void *buffer);
|
||||
|
||||
int pci_device_map_region(struct pci_device *dev, unsigned region,
|
||||
int write_enable);
|
||||
int __deprecated pci_device_map_region(struct pci_device *dev,
|
||||
unsigned region, int write_enable);
|
||||
|
||||
int pci_device_unmap_region(struct pci_device *dev, unsigned region);
|
||||
int __deprecated pci_device_unmap_region(struct pci_device *dev,
|
||||
unsigned region);
|
||||
|
||||
int pci_device_map_memory_range(struct pci_device *dev, pciaddr_t base,
|
||||
pciaddr_t size, int write_enable, void **addr);
|
||||
int pci_device_map_range(struct pci_device *dev, pciaddr_t base,
|
||||
pciaddr_t size, unsigned map_flags, void **addr);
|
||||
|
||||
int pci_device_unmap_memory_range(struct pci_device *dev, void *memory,
|
||||
int pci_device_unmap_range(struct pci_device *dev, void *memory,
|
||||
pciaddr_t size);
|
||||
|
||||
int __deprecated pci_device_map_memory_range(struct pci_device *dev,
|
||||
pciaddr_t base, pciaddr_t size, int write_enable, void **addr);
|
||||
|
||||
int __deprecated pci_device_unmap_memory_range(struct pci_device *dev,
|
||||
void *memory, pciaddr_t size);
|
||||
|
||||
int pci_device_probe(struct pci_device *dev);
|
||||
|
||||
const struct pci_agp_info *pci_device_get_agp_info(struct pci_device *dev);
|
||||
@ -68,6 +85,8 @@ int pci_device_get_bridge_buses(struct pci_device *dev, int *primary_bus,
|
||||
|
||||
int pci_system_init(void);
|
||||
|
||||
void pci_system_init_dev_mem(int fd);
|
||||
|
||||
void pci_system_cleanup(void);
|
||||
|
||||
struct pci_device_iterator *pci_slot_match_iterator_create(
|
||||
@ -91,6 +110,8 @@ const char *pci_device_get_subdevice_name(const struct pci_device *dev);
|
||||
const char *pci_device_get_vendor_name(const struct pci_device *dev);
|
||||
const char *pci_device_get_subvendor_name(const struct pci_device *dev);
|
||||
|
||||
void pci_device_enable(struct pci_device *dev);
|
||||
|
||||
int pci_device_cfg_read (struct pci_device *dev, void *data,
|
||||
pciaddr_t offset, pciaddr_t size, pciaddr_t *bytes_read);
|
||||
int pci_device_cfg_read_u8 (struct pci_device *dev, uint8_t *data,
|
||||
@ -111,6 +132,20 @@ int pci_device_cfg_write_u32(struct pci_device *dev, uint32_t data,
|
||||
int pci_device_cfg_write_bits(struct pci_device *dev, uint32_t mask,
|
||||
uint32_t data, pciaddr_t offset);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name Mapping flags passed to \c pci_device_map_range
|
||||
*/
|
||||
/*@{*/
|
||||
#define PCI_DEV_MAP_FLAG_WRITABLE (1U<<0)
|
||||
#define PCI_DEV_MAP_FLAG_WRITE_COMBINE (1U<<1)
|
||||
#define PCI_DEV_MAP_FLAG_CACHABLE (1U<<2)
|
||||
/*@}*/
|
||||
|
||||
|
||||
#define PCI_MATCH_ANY (~0)
|
||||
|
||||
/**
|
||||
@ -178,10 +213,35 @@ struct pci_slot_match {
|
||||
struct pci_mem_region {
|
||||
/**
|
||||
* When the region is mapped, this is the pointer to the memory.
|
||||
*
|
||||
* This field is \b only set when the deprecated \c pci_device_map_region
|
||||
* interface is used. Use \c pci_device_map_range instead.
|
||||
*
|
||||
* \deprecated
|
||||
*/
|
||||
void *memory;
|
||||
|
||||
|
||||
/**
|
||||
* Base physical address of the region within its bus / domain.
|
||||
*
|
||||
* \warning
|
||||
* This address is really only useful to other devices in the same
|
||||
* domain. It's probably \b not the address applications will ever
|
||||
* use.
|
||||
*
|
||||
* \warning
|
||||
* Most (all?) platform back-ends leave this field unset.
|
||||
*/
|
||||
pciaddr_t bus_addr;
|
||||
|
||||
|
||||
/**
|
||||
* Base physical address of the region from the CPU's point of view.
|
||||
*
|
||||
* This address is typically passed to \c pci_device_map_range to create
|
||||
* a mapping of the region to the CPU's virtual address space.
|
||||
*/
|
||||
pciaddr_t base_addr;
|
||||
|
||||
|
||||
@ -320,13 +380,13 @@ struct pci_agp_info {
|
||||
*/
|
||||
uint8_t rates;
|
||||
|
||||
uint8_t fast_writes:1; /**< Are fast-writes supported? */
|
||||
uint8_t addr64:1;
|
||||
uint8_t htrans:1;
|
||||
uint8_t gart64:1;
|
||||
uint8_t coherent:1;
|
||||
uint8_t sideband:1; /**< Is side-band addressing supported? */
|
||||
uint8_t isochronus:1;
|
||||
unsigned int fast_writes:1; /**< Are fast-writes supported? */
|
||||
unsigned int addr64:1;
|
||||
unsigned int htrans:1;
|
||||
unsigned int gart64:1;
|
||||
unsigned int coherent:1;
|
||||
unsigned int sideband:1; /**< Is side-band addressing supported? */
|
||||
unsigned int isochronus:1;
|
||||
|
||||
uint8_t async_req_size;
|
||||
uint8_t calibration_cycle_timing;
|
||||
|
@ -1,8 +1,8 @@
|
||||
# ltmain.sh - Provide generalized library-building support services.
|
||||
# NOTE: Changing this file will not affect anything until you rerun configure.
|
||||
#
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
|
||||
# 2007, 2008 Free Software Foundation, Inc.
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -43,14 +43,22 @@ EXIT_FAILURE=1
|
||||
|
||||
PROGRAM=ltmain.sh
|
||||
PACKAGE=libtool
|
||||
VERSION=1.5.22
|
||||
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
|
||||
VERSION=1.5.26
|
||||
TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
|
||||
|
||||
# See if we are running on zsh, and set the options which allow our
|
||||
# commands through without removal of \ escapes.
|
||||
if test -n "${ZSH_VERSION+set}" ; then
|
||||
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
else
|
||||
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# Check that we have a working $echo.
|
||||
if test "X$1" = X--no-reexec; then
|
||||
@ -105,11 +113,19 @@ esac
|
||||
# These must not be set unconditionally because not all systems understand
|
||||
# e.g. LANG=C (notably SCO).
|
||||
# We save the old values to restore during execute mode.
|
||||
if test "${LC_ALL+set}" = set; then
|
||||
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
|
||||
fi
|
||||
if test "${LANG+set}" = set; then
|
||||
save_LANG="$LANG"; LANG=C; export LANG
|
||||
lt_env=
|
||||
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
do
|
||||
eval "if test \"\${$lt_var+set}\" = set; then
|
||||
save_$lt_var=\$$lt_var
|
||||
lt_env=\"$lt_var=\$$lt_var \$lt_env\"
|
||||
$lt_var=C
|
||||
export $lt_var
|
||||
fi"
|
||||
done
|
||||
|
||||
if test -n "$lt_env"; then
|
||||
lt_env="env $lt_env"
|
||||
fi
|
||||
|
||||
# Make sure IFS has a sensible default
|
||||
@ -136,6 +152,8 @@ duplicate_deps=no
|
||||
preserve_args=
|
||||
lo2o="s/\\.lo\$/.${objext}/"
|
||||
o2lo="s/\\.${objext}\$/.lo/"
|
||||
extracted_archives=
|
||||
extracted_serial=0
|
||||
|
||||
#####################################
|
||||
# Shell function definitions:
|
||||
@ -196,7 +214,13 @@ func_win32_libid ()
|
||||
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
|
||||
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
|
||||
win32_nmres=`eval $NM -f posix -A $1 | \
|
||||
$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
|
||||
$SED -n -e '1,100{
|
||||
/ I /{
|
||||
s,.*,import,
|
||||
p
|
||||
q
|
||||
}
|
||||
}'`
|
||||
case $win32_nmres in
|
||||
import*) win32_libid_type="x86 archive import";;
|
||||
*) win32_libid_type="x86 archive static";;
|
||||
@ -327,7 +351,17 @@ func_extract_archives ()
|
||||
*) my_xabs=`pwd`"/$my_xlib" ;;
|
||||
esac
|
||||
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
|
||||
my_xdir="$my_gentop/$my_xlib"
|
||||
my_xlib_u=$my_xlib
|
||||
while :; do
|
||||
case " $extracted_archives " in
|
||||
*" $my_xlib_u "*)
|
||||
extracted_serial=`expr $extracted_serial + 1`
|
||||
my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
extracted_archives="$extracted_archives $my_xlib_u"
|
||||
my_xdir="$my_gentop/$my_xlib_u"
|
||||
|
||||
$show "${rm}r $my_xdir"
|
||||
$run ${rm}r "$my_xdir"
|
||||
@ -454,11 +488,12 @@ do
|
||||
;;
|
||||
|
||||
--version)
|
||||
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
|
||||
$echo
|
||||
$echo "Copyright (C) 2005 Free Software Foundation, Inc."
|
||||
$echo "This is free software; see the source for copying conditions. There is NO"
|
||||
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
echo "\
|
||||
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
|
||||
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
@ -755,9 +790,11 @@ if test -z "$show_help"; then
|
||||
*.class) xform=class ;;
|
||||
*.cpp) xform=cpp ;;
|
||||
*.cxx) xform=cxx ;;
|
||||
*.f90) xform=f90 ;;
|
||||
*.[fF][09]?) xform=[fF][09]. ;;
|
||||
*.for) xform=for ;;
|
||||
*.java) xform=java ;;
|
||||
*.obj) xform=obj ;;
|
||||
*.sx) xform=sx ;;
|
||||
esac
|
||||
|
||||
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
|
||||
@ -926,7 +963,7 @@ EOF
|
||||
$run $rm "$lobj" "$output_obj"
|
||||
|
||||
$show "$command"
|
||||
if $run eval "$command"; then :
|
||||
if $run eval $lt_env "$command"; then :
|
||||
else
|
||||
test -n "$output_obj" && $run $rm $removelist
|
||||
exit $EXIT_FAILURE
|
||||
@ -998,7 +1035,7 @@ EOF
|
||||
command="$command$suppress_output"
|
||||
$run $rm "$obj" "$output_obj"
|
||||
$show "$command"
|
||||
if $run eval "$command"; then :
|
||||
if $run eval $lt_env "$command"; then :
|
||||
else
|
||||
$run $rm $removelist
|
||||
exit $EXIT_FAILURE
|
||||
@ -1131,6 +1168,7 @@ EOF
|
||||
thread_safe=no
|
||||
vinfo=
|
||||
vinfo_number=no
|
||||
single_module="${wl}-single_module"
|
||||
|
||||
func_infer_tag $base_compile
|
||||
|
||||
@ -1138,8 +1176,9 @@ EOF
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-all-static | -static)
|
||||
if test "X$arg" = "X-all-static"; then
|
||||
-all-static | -static | -static-libtool-libs)
|
||||
case $arg in
|
||||
-all-static)
|
||||
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
|
||||
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
|
||||
fi
|
||||
@ -1147,12 +1186,20 @@ EOF
|
||||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=yes
|
||||
else
|
||||
;;
|
||||
-static)
|
||||
if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
||||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=built
|
||||
fi
|
||||
;;
|
||||
-static-libtool-libs)
|
||||
if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
||||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=yes
|
||||
;;
|
||||
esac
|
||||
build_libtool_libs=no
|
||||
build_old_libs=yes
|
||||
break
|
||||
@ -1600,10 +1647,16 @@ EOF
|
||||
continue
|
||||
;;
|
||||
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
||||
compiler_flags="$compiler_flags $arg"
|
||||
compile_command="$compile_command $arg"
|
||||
finalize_command="$finalize_command $arg"
|
||||
deplibs="$deplibs $arg"
|
||||
continue
|
||||
;;
|
||||
|
||||
-multi_module)
|
||||
single_module="${wl}-multi_module"
|
||||
continue
|
||||
;;
|
||||
|
||||
@ -1620,10 +1673,11 @@ EOF
|
||||
# -m* pass through architecture-specific compiler args for GCC
|
||||
# -m*, -t[45]*, -txscale* pass through architecture-specific
|
||||
# compiler args for GCC
|
||||
# -pg pass through profiling flag for GCC
|
||||
# -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
|
||||
# -F/path gives path to uninstalled frameworks, gcc on darwin
|
||||
# @file GCC response files
|
||||
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
|
||||
-t[45]*|-txscale*|@*)
|
||||
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
|
||||
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
|
||||
|
||||
# Unknown arguments in both finalize_command and compile_command need
|
||||
# to be aesthetically quoted because they are evaled later.
|
||||
@ -1651,9 +1705,9 @@ EOF
|
||||
|
||||
-no-install)
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
|
||||
# The PATH hackery in wrapper scripts is required on Windows
|
||||
# in order for the loader to find any dlls it needs.
|
||||
# and Darwin in order for the loader to find any dlls it needs.
|
||||
$echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
|
||||
$echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
|
||||
fast_install=no
|
||||
@ -1712,7 +1766,7 @@ EOF
|
||||
continue
|
||||
;;
|
||||
|
||||
-static)
|
||||
-static | -static-libtool-libs)
|
||||
# The effects of -static are defined in a previous loop.
|
||||
# We used to do the same as -all-static on platforms that
|
||||
# didn't have a PIC flag, but the assumption that the effects
|
||||
@ -2105,12 +2159,13 @@ EOF
|
||||
lib=
|
||||
found=no
|
||||
case $deplib in
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
||||
if test "$linkmode,$pass" = "prog,link"; then
|
||||
compile_deplibs="$deplib $compile_deplibs"
|
||||
finalize_deplibs="$deplib $finalize_deplibs"
|
||||
else
|
||||
compiler_flags="$compiler_flags $deplib"
|
||||
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
|
||||
fi
|
||||
continue
|
||||
;;
|
||||
@ -2120,7 +2175,12 @@ EOF
|
||||
continue
|
||||
fi
|
||||
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
|
||||
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
||||
if test "$linkmode" = lib; then
|
||||
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
|
||||
else
|
||||
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
|
||||
fi
|
||||
for searchdir in $searchdirs; do
|
||||
for search_ext in .la $std_shrext .so .a; do
|
||||
# Search the libtool library
|
||||
lib="$searchdir/lib${name}${search_ext}"
|
||||
@ -2501,7 +2561,9 @@ EOF
|
||||
|
||||
if test "$linkmode,$pass" = "prog,link"; then
|
||||
if test -n "$library_names" &&
|
||||
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
|
||||
{ { test "$prefer_static_libs" = no ||
|
||||
test "$prefer_static_libs,$installed" = "built,yes"; } ||
|
||||
test -z "$old_library"; }; then
|
||||
# We need to hardcode the library path
|
||||
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
|
||||
# Make sure the rpath contains only unique directories.
|
||||
@ -2914,12 +2976,18 @@ EOF
|
||||
# we do not want to link against static libs,
|
||||
# but need to link against shared
|
||||
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
|
||||
eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
||||
if test -n "$deplibrary_names" ; then
|
||||
for tmp in $deplibrary_names ; do
|
||||
depdepl=$tmp
|
||||
done
|
||||
if test -f "$path/$depdepl" ; then
|
||||
if test -f "$deplibdir/$depdepl" ; then
|
||||
depdepl="$deplibdir/$depdepl"
|
||||
elif test -f "$path/$depdepl" ; then
|
||||
depdepl="$path/$depdepl"
|
||||
else
|
||||
# Can't find it, oh well...
|
||||
depdepl=
|
||||
fi
|
||||
# do not add paths which are already there
|
||||
case " $newlib_search_path " in
|
||||
@ -3067,9 +3135,10 @@ EOF
|
||||
|
||||
case $linkmode in
|
||||
oldlib)
|
||||
if test -n "$deplibs"; then
|
||||
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
|
||||
fi
|
||||
case " $deplibs" in
|
||||
*\ -l* | *\ -L*)
|
||||
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
|
||||
esac
|
||||
|
||||
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
||||
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
|
||||
@ -3197,7 +3266,7 @@ EOF
|
||||
# which has an extra 1 added just for fun
|
||||
#
|
||||
case $version_type in
|
||||
darwin|linux|osf|windows)
|
||||
darwin|linux|osf|windows|none)
|
||||
current=`expr $number_major + $number_minor`
|
||||
age="$number_minor"
|
||||
revision="$number_revision"
|
||||
@ -3208,9 +3277,10 @@ EOF
|
||||
age="0"
|
||||
;;
|
||||
irix|nonstopux)
|
||||
current=`expr $number_major + $number_minor - 1`
|
||||
current=`expr $number_major + $number_minor`
|
||||
age="$number_minor"
|
||||
revision="$number_minor"
|
||||
lt_irix_increment=no
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@ -3269,7 +3339,8 @@ EOF
|
||||
versuffix="$major.$age.$revision"
|
||||
# Darwin ld doesn't like 0 for these options...
|
||||
minor_current=`expr $current + 1`
|
||||
verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
||||
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
||||
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
|
||||
;;
|
||||
|
||||
freebsd-aout)
|
||||
@ -3283,8 +3354,11 @@ EOF
|
||||
;;
|
||||
|
||||
irix | nonstopux)
|
||||
major=`expr $current - $age + 1`
|
||||
|
||||
if test "X$lt_irix_increment" = "Xno"; then
|
||||
major=`expr $current - $age`
|
||||
else
|
||||
major=`expr $current - $age + 1`
|
||||
fi
|
||||
case $version_type in
|
||||
nonstopux) verstring_prefix=nonstopux ;;
|
||||
*) verstring_prefix=sgi ;;
|
||||
@ -3435,11 +3509,11 @@ EOF
|
||||
fi
|
||||
|
||||
# Eliminate all temporary directories.
|
||||
for path in $notinst_path; do
|
||||
lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
|
||||
deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
|
||||
dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
|
||||
done
|
||||
#for path in $notinst_path; do
|
||||
# lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
|
||||
# deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
|
||||
# dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
|
||||
#done
|
||||
|
||||
if test -n "$xrpath"; then
|
||||
# If the user specified any rpath flags, then add them.
|
||||
@ -3540,13 +3614,12 @@ EOF
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
$rm conftest
|
||||
$LTCC $LTCFLAGS -o conftest conftest.c $deplibs
|
||||
if test "$?" -eq 0 ; then
|
||||
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
|
||||
ldd_output=`ldd conftest`
|
||||
for i in $deplibs; do
|
||||
name=`expr $i : '-l\(.*\)'`
|
||||
# If $name is empty we are operating on a -L argument.
|
||||
if test "$name" != "" && test "$name" -ne "0"; then
|
||||
if test "$name" != "" && test "$name" != "0"; then
|
||||
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
||||
case " $predeps $postdeps " in
|
||||
*" $i "*)
|
||||
@ -3585,9 +3658,7 @@ EOF
|
||||
# If $name is empty we are operating on a -L argument.
|
||||
if test "$name" != "" && test "$name" != "0"; then
|
||||
$rm conftest
|
||||
$LTCC $LTCFLAGS -o conftest conftest.c $i
|
||||
# Did it work?
|
||||
if test "$?" -eq 0 ; then
|
||||
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
|
||||
ldd_output=`ldd conftest`
|
||||
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
||||
case " $predeps $postdeps " in
|
||||
@ -3619,7 +3690,7 @@ EOF
|
||||
droppeddeps=yes
|
||||
$echo
|
||||
$echo "*** Warning! Library $i is needed by this library but I was not able to"
|
||||
$echo "*** make it link in! You will probably need to install it or some"
|
||||
$echo "*** make it link in! You will probably need to install it or some"
|
||||
$echo "*** library that it depends on before this library will be fully"
|
||||
$echo "*** functional. Installing it before continuing would be even better."
|
||||
fi
|
||||
@ -3905,7 +3976,10 @@ EOF
|
||||
test -n "$hardcode_libdirs"; then
|
||||
libdir="$hardcode_libdirs"
|
||||
if test -n "$hardcode_libdir_flag_spec_ld"; then
|
||||
eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
|
||||
case $archive_cmds in
|
||||
*\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
|
||||
*) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
|
||||
esac
|
||||
else
|
||||
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
|
||||
fi
|
||||
@ -4215,9 +4289,10 @@ EOF
|
||||
;;
|
||||
|
||||
obj)
|
||||
if test -n "$deplibs"; then
|
||||
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
|
||||
fi
|
||||
case " $deplibs" in
|
||||
*\ -l* | *\ -L*)
|
||||
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
|
||||
esac
|
||||
|
||||
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
||||
$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
|
||||
@ -4264,12 +4339,14 @@ EOF
|
||||
reload_conv_objs=
|
||||
gentop=
|
||||
# reload_cmds runs $LD directly, so let us get rid of
|
||||
# -Wl from whole_archive_flag_spec
|
||||
# -Wl from whole_archive_flag_spec and hope we can get by with
|
||||
# turning comma into space..
|
||||
wl=
|
||||
|
||||
if test -n "$convenience"; then
|
||||
if test -n "$whole_archive_flag_spec"; then
|
||||
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
|
||||
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
|
||||
reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
|
||||
else
|
||||
gentop="$output_objdir/${obj}x"
|
||||
generated="$generated $gentop"
|
||||
@ -4717,16 +4794,16 @@ static const void *lt_preloaded_setup() {
|
||||
case $host in
|
||||
*cygwin* | *mingw* )
|
||||
if test -f "$output_objdir/${outputname}.def" ; then
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
else
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@ -4741,13 +4818,13 @@ static const void *lt_preloaded_setup() {
|
||||
# really was required.
|
||||
|
||||
# Nullify the symbol file.
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
|
||||
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
|
||||
fi
|
||||
|
||||
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
|
||||
# Replace the output file specification.
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
|
||||
link_command="$compile_command$compile_rpath"
|
||||
|
||||
# We have no uninstalled library dependencies, so finalize right now.
|
||||
@ -4834,7 +4911,7 @@ static const void *lt_preloaded_setup() {
|
||||
if test "$fast_install" != no; then
|
||||
link_command="$finalize_var$compile_command$finalize_rpath"
|
||||
if test "$fast_install" = yes; then
|
||||
relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
|
||||
relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
|
||||
else
|
||||
# fast_install is set to needless
|
||||
relink_command=
|
||||
@ -4871,7 +4948,7 @@ static const void *lt_preloaded_setup() {
|
||||
fi
|
||||
done
|
||||
relink_command="(cd `pwd`; $relink_command)"
|
||||
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
|
||||
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
|
||||
fi
|
||||
|
||||
# Quote $echo for shipping.
|
||||
@ -5278,6 +5355,20 @@ EOF
|
||||
Xsed='${SED} -e 1s/^X//'
|
||||
sed_quote_subst='$sed_quote_subst'
|
||||
|
||||
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
|
||||
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '\${1+\"\$@\"}'='\"\$@\"'
|
||||
setopt NO_GLOB_SUBST
|
||||
else
|
||||
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
@ -5420,7 +5511,7 @@ else
|
||||
;;
|
||||
esac
|
||||
$echo >> $output "\
|
||||
\$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
|
||||
\$echo \"\$0: cannot exec \$program \$*\"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
else
|
||||
@ -5606,7 +5697,7 @@ fi\
|
||||
done
|
||||
# Quote the link command for shipping.
|
||||
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
|
||||
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
|
||||
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
|
||||
if test "$hardcode_automatic" = yes ; then
|
||||
relink_command=
|
||||
fi
|
||||
@ -5955,9 +6046,9 @@ relink_command=\"$relink_command\""
|
||||
|
||||
if test -n "$inst_prefix_dir"; then
|
||||
# Stick the inst_prefix_dir data into the link command.
|
||||
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
|
||||
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
|
||||
else
|
||||
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
|
||||
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
|
||||
fi
|
||||
|
||||
$echo "$modename: warning: relinking \`$file'" 1>&2
|
||||
@ -6166,7 +6257,7 @@ relink_command=\"$relink_command\""
|
||||
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
|
||||
outputname="$tmpdir/$file"
|
||||
# Replace the output file specification.
|
||||
relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
|
||||
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
|
||||
|
||||
$show "$relink_command"
|
||||
if $run eval "$relink_command"; then :
|
||||
@ -6343,8 +6434,10 @@ relink_command=\"$relink_command\""
|
||||
if test -f "$dir/$objdir/$dlname"; then
|
||||
dir="$dir/$objdir"
|
||||
else
|
||||
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
|
||||
exit $EXIT_FAILURE
|
||||
if test ! -f "$dir/$dlname"; then
|
||||
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
@ -6408,12 +6501,12 @@ relink_command=\"$relink_command\""
|
||||
fi
|
||||
|
||||
# Restore saved environment variables
|
||||
if test "${save_LC_ALL+set}" = set; then
|
||||
LC_ALL="$save_LC_ALL"; export LC_ALL
|
||||
fi
|
||||
if test "${save_LANG+set}" = set; then
|
||||
LANG="$save_LANG"; export LANG
|
||||
fi
|
||||
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
do
|
||||
eval "if test \"\${save_$lt_var+set}\" = set; then
|
||||
$lt_var=\$save_$lt_var; export $lt_var
|
||||
fi"
|
||||
done
|
||||
|
||||
# Now prepare to actually exec the command.
|
||||
exec_cmd="\$cmd$args"
|
||||
@ -6770,9 +6863,9 @@ The following components of LINK-COMMAND are treated specially:
|
||||
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
|
||||
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
|
||||
-export-symbols SYMFILE
|
||||
try to export only the symbols listed in SYMFILE
|
||||
try to export only the symbols listed in SYMFILE
|
||||
-export-symbols-regex REGEX
|
||||
try to export only the symbols matching REGEX
|
||||
try to export only the symbols matching REGEX
|
||||
-LLIBDIR search LIBDIR for required installed libraries
|
||||
-lNAME OUTPUT-FILE requires the installed library libNAME
|
||||
-module build a library that can dlopened
|
||||
@ -6786,9 +6879,11 @@ The following components of LINK-COMMAND are treated specially:
|
||||
-release RELEASE specify package release information
|
||||
-rpath LIBDIR the created library will eventually be installed in LIBDIR
|
||||
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
|
||||
-static do not do any dynamic linking of libtool libraries
|
||||
-static do not do any dynamic linking of uninstalled libtool libraries
|
||||
-static-libtool-libs
|
||||
do not do any dynamic linking of libtool libraries
|
||||
-version-info CURRENT[:REVISION[:AGE]]
|
||||
specify library version info [each variable defaults to 0]
|
||||
specify library version info [each variable defaults to 0]
|
||||
|
||||
All other options (arguments beginning with \`-') are ignored.
|
||||
|
||||
|
@ -26,7 +26,7 @@ AM_CFLAGS = @PCIACCESS_CFLAGS@
|
||||
lib_LTLIBRARIES = libpciaccess.la
|
||||
|
||||
if LINUX
|
||||
OS_SUPPORT = linux_sysfs.c
|
||||
OS_SUPPORT = linux_sysfs.c linux_devmem.c linux_devmem.h
|
||||
endif
|
||||
|
||||
if FREEBSD
|
||||
@ -38,7 +38,7 @@ OS_SUPPORT = openbsd_pci.c
|
||||
endif
|
||||
|
||||
if SOLARIS
|
||||
OS_SUPPORT = solx_devfs.c
|
||||
OS_SUPPORT = solx_devfs.c pci_tools.h
|
||||
endif
|
||||
|
||||
libpciaccess_la_SOURCES = common_bridge.c \
|
||||
@ -47,6 +47,7 @@ libpciaccess_la_SOURCES = common_bridge.c \
|
||||
common_interface.c \
|
||||
common_capability.c \
|
||||
common_device_name.c \
|
||||
common_map.c \
|
||||
pciaccess_private.h \
|
||||
$(OS_SUPPORT)
|
||||
|
||||
@ -54,7 +55,7 @@ INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
libpciaccess_la_LIBADD = @PCIACCESS_LIBS@
|
||||
|
||||
libpciaccess_la_LDFLAGS = -version-number 0:8:0 -no-undefined
|
||||
libpciaccess_la_LDFLAGS = -version-number 0:10:2 -no-undefined
|
||||
|
||||
libpciaccessincludedir = $(includedir)
|
||||
libpciaccessinclude_HEADERS = \
|
||||
|
@ -85,16 +85,18 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libpciaccess_la_DEPENDENCIES =
|
||||
am__libpciaccess_la_SOURCES_DIST = common_bridge.c common_iterator.c \
|
||||
common_init.c common_interface.c common_capability.c \
|
||||
common_device_name.c pciaccess_private.h freebsd_pci.c \
|
||||
linux_sysfs.c openbsd_pci.c solx_devfs.c
|
||||
common_device_name.c common_map.c pciaccess_private.h \
|
||||
freebsd_pci.c linux_sysfs.c linux_devmem.c linux_devmem.h \
|
||||
openbsd_pci.c solx_devfs.c pci_tools.h
|
||||
@FREEBSD_FALSE@@LINUX_FALSE@@OPENBSD_FALSE@@SOLARIS_TRUE@am__objects_1 = solx_devfs.lo
|
||||
@FREEBSD_FALSE@@LINUX_FALSE@@OPENBSD_TRUE@am__objects_1 = \
|
||||
@FREEBSD_FALSE@@LINUX_FALSE@@OPENBSD_TRUE@ openbsd_pci.lo
|
||||
@FREEBSD_FALSE@@LINUX_TRUE@am__objects_1 = linux_sysfs.lo
|
||||
@FREEBSD_FALSE@@LINUX_TRUE@am__objects_1 = linux_sysfs.lo \
|
||||
@FREEBSD_FALSE@@LINUX_TRUE@ linux_devmem.lo
|
||||
@FREEBSD_TRUE@am__objects_1 = freebsd_pci.lo
|
||||
am_libpciaccess_la_OBJECTS = common_bridge.lo common_iterator.lo \
|
||||
common_init.lo common_interface.lo common_capability.lo \
|
||||
common_device_name.lo $(am__objects_1)
|
||||
common_device_name.lo common_map.lo $(am__objects_1)
|
||||
libpciaccess_la_OBJECTS = $(am_libpciaccess_la_OBJECTS)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
am_scanpci_OBJECTS = scanpci.$(OBJEXT)
|
||||
@ -140,6 +142,7 @@ CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
@ -166,6 +169,7 @@ MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENBSD_FALSE = @OPENBSD_FALSE@
|
||||
OPENBSD_TRUE = @OPENBSD_TRUE@
|
||||
@ -180,6 +184,7 @@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
|
||||
PCIACCESS_LIBS = @PCIACCESS_LIBS@
|
||||
PCIIDS_PATH = @PCIIDS_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SOLARIS_FALSE = @SOLARIS_FALSE@
|
||||
@ -189,7 +194,9 @@ VERSION = @VERSION@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_NMEDIT = @ac_ct_NMEDIT@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
@ -232,21 +239,22 @@ target_alias = @target_alias@
|
||||
AM_CFLAGS = @PCIACCESS_CFLAGS@
|
||||
lib_LTLIBRARIES = libpciaccess.la
|
||||
@FREEBSD_TRUE@OS_SUPPORT = freebsd_pci.c
|
||||
@LINUX_TRUE@OS_SUPPORT = linux_sysfs.c
|
||||
@LINUX_TRUE@OS_SUPPORT = linux_sysfs.c linux_devmem.c linux_devmem.h
|
||||
@OPENBSD_TRUE@OS_SUPPORT = openbsd_pci.c
|
||||
@SOLARIS_TRUE@OS_SUPPORT = solx_devfs.c
|
||||
@SOLARIS_TRUE@OS_SUPPORT = solx_devfs.c pci_tools.h
|
||||
libpciaccess_la_SOURCES = common_bridge.c \
|
||||
common_iterator.c \
|
||||
common_init.c \
|
||||
common_interface.c \
|
||||
common_capability.c \
|
||||
common_device_name.c \
|
||||
common_map.c \
|
||||
pciaccess_private.h \
|
||||
$(OS_SUPPORT)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
libpciaccess_la_LIBADD = @PCIACCESS_LIBS@
|
||||
libpciaccess_la_LDFLAGS = -version-number 0:8:0 -no-undefined
|
||||
libpciaccess_la_LDFLAGS = -version-number 0:10:2 -no-undefined
|
||||
libpciaccessincludedir = $(includedir)
|
||||
libpciaccessinclude_HEADERS = \
|
||||
$(top_srcdir)/include/pciaccess.h
|
||||
@ -339,7 +347,9 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common_init.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common_interface.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common_iterator.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common_map.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freebsd_pci.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux_devmem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux_sysfs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openbsd_pci.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanpci.Po@am__quote@
|
||||
|
@ -59,7 +59,7 @@
|
||||
* later to try again for the second capability. This could lead to memory
|
||||
* leaks or other quirky behavior.
|
||||
*/
|
||||
int
|
||||
_pci_hidden int
|
||||
pci_fill_capabilities_generic( struct pci_device * dev )
|
||||
{
|
||||
struct pci_device_private * const dev_priv =
|
||||
|
@ -46,6 +46,7 @@
|
||||
#endif
|
||||
|
||||
#include "pciaccess.h"
|
||||
#include "pciaccess_private.h"
|
||||
|
||||
#define DO_MATCH(a,b) (((a) == PCI_MATCH_ANY) || ((a) == (b)))
|
||||
|
||||
@ -92,7 +93,7 @@ struct pci_device_leaf {
|
||||
/**
|
||||
* Root of the PCI vendor ID search tree.
|
||||
*/
|
||||
struct pci_id_node * tree = NULL;
|
||||
_pci_hidden struct pci_id_node * tree = NULL;
|
||||
|
||||
/**
|
||||
* Name of the file containing the PCI ID information.
|
||||
@ -227,7 +228,7 @@ populate_vendor( struct pci_id_leaf * vend, int fill_device_data )
|
||||
/* vendor_name may already be set from a previous invocation
|
||||
* of this function with fill_device_data = 0.
|
||||
*/
|
||||
if (vend->vendor_name != NULL) {
|
||||
if (vend->vendor_name == NULL) {
|
||||
vend->vendor_name = strdup( & buf[ num_tabs + 6 ] );
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "pciaccess.h"
|
||||
#include "pciaccess_private.h"
|
||||
|
||||
struct pci_system * pci_sys;
|
||||
_pci_hidden struct pci_system * pci_sys;
|
||||
|
||||
/**
|
||||
* Initialize the PCI subsystem for access.
|
||||
@ -54,17 +54,24 @@ pci_system_init( void )
|
||||
|
||||
#ifdef linux
|
||||
err = pci_system_linux_sysfs_create();
|
||||
#elif defined(__FreeBSD__)
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
err = pci_system_freebsd_create();
|
||||
#elif defined(__OpenBSD__)
|
||||
err = pci_system_openbsd_create();
|
||||
#elif defined(__sun)
|
||||
err = pci_system_solx_devfs_create();
|
||||
err = pci_system_solx_devfs_create();
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void
|
||||
pci_system_init_dev_mem(int fd)
|
||||
{
|
||||
#ifdef __OpenBSD__
|
||||
pci_system_openbsd_init_dev_mem(fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown all access to the PCI subsystem.
|
||||
|
@ -30,12 +30,13 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "pciaccess.h"
|
||||
#include "pciaccess_private.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__GLIBC__)
|
||||
#include <byteswap.h>
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
@ -56,24 +57,21 @@
|
||||
#define LETOH_32(x) (x)
|
||||
#define HTOLE_32(x) (x)
|
||||
|
||||
#elif defined(__OpenBSD__)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define LETOH_16(x) letoh16(x)
|
||||
#define HTOLE_16(x) htole16(x)
|
||||
#define LETOH_32(x) letoh32(x)
|
||||
#define HTOLE_32(x) htole32(x)
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#define LETOH_16(x) le16toh(x)
|
||||
#define HTOLE_16(x) htole16(x)
|
||||
#define LETOH_32(x) le32toh(x)
|
||||
#define HTOLE_32(x) htole32(x)
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#define LETOH_16(x) le16toh(x)
|
||||
#define LETOH_32(x) le32toh(x)
|
||||
#else
|
||||
#define LETOH_16(x) letoh16(x)
|
||||
#define LETOH_32(x) letoh32(x)
|
||||
#endif
|
||||
|
||||
#endif /* others */
|
||||
|
||||
/**
|
||||
@ -140,25 +138,27 @@ pci_device_probe( struct pci_device * dev )
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_unmap_region
|
||||
* \sa pci_device_map_range, pci_device_unmap_range
|
||||
* \deprecated
|
||||
*/
|
||||
int
|
||||
pci_device_map_region( struct pci_device * dev, unsigned region,
|
||||
int write_enable )
|
||||
pci_device_map_region(struct pci_device * dev, unsigned region,
|
||||
int write_enable)
|
||||
{
|
||||
if ( dev == NULL ) {
|
||||
return EFAULT;
|
||||
const unsigned map_flags =
|
||||
(write_enable) ? PCI_DEV_MAP_FLAG_WRITABLE : 0;
|
||||
|
||||
if ((region > 5) || (dev->regions[region].size == 0)) {
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
if ( (region > 5) || (dev->regions[ region ].size == 0) ) {
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
if ( dev->regions[ region ].memory != NULL ) {
|
||||
return 0;
|
||||
if (dev->regions[region].memory != NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (pci_sys->methods->map)( dev, region, write_enable );
|
||||
return pci_device_map_range(dev, dev->regions[region].base_addr,
|
||||
dev->regions[region].size, map_flags,
|
||||
&dev->regions[region].memory);
|
||||
}
|
||||
|
||||
|
||||
@ -178,52 +178,112 @@ pci_device_map_region( struct pci_device * dev, unsigned region,
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_unmap_memory_range, pci_device_map_region
|
||||
* \sa pci_device_map_range
|
||||
*/
|
||||
int pci_device_map_memory_range(struct pci_device *dev,
|
||||
pciaddr_t base, pciaddr_t size,
|
||||
int write_enable, void **addr)
|
||||
{
|
||||
return pci_device_map_range(dev, base, size,
|
||||
(write_enable) ? PCI_DEV_MAP_FLAG_WRITABLE : 0,
|
||||
addr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map the specified memory range so that it can be accessed by the CPU.
|
||||
*
|
||||
* Maps the specified memory range for access by the processor. The pointer
|
||||
* to the mapped region is stored in \c addr. In addtion, the
|
||||
* \c pci_mem_region::memory pointer for the BAR will be updated.
|
||||
*
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param base Base address of the range to be mapped.
|
||||
* \param size Size of the range to be mapped.
|
||||
* \param map_flags Flag bits controlling how the mapping is accessed.
|
||||
* \param addr Location to store the mapped address.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_unmap_range
|
||||
*/
|
||||
int
|
||||
pci_device_map_memory_range(struct pci_device *dev, pciaddr_t base,
|
||||
pciaddr_t size, int write_enable,
|
||||
void **addr)
|
||||
pci_device_map_range(struct pci_device *dev, pciaddr_t base,
|
||||
pciaddr_t size, unsigned map_flags,
|
||||
void **addr)
|
||||
{
|
||||
struct pci_device_private *const devp =
|
||||
(struct pci_device_private *) dev;
|
||||
struct pci_device_mapping *mappings;
|
||||
unsigned region;
|
||||
unsigned i;
|
||||
int err = 0;
|
||||
|
||||
|
||||
*addr = NULL;
|
||||
|
||||
if (dev == NULL) {
|
||||
return EFAULT;
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
|
||||
for (region = 0; region < 6; region++) {
|
||||
const struct pci_mem_region const* r = &dev->regions[region];
|
||||
const struct pci_mem_region const* r = &dev->regions[region];
|
||||
|
||||
if (r->size != 0) {
|
||||
if ((r->base_addr <= base) && ((r->base_addr + r->size) > base)) {
|
||||
if ((base + size) > (r->base_addr + r->size)) {
|
||||
return E2BIG;
|
||||
}
|
||||
if (r->size != 0) {
|
||||
if ((r->base_addr <= base) && ((r->base_addr + r->size) > base)) {
|
||||
if ((base + size) > (r->base_addr + r->size)) {
|
||||
return E2BIG;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (region > 5) {
|
||||
return ENOENT;
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
/* Make sure that there isn't already a mapping with the same base and
|
||||
* size.
|
||||
*/
|
||||
for (i = 0; i < devp->num_mappings; i++) {
|
||||
if ((devp->mappings[i].base == base)
|
||||
&& (devp->mappings[i].size == size)) {
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mappings = realloc(devp->mappings,
|
||||
(sizeof(devp->mappings[0]) * (devp->num_mappings + 1)));
|
||||
if (mappings == NULL) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
mappings[devp->num_mappings].base = base;
|
||||
mappings[devp->num_mappings].size = size;
|
||||
mappings[devp->num_mappings].region = region;
|
||||
mappings[devp->num_mappings].flags = map_flags;
|
||||
mappings[devp->num_mappings].memory = NULL;
|
||||
|
||||
if (dev->regions[region].memory == NULL) {
|
||||
err = (*pci_sys->methods->map)(dev, region, write_enable);
|
||||
err = (*pci_sys->methods->map_range)(dev,
|
||||
&mappings[devp->num_mappings]);
|
||||
}
|
||||
|
||||
if (err == 0) {
|
||||
const pciaddr_t offset = base - dev->regions[region].base_addr;
|
||||
|
||||
*addr = ((uint8_t *)dev->regions[region].memory) + offset;
|
||||
if (err == 0) {
|
||||
*addr = mappings[devp->num_mappings].memory;
|
||||
devp->num_mappings++;
|
||||
} else {
|
||||
mappings = realloc(devp->mappings,
|
||||
(sizeof(devp->mappings[0]) * devp->num_mappings));
|
||||
}
|
||||
|
||||
devp->mappings = mappings;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -240,24 +300,29 @@ pci_device_map_memory_range(struct pci_device *dev, pciaddr_t base,
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_map_region
|
||||
* \sa pci_device_map_range, pci_device_unmap_range
|
||||
* \deprecated
|
||||
*/
|
||||
int
|
||||
pci_device_unmap_region( struct pci_device * dev, unsigned region )
|
||||
{
|
||||
if ( dev == NULL ) {
|
||||
return EFAULT;
|
||||
int err;
|
||||
|
||||
if (dev == NULL) {
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
if ( (region > 5) || (dev->regions[ region ].size == 0) ) {
|
||||
return ENOENT;
|
||||
if ((region > 5) || (dev->regions[region].size == 0)) {
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
if ( dev->regions[ region ].memory == NULL ) {
|
||||
return 0;
|
||||
err = pci_device_unmap_range(dev, dev->regions[region].memory,
|
||||
dev->regions[region].size);
|
||||
if (!err) {
|
||||
dev->regions[region].memory = NULL;
|
||||
}
|
||||
|
||||
return (pci_sys->methods->unmap)( dev, region );
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@ -274,41 +339,74 @@ pci_device_unmap_region( struct pci_device * dev, unsigned region )
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_map_memory_range, pci_device_unmap_region
|
||||
* \sa pci_device_map_range, pci_device_unmap_range
|
||||
* \deprecated
|
||||
*/
|
||||
int
|
||||
pci_device_unmap_memory_range(struct pci_device *dev, void *memory,
|
||||
pciaddr_t size)
|
||||
pciaddr_t size)
|
||||
{
|
||||
unsigned region;
|
||||
return pci_device_unmap_range(dev, memory, size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unmap the specified memory range so that it can no longer be accessed by the CPU.
|
||||
*
|
||||
* Unmaps the specified memory range that was previously mapped via
|
||||
* \c pci_device_map_memory_range.
|
||||
*
|
||||
* \param dev Device whose memory is to be unmapped.
|
||||
* \param memory Pointer to the base of the mapped range.
|
||||
* \param size Size, in bytes, of the range to be unmapped.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_map_range
|
||||
*/
|
||||
int
|
||||
pci_device_unmap_range(struct pci_device *dev, void *memory,
|
||||
pciaddr_t size)
|
||||
{
|
||||
struct pci_device_private *const devp =
|
||||
(struct pci_device_private *) dev;
|
||||
unsigned i;
|
||||
int err;
|
||||
|
||||
|
||||
if (dev == NULL) {
|
||||
return EFAULT;
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
for (region = 0; region < 6; region++) {
|
||||
const struct pci_mem_region const* r = &dev->regions[region];
|
||||
const uint8_t *const mem = r->memory;
|
||||
|
||||
if (r->size != 0) {
|
||||
if ((mem <= memory) && ((mem + r->size) > memory)) {
|
||||
if ((memory + size) > (mem + r->size)) {
|
||||
return E2BIG;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < devp->num_mappings; i++) {
|
||||
if ((devp->mappings[i].memory == memory)
|
||||
&& (devp->mappings[i].size == size)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (region > 5) {
|
||||
return ENOENT;
|
||||
if (i == devp->num_mappings) {
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
return (dev->regions[region].memory != NULL)
|
||||
? (*pci_sys->methods->unmap)(dev, region)
|
||||
: 0;
|
||||
|
||||
err = (*pci_sys->methods->unmap_range)(dev, &devp->mappings[i]);
|
||||
if (!err) {
|
||||
const unsigned entries_to_move = (devp->num_mappings - i) - 1;
|
||||
|
||||
if (entries_to_move > 0) {
|
||||
(void) memmove(&devp->mappings[i],
|
||||
&devp->mappings[i + 1],
|
||||
entries_to_move * sizeof(devp->mappings[0]));
|
||||
}
|
||||
|
||||
devp->num_mappings--;
|
||||
devp->mappings = realloc(devp->mappings,
|
||||
(sizeof(devp->mappings[0]) * devp->num_mappings));
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@ -506,3 +604,14 @@ pci_device_cfg_write_bits( struct pci_device * dev, uint32_t mask,
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void
|
||||
pci_device_enable(struct pci_device *dev)
|
||||
{
|
||||
if (dev == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pci_sys->methods->enable)
|
||||
pci_sys->methods->enable(dev);
|
||||
}
|
||||
|
@ -158,6 +158,9 @@ pci_device_next( struct pci_device_iterator * iter )
|
||||
{
|
||||
struct pci_device_private * d = NULL;
|
||||
|
||||
if (!iter)
|
||||
return NULL;
|
||||
|
||||
switch( iter->mode ) {
|
||||
case match_any:
|
||||
if ( iter->next_index < pci_sys->num_devices ) {
|
||||
|
55
lib/libpciaccess/src/common_map.c
Normal file
55
lib/libpciaccess/src/common_map.c
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2007
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "pciaccess.h"
|
||||
#include "pciaccess_private.h"
|
||||
|
||||
/**
|
||||
* \file common_map.c
|
||||
* Platform independent memory map routines.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unmap the specified region using the munmap.
|
||||
*
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param map Memory mapping that is to be undone.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_unmap_range
|
||||
*/
|
||||
_pci_hidden int
|
||||
pci_device_generic_unmap_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map)
|
||||
{
|
||||
return (munmap(map->memory, map->size) == -1) ? errno : 0;
|
||||
}
|
@ -38,12 +38,26 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/pciio.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/memrange.h>
|
||||
|
||||
#if __FreeBSD_version >= 700053
|
||||
#define DOMAIN_SUPPORT 1
|
||||
#else
|
||||
#define DOMAIN_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#include "pciaccess.h"
|
||||
#include "pciaccess_private.h"
|
||||
|
||||
#define PCIC_DISPLAY 0x03
|
||||
#define PCIS_DISPLAY_VGA 0x00
|
||||
#define PCIS_DISPLAY_XGA 0x01
|
||||
#define PCIS_DISPLAY_3D 0x02
|
||||
#define PCIS_DISPLAY_OTHER 0x80
|
||||
|
||||
/**
|
||||
* FreeBSD private pci_system structure that extends the base pci_system
|
||||
* structure.
|
||||
@ -61,62 +75,89 @@ struct freebsd_pci_system {
|
||||
|
||||
/**
|
||||
* Map a memory region for a device using /dev/mem.
|
||||
*
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param region Region, on the range [0, 5], that is to be mapped.
|
||||
* \param write_enable Map for writing (non-zero).
|
||||
*
|
||||
*
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param map Parameters of the mapping that is to be created.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*/
|
||||
static int
|
||||
pci_device_freebsd_map( struct pci_device *dev, unsigned region,
|
||||
int write_enable )
|
||||
pci_device_freebsd_map_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map)
|
||||
{
|
||||
int fd, err = 0, prot;
|
||||
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
|
||||
? (PROT_READ | PROT_WRITE) : PROT_READ;
|
||||
struct mem_range_desc mrd;
|
||||
struct mem_range_op mro;
|
||||
|
||||
fd = open( "/dev/mem", write_enable ? O_RDWR : O_RDONLY );
|
||||
if ( fd == -1 )
|
||||
int fd, err = 0;
|
||||
|
||||
fd = open("/dev/mem", O_RDWR);
|
||||
if (fd == -1)
|
||||
return errno;
|
||||
|
||||
prot = write_enable ? (PROT_READ | PROT_WRITE) : PROT_READ;
|
||||
dev->regions[ region ].memory = mmap( NULL, dev->regions[ region ].size,
|
||||
prot, MAP_SHARED, fd,
|
||||
dev->regions[ region ].base_addr);
|
||||
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, fd, map->base);
|
||||
|
||||
if ( dev->regions[ region ].memory == MAP_FAILED ) {
|
||||
close( fd );
|
||||
dev->regions[ region ].memory = NULL;
|
||||
if (map->memory == MAP_FAILED) {
|
||||
err = errno;
|
||||
}
|
||||
|
||||
close( fd );
|
||||
mrd.mr_base = map->base;
|
||||
mrd.mr_len = map->size;
|
||||
strncpy(mrd.mr_owner, "pciaccess", sizeof(mrd.mr_owner));
|
||||
if (map->flags & PCI_DEV_MAP_FLAG_CACHABLE)
|
||||
mrd.mr_flags = MDF_WRITEBACK;
|
||||
else if (map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)
|
||||
mrd.mr_flags = MDF_WRITECOMBINE;
|
||||
else
|
||||
mrd.mr_flags = MDF_UNCACHEABLE;
|
||||
mro.mo_desc = &mrd;
|
||||
mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
|
||||
|
||||
/* No need to set an MTRR if it's the default mode. */
|
||||
if (mrd.mr_flags != MDF_UNCACHEABLE) {
|
||||
if (ioctl(fd, MEMRANGE_SET, &mro)) {
|
||||
fprintf(stderr, "failed to set mtrr: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmap the specified region.
|
||||
*
|
||||
* \param dev Device whose memory region is to be unmapped.
|
||||
* \param region Region, on the range [0, 5], that is to be unmapped.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*/
|
||||
static int
|
||||
pci_device_freebsd_unmap( struct pci_device * dev, unsigned region )
|
||||
pci_device_freebsd_unmap_range( struct pci_device *dev,
|
||||
struct pci_device_mapping *map )
|
||||
{
|
||||
int err = 0;
|
||||
struct mem_range_desc mrd;
|
||||
struct mem_range_op mro;
|
||||
int fd;
|
||||
|
||||
if ( munmap( dev->regions[ region ].memory,
|
||||
dev->regions[ region ].size ) == -1) {
|
||||
err = errno;
|
||||
if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) ||
|
||||
(map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE))
|
||||
{
|
||||
fd = open("/dev/mem", O_RDWR);
|
||||
if (fd != -1) {
|
||||
mrd.mr_base = map->base;
|
||||
mrd.mr_len = map->size;
|
||||
strncpy(mrd.mr_owner, "pciaccess", sizeof(mrd.mr_owner));
|
||||
mrd.mr_flags = MDF_UNCACHEABLE;
|
||||
mro.mo_desc = &mrd;
|
||||
mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
|
||||
|
||||
if (ioctl(fd, MEMRANGE_SET, &mro)) {
|
||||
fprintf(stderr, "failed to unset mtrr: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
close(fd);
|
||||
} else {
|
||||
fprintf(stderr, "Failed to open /dev/mem\n");
|
||||
}
|
||||
}
|
||||
|
||||
dev->regions[ region ].memory = NULL;
|
||||
|
||||
return err;
|
||||
return pci_device_generic_unmap_range(dev, map);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -126,6 +167,9 @@ pci_device_freebsd_read( struct pci_device * dev, void * data,
|
||||
{
|
||||
struct pci_io io;
|
||||
|
||||
#if DOMAIN_SUPPORT
|
||||
io.pi_sel.pc_domain = dev->domain;
|
||||
#endif
|
||||
io.pi_sel.pc_bus = dev->bus;
|
||||
io.pi_sel.pc_dev = dev->dev;
|
||||
io.pi_sel.pc_func = dev->func;
|
||||
@ -163,6 +207,9 @@ pci_device_freebsd_write( struct pci_device * dev, const void * data,
|
||||
{
|
||||
struct pci_io io;
|
||||
|
||||
#if DOMAIN_SUPPORT
|
||||
io.pi_sel.pc_domain = dev->domain;
|
||||
#endif
|
||||
io.pi_sel.pc_bus = dev->bus;
|
||||
io.pi_sel.pc_dev = dev->dev;
|
||||
io.pi_sel.pc_func = dev->func;
|
||||
@ -187,6 +234,42 @@ pci_device_freebsd_write( struct pci_device * dev, const void * data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a VGA rom using the 0xc0000 mapping.
|
||||
*
|
||||
* This function should be extended to handle access through PCI resources,
|
||||
* which should be more reliable when available.
|
||||
*/
|
||||
static int
|
||||
pci_device_freebsd_read_rom( struct pci_device * dev, void * buffer )
|
||||
{
|
||||
void *bios;
|
||||
int memfd;
|
||||
|
||||
if ( ( dev->device_class & 0x00ffff00 ) !=
|
||||
( ( PCIC_DISPLAY << 16 ) | ( PCIS_DISPLAY_VGA << 8 ) ) )
|
||||
{
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
memfd = open( "/dev/mem", O_RDONLY );
|
||||
if ( memfd == -1 )
|
||||
return errno;
|
||||
|
||||
bios = mmap( NULL, dev->rom_size, PROT_READ, 0, memfd, 0xc0000 );
|
||||
if ( bios == MAP_FAILED ) {
|
||||
close( memfd );
|
||||
return errno;
|
||||
}
|
||||
|
||||
memcpy( buffer, bios, dev->rom_size );
|
||||
|
||||
munmap( bios, dev->rom_size );
|
||||
close( memfd );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Returns the number of regions (base address registers) the device has */
|
||||
|
||||
static int
|
||||
@ -314,12 +397,22 @@ pci_device_freebsd_probe( struct pci_device * dev )
|
||||
bar = 0x10;
|
||||
for (i = 0; i < pci_device_freebsd_get_num_regions( dev ); i++) {
|
||||
pci_device_freebsd_get_region_info( dev, i, bar );
|
||||
if (dev->regions[i].is_64)
|
||||
if (dev->regions[i].is_64) {
|
||||
bar += 0x08;
|
||||
else
|
||||
i++;
|
||||
} else
|
||||
bar += 0x04;
|
||||
}
|
||||
|
||||
/* If it's a VGA device, set up the rom size for read_rom using the
|
||||
* 0xc0000 mapping.
|
||||
*/
|
||||
if ((dev->device_class & 0x00ffff00) ==
|
||||
((PCIC_DISPLAY << 16) | (PCIS_DISPLAY_VGA << 8)))
|
||||
{
|
||||
dev->rom_size = 64 * 1024;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -334,10 +427,10 @@ pci_system_freebsd_destroy(void)
|
||||
static const struct pci_system_methods freebsd_pci_methods = {
|
||||
.destroy = pci_system_freebsd_destroy,
|
||||
.destroy_device = NULL, /* nothing to do for this */
|
||||
.read_rom = NULL, /* XXX: Fill me in */
|
||||
.read_rom = pci_device_freebsd_read_rom,
|
||||
.probe = pci_device_freebsd_probe,
|
||||
.map = pci_device_freebsd_map,
|
||||
.unmap = pci_device_freebsd_unmap,
|
||||
.map_range = pci_device_freebsd_map_range,
|
||||
.unmap_range = pci_device_freebsd_unmap_range,
|
||||
.read = pci_device_freebsd_read,
|
||||
.write = pci_device_freebsd_write,
|
||||
.fill_capabilities = pci_fill_capabilities_generic,
|
||||
@ -346,7 +439,7 @@ static const struct pci_system_methods freebsd_pci_methods = {
|
||||
/**
|
||||
* Attempt to access the FreeBSD PCI interface.
|
||||
*/
|
||||
int
|
||||
_pci_hidden int
|
||||
pci_system_freebsd_create( void )
|
||||
{
|
||||
struct pci_conf_io pciconfio;
|
||||
@ -394,13 +487,18 @@ pci_system_freebsd_create( void )
|
||||
for ( i = 0; i < pciconfio.num_matches; i++ ) {
|
||||
struct pci_conf *p = &pciconf[ i ];
|
||||
|
||||
pci_sys->devices[ i ].base.domain = 0; /* XXX */
|
||||
#if DOMAIN_SUPPORT
|
||||
pci_sys->devices[ i ].base.domain = p->pc_sel.pc_domain;
|
||||
#else
|
||||
pci_sys->devices[ i ].base.domain = 0;
|
||||
#endif
|
||||
pci_sys->devices[ i ].base.bus = p->pc_sel.pc_bus;
|
||||
pci_sys->devices[ i ].base.dev = p->pc_sel.pc_dev;
|
||||
pci_sys->devices[ i ].base.func = p->pc_sel.pc_func;
|
||||
pci_sys->devices[ i ].base.vendor_id = p->pc_vendor;
|
||||
pci_sys->devices[ i ].base.device_id = p->pc_device;
|
||||
pci_sys->devices[ i ].base.subvendor_id = p->pc_subvendor;
|
||||
pci_sys->devices[ i ].base.subdevice_id = p->pc_subdevice;
|
||||
pci_sys->devices[ i ].base.device_class = (uint32_t)p->pc_class << 16 |
|
||||
(uint32_t)p->pc_subclass << 8 | (uint32_t)p->pc_progif;
|
||||
}
|
||||
|
156
lib/libpciaccess/src/linux_devmem.c
Normal file
156
lib/libpciaccess/src/linux_devmem.c
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2007
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file linux_devmem.c
|
||||
* Access PCI subsystem using Linux's the old /dev/mem interface.
|
||||
*
|
||||
* \note
|
||||
* This is currently just a skeleton. It only includes the /dev/mem based
|
||||
* function for reading the device ROM.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "pciaccess.h"
|
||||
#include "pciaccess_private.h"
|
||||
#include "linux_devmem.h"
|
||||
|
||||
/**
|
||||
* Read a device's expansion ROM using /dev/mem.
|
||||
*
|
||||
* \note
|
||||
* This function could probably be used, as-is, on other platforms that have
|
||||
* a /dev/mem interface.
|
||||
*
|
||||
* \bugs
|
||||
* Before using the VGA special case code, this function should check that
|
||||
* VGA access are routed to the device. Right?
|
||||
*/
|
||||
_pci_hidden int
|
||||
pci_device_linux_devmem_read_rom(struct pci_device *dev, void *buffer)
|
||||
{
|
||||
struct pci_device_private *priv = (struct pci_device_private *) dev;
|
||||
int fd;
|
||||
int err = 0;
|
||||
uint32_t rom_base_tmp;
|
||||
pciaddr_t rom_base;
|
||||
pciaddr_t rom_size;
|
||||
int PCI_ROM;
|
||||
|
||||
|
||||
/* Handle some special cases of legacy devices.
|
||||
*/
|
||||
if (priv->base.rom_size == 0) {
|
||||
/* VGA ROMs are supposed to be at 0xC0000.
|
||||
*/
|
||||
if ((priv->base.device_class & 0x00ffff00) == 0x000030000) {
|
||||
rom_base = 0x000C0000;
|
||||
rom_size = 0x00010000;
|
||||
PCI_ROM = 0;
|
||||
}
|
||||
else {
|
||||
/* "Function not implemented."
|
||||
*/
|
||||
return ENOSYS;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rom_base = priv->rom_base;
|
||||
rom_size = priv->base.rom_size;
|
||||
PCI_ROM = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Enable the device's ROM.
|
||||
*/
|
||||
if (PCI_ROM) {
|
||||
err = pci_device_cfg_read_u32(& priv->base, & rom_base_tmp, 48);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((rom_base_tmp & 0x000000001) == 0) {
|
||||
err = pci_device_cfg_write_u32(& priv->base,
|
||||
rom_base_tmp | 1, 48);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read the portion of /dev/mem that corresponds to the device's ROM.
|
||||
*/
|
||||
fd = open("/dev/mem", O_RDONLY, 0);
|
||||
if (fd < 0) {
|
||||
err = errno;
|
||||
}
|
||||
else {
|
||||
size_t bytes;
|
||||
|
||||
for (bytes = 0; bytes < rom_size; /* empty */) {
|
||||
const ssize_t got = pread(fd, buffer, rom_size - bytes,
|
||||
rom_base + bytes);
|
||||
if (got == -1) {
|
||||
err = errno;
|
||||
break;
|
||||
}
|
||||
|
||||
bytes += got;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
/* Disable the device's ROM.
|
||||
*/
|
||||
if (PCI_ROM && ((rom_base_tmp & 0x000000001) == 0)) {
|
||||
const int tmp_err = pci_device_cfg_write_u32(& priv->base,
|
||||
rom_base_tmp, 48);
|
||||
|
||||
/* Prefer to return the first error that occured.
|
||||
*/
|
||||
if (err == 0) {
|
||||
err = tmp_err;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
34
lib/libpciaccess/src/linux_devmem.h
Normal file
34
lib/libpciaccess/src/linux_devmem.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2007
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file linux_devmem.h
|
||||
* Functions and datastructures that are private to the /dev/mem based
|
||||
* back-end for pciaccess.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
extern int pci_device_linux_devmem_read_rom(struct pci_device *dev,
|
||||
void *buffer);
|
@ -44,19 +44,29 @@
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_MTRR
|
||||
#include <asm/mtrr.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "pciaccess.h"
|
||||
#include "pciaccess_private.h"
|
||||
#include "linux_devmem.h"
|
||||
|
||||
static void pci_device_linux_sysfs_enable(struct pci_device *dev);
|
||||
|
||||
static int pci_device_linux_sysfs_read_rom( struct pci_device * dev,
|
||||
void * buffer );
|
||||
|
||||
static int pci_device_linux_sysfs_probe( struct pci_device * dev );
|
||||
|
||||
static int pci_device_linux_sysfs_map_region( struct pci_device * dev,
|
||||
unsigned region, int write_enable );
|
||||
static int pci_device_linux_sysfs_map_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map);
|
||||
|
||||
static int pci_device_linux_sysfs_unmap_region( struct pci_device * dev,
|
||||
unsigned region );
|
||||
static int pci_device_linux_sysfs_unmap_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map);
|
||||
|
||||
static int pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
|
||||
pciaddr_t offset, pciaddr_t size, pciaddr_t * bytes_read );
|
||||
@ -70,13 +80,14 @@ static const struct pci_system_methods linux_sysfs_methods = {
|
||||
.destroy_device = NULL,
|
||||
.read_rom = pci_device_linux_sysfs_read_rom,
|
||||
.probe = pci_device_linux_sysfs_probe,
|
||||
.map = pci_device_linux_sysfs_map_region,
|
||||
.unmap = pci_device_linux_sysfs_unmap_region,
|
||||
.map_range = pci_device_linux_sysfs_map_range,
|
||||
.unmap_range = pci_device_linux_sysfs_unmap_range,
|
||||
|
||||
.read = pci_device_linux_sysfs_read,
|
||||
.write = pci_device_linux_sysfs_write,
|
||||
|
||||
.fill_capabilities = pci_fill_capabilities_generic
|
||||
.fill_capabilities = pci_fill_capabilities_generic,
|
||||
.enable = pci_device_linux_sysfs_enable,
|
||||
};
|
||||
|
||||
#define SYS_BUS_PCI "/sys/bus/pci/devices"
|
||||
@ -88,7 +99,7 @@ static int populate_entries(struct pci_system * pci_sys);
|
||||
/**
|
||||
* Attempt to access PCI subsystem using Linux's sysfs interface.
|
||||
*/
|
||||
int
|
||||
_pci_hidden int
|
||||
pci_system_linux_sysfs_create( void )
|
||||
{
|
||||
int err = 0;
|
||||
@ -103,6 +114,9 @@ pci_system_linux_sysfs_create( void )
|
||||
pci_sys = calloc( 1, sizeof( struct pci_system ) );
|
||||
if ( pci_sys != NULL ) {
|
||||
pci_sys->methods = & linux_sysfs_methods;
|
||||
#ifdef HAVE_MTRR
|
||||
pci_sys->mtrr_fd = open("/proc/mtrr", O_WRONLY);
|
||||
#endif
|
||||
err = populate_entries(pci_sys);
|
||||
}
|
||||
else {
|
||||
@ -141,7 +155,7 @@ populate_entries( struct pci_system * p )
|
||||
struct dirent ** devices;
|
||||
int n;
|
||||
int i;
|
||||
int err;
|
||||
int err = 0;
|
||||
|
||||
|
||||
n = scandir( SYS_BUS_PCI, & devices, scan_sys_pci_filter, alphasort );
|
||||
@ -278,6 +292,7 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
|
||||
high_addr = strtoull( next, & next, 16 );
|
||||
flags = strtoull( next, & next, 16 );
|
||||
if ( low_addr != 0 ) {
|
||||
priv->rom_base = low_addr;
|
||||
dev->rom_size = (high_addr - low_addr) + 1;
|
||||
}
|
||||
}
|
||||
@ -294,6 +309,7 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
|
||||
int fd;
|
||||
struct stat st;
|
||||
int err = 0;
|
||||
size_t rom_size;
|
||||
size_t total_bytes;
|
||||
|
||||
|
||||
@ -306,7 +322,10 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
|
||||
|
||||
fd = open( name, O_RDWR );
|
||||
if ( fd == -1 ) {
|
||||
return errno;
|
||||
/* If reading the ROM using sysfs fails, fall back to the old
|
||||
* /dev/mem based interface.
|
||||
*/
|
||||
return pci_device_linux_devmem_read_rom(dev, buffer);
|
||||
}
|
||||
|
||||
|
||||
@ -315,6 +334,9 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
|
||||
return errno;
|
||||
}
|
||||
|
||||
rom_size = st.st_size;
|
||||
if ( rom_size == 0 )
|
||||
rom_size = 0x10000;
|
||||
|
||||
/* This is a quirky thing on Linux. Even though the ROM and the file
|
||||
* for the ROM in sysfs are read-only, the string "1" must be written to
|
||||
@ -324,9 +346,9 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
|
||||
write( fd, "1", 1 );
|
||||
lseek( fd, 0, SEEK_SET );
|
||||
|
||||
for ( total_bytes = 0 ; total_bytes < st.st_size ; /* empty */ ) {
|
||||
for ( total_bytes = 0 ; total_bytes < rom_size ; /* empty */ ) {
|
||||
const int bytes = read( fd, (char *) buffer + total_bytes,
|
||||
st.st_size - total_bytes );
|
||||
rom_size - total_bytes );
|
||||
if ( bytes == -1 ) {
|
||||
err = errno;
|
||||
break;
|
||||
@ -356,7 +378,7 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
|
||||
pciaddr_t temp_size = size;
|
||||
int err = 0;
|
||||
int fd;
|
||||
|
||||
char *data_bytes = data;
|
||||
|
||||
if ( bytes_read != NULL ) {
|
||||
*bytes_read = 0;
|
||||
@ -381,7 +403,7 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
|
||||
|
||||
|
||||
while ( temp_size > 0 ) {
|
||||
const ssize_t bytes = pread64( fd, data, temp_size, offset );
|
||||
const ssize_t bytes = pread64( fd, data_bytes, temp_size, offset );
|
||||
|
||||
/* If zero bytes were read, then we assume it's the end of the
|
||||
* config file.
|
||||
@ -393,7 +415,7 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
|
||||
|
||||
temp_size -= bytes;
|
||||
offset += bytes;
|
||||
data += bytes;
|
||||
data_bytes += bytes;
|
||||
}
|
||||
|
||||
if ( bytes_read != NULL ) {
|
||||
@ -414,7 +436,7 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
|
||||
pciaddr_t temp_size = size;
|
||||
int err = 0;
|
||||
int fd;
|
||||
|
||||
const char *data_bytes = data;
|
||||
|
||||
if ( bytes_written != NULL ) {
|
||||
*bytes_written = 0;
|
||||
@ -439,7 +461,7 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
|
||||
|
||||
|
||||
while ( temp_size > 0 ) {
|
||||
const ssize_t bytes = pwrite64( fd, data, temp_size, offset );
|
||||
const ssize_t bytes = pwrite64( fd, data_bytes, temp_size, offset );
|
||||
|
||||
/* If zero bytes were written, then we assume it's the end of the
|
||||
* config file.
|
||||
@ -451,7 +473,7 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
|
||||
|
||||
temp_size -= bytes;
|
||||
offset += bytes;
|
||||
data += bytes;
|
||||
data_bytes += bytes;
|
||||
}
|
||||
|
||||
if ( bytes_written != NULL ) {
|
||||
@ -466,14 +488,13 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
|
||||
/**
|
||||
* Map a memory region for a device using the Linux sysfs interface.
|
||||
*
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param region Region, on the range [0, 5], that is to be mapped.
|
||||
* \param write_enable Map for writing (non-zero).
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param map Parameters of the mapping that is to be created.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_map_region, pci_device_linux_sysfs_unmap_region
|
||||
* \sa pci_device_map_rrange, pci_device_linux_sysfs_unmap_range
|
||||
*
|
||||
* \todo
|
||||
* Some older 2.6.x kernels don't implement the resourceN files. On those
|
||||
@ -481,51 +502,83 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
|
||||
* \c mmap64 may need to be used.
|
||||
*/
|
||||
static int
|
||||
pci_device_linux_sysfs_map_region( struct pci_device * dev, unsigned region,
|
||||
int write_enable )
|
||||
pci_device_linux_sysfs_map_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map)
|
||||
{
|
||||
char name[256];
|
||||
int fd;
|
||||
int err = 0;
|
||||
const int prot = (write_enable) ? (PROT_READ | PROT_WRITE) : PROT_READ;
|
||||
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
|
||||
? (PROT_READ | PROT_WRITE) : PROT_READ;
|
||||
const int open_flags = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
|
||||
? O_RDWR : O_RDONLY;
|
||||
const off_t offset = map->base - dev->regions[map->region].base_addr;
|
||||
#ifdef HAVE_MTRR
|
||||
struct mtrr_sentry sentry = {
|
||||
.base = map->base,
|
||||
.size = map->size,
|
||||
.type = MTRR_TYPE_UNCACHABLE
|
||||
};
|
||||
#endif
|
||||
|
||||
snprintf(name, 255, "%s/%04x:%02x:%02x.%1u/resource%u",
|
||||
SYS_BUS_PCI,
|
||||
dev->domain,
|
||||
dev->bus,
|
||||
dev->dev,
|
||||
dev->func,
|
||||
map->region);
|
||||
|
||||
snprintf( name, 255, "%s/%04x:%02x:%02x.%1u/resource%u",
|
||||
SYS_BUS_PCI,
|
||||
dev->domain,
|
||||
dev->bus,
|
||||
dev->dev,
|
||||
dev->func,
|
||||
region );
|
||||
|
||||
fd = open( name, (write_enable) ? O_RDWR : O_RDONLY );
|
||||
if ( fd == -1 ) {
|
||||
return errno;
|
||||
fd = open(name, open_flags);
|
||||
if (fd == -1) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
|
||||
dev->regions[ region ].memory = mmap( NULL, dev->regions[ region ].size,
|
||||
prot, MAP_SHARED, fd, 0 );
|
||||
if ( dev->regions[ region ].memory == MAP_FAILED ) {
|
||||
err = errno;
|
||||
dev->regions[ region ].memory = NULL;
|
||||
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, fd, offset);
|
||||
if (map->memory == MAP_FAILED) {
|
||||
err = errno;
|
||||
map->memory = NULL;
|
||||
}
|
||||
|
||||
close( fd );
|
||||
close(fd);
|
||||
|
||||
#ifdef HAVE_MTRR
|
||||
if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) != 0) {
|
||||
sentry.type = MTRR_TYPE_WRBACK;
|
||||
} else if ((map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE) != 0) {
|
||||
sentry.type = MTRR_TYPE_WRCOMB;
|
||||
}
|
||||
|
||||
if (pci_sys->mtrr_fd != -1 && sentry.type != MTRR_TYPE_UNCACHABLE) {
|
||||
if (ioctl(pci_sys->mtrr_fd, MTRRIOC_ADD_ENTRY, &sentry) < 0) {
|
||||
/* FIXME: Should we report an error in this case?
|
||||
*/
|
||||
fprintf(stderr, "error setting MTRR "
|
||||
"(base = 0x%08lx, size = 0x%08x, type = %u) %s (%d)\n",
|
||||
sentry.base, sentry.size, sentry.type,
|
||||
strerror(errno), errno);
|
||||
/* err = errno;*/
|
||||
}
|
||||
/* KLUDGE ALERT -- rewrite the PTEs to turn off the CD and WT bits */
|
||||
mprotect (map->memory, map->size, PROT_NONE);
|
||||
mprotect (map->memory, map->size, PROT_READ|PROT_WRITE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unmap the specified region using the Linux sysfs interface.
|
||||
*
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param region Region, on the range [0, 5], that is to be mapped.
|
||||
*
|
||||
* Unmap a memory region for a device using the Linux sysfs interface.
|
||||
*
|
||||
* \param dev Device whose memory region is to be unmapped.
|
||||
* \param map Parameters of the mapping that is to be destroyed.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*
|
||||
* \sa pci_device_unmap_region, pci_device_linux_sysfs_map_region
|
||||
* \sa pci_device_map_rrange, pci_device_linux_sysfs_map_range
|
||||
*
|
||||
* \todo
|
||||
* Some older 2.6.x kernels don't implement the resourceN files. On those
|
||||
@ -533,16 +586,61 @@ pci_device_linux_sysfs_map_region( struct pci_device * dev, unsigned region,
|
||||
* \c mmap64 may need to be used.
|
||||
*/
|
||||
static int
|
||||
pci_device_linux_sysfs_unmap_region( struct pci_device * dev, unsigned region )
|
||||
pci_device_linux_sysfs_unmap_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map)
|
||||
{
|
||||
int err = 0;
|
||||
#ifdef HAVE_MTRR
|
||||
struct mtrr_sentry sentry = {
|
||||
.base = map->base,
|
||||
.size = map->size,
|
||||
.type = MTRR_TYPE_UNCACHABLE
|
||||
};
|
||||
#endif
|
||||
|
||||
if ( munmap( dev->regions[ region ].memory, dev->regions[ region ].size )
|
||||
== -1 ) {
|
||||
err = errno;
|
||||
err = pci_device_generic_unmap_range (dev, map);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
#ifdef HAVE_MTRR
|
||||
if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) != 0) {
|
||||
sentry.type = MTRR_TYPE_WRBACK;
|
||||
} else if ((map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE) != 0) {
|
||||
sentry.type = MTRR_TYPE_WRCOMB;
|
||||
}
|
||||
|
||||
dev->regions[ region ].memory = NULL;
|
||||
if (pci_sys->mtrr_fd != -1 && sentry.type != MTRR_TYPE_UNCACHABLE) {
|
||||
if (ioctl(pci_sys->mtrr_fd, MTRRIOC_DEL_ENTRY, &sentry) < 0) {
|
||||
/* FIXME: Should we report an error in this case?
|
||||
*/
|
||||
fprintf(stderr, "error setting MTRR "
|
||||
"(base = 0x%08lx, size = 0x%08x, type = %u) %s (%d)\n",
|
||||
sentry.base, sentry.size, sentry.type,
|
||||
strerror(errno), errno);
|
||||
/* err = errno;*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void pci_device_linux_sysfs_enable(struct pci_device *dev)
|
||||
{
|
||||
char name[256];
|
||||
int fd;
|
||||
|
||||
snprintf( name, 255, "%s/%04x:%02x:%02x.%1u/enable",
|
||||
SYS_BUS_PCI,
|
||||
dev->domain,
|
||||
dev->bus,
|
||||
dev->dev,
|
||||
dev->func );
|
||||
|
||||
fd = open( name, O_RDWR );
|
||||
if (fd == -1)
|
||||
return;
|
||||
|
||||
write( fd, "1", 1 );
|
||||
close(fd);
|
||||
}
|
||||
|
@ -1,144 +1,406 @@
|
||||
/* $OpenBSD: openbsd_pci.c,v 1.1 2007/06/06 21:01:25 matthieu Exp $ */
|
||||
/*
|
||||
* (C) Copyright Eric Anholt 2006
|
||||
* (C) Copyright IBM Corporation 2006
|
||||
* All Rights Reserved.
|
||||
* Copyright (c) 2008 Mark Kettenis
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following conditions:
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file openbsd_pci.c
|
||||
*
|
||||
* Access the kernel PCI support using /dev/pci's ioctl and mmap interface.
|
||||
*
|
||||
* \author Eric Anholt <eric@anholt.net>
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/memrange.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/pciio.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/pciio.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "pciaccess.h"
|
||||
#include "pciaccess_private.h"
|
||||
|
||||
/**
|
||||
* OpenBSD private pci_system structure that extends the base pci_system
|
||||
* structure.
|
||||
*
|
||||
* It is initialized once and used as a global, just as pci_system is used.
|
||||
*/
|
||||
struct openbsd_pci_system {
|
||||
struct pci_system pci_sys; /* must come first */
|
||||
int pcidev; /**< fd for /dev/pci */
|
||||
} *openbsd_pci_sys;
|
||||
static int pcifd;
|
||||
static int aperturefd = -1;
|
||||
|
||||
/**
|
||||
* Map a memory region for a device using /dev/mem.
|
||||
*
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param region Region, on the range [0, 5], that is to be mapped.
|
||||
* \param write_enable Map for writing (non-zero).
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*/
|
||||
static int
|
||||
pci_device_openbsd_map(struct pci_device *dev, unsigned int region,
|
||||
int write_enable)
|
||||
pci_read(int bus, int dev, int func, uint32_t reg, uint32_t *val)
|
||||
{
|
||||
struct pci_io io;
|
||||
int err;
|
||||
|
||||
bzero(&io, sizeof(io));
|
||||
io.pi_sel.pc_bus = bus;
|
||||
io.pi_sel.pc_dev = dev;
|
||||
io.pi_sel.pc_func = func;
|
||||
io.pi_reg = reg;
|
||||
io.pi_width = 4;
|
||||
|
||||
err = ioctl(pcifd, PCIOCREAD, &io);
|
||||
if (err)
|
||||
return (err);
|
||||
|
||||
*val = io.pi_data;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmap the specified region.
|
||||
*
|
||||
* \param dev Device whose memory region is to be unmapped.
|
||||
* \param region Region, on the range [0, 5], that is to be unmapped.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*/
|
||||
static int
|
||||
pci_device_openbsd_unmap(struct pci_device *dev, unsigned int region)
|
||||
pci_write(int bus, int dev, int func, uint32_t reg, uint32_t val)
|
||||
{
|
||||
struct pci_io io;
|
||||
|
||||
bzero(&io, sizeof(io));
|
||||
io.pi_sel.pc_bus = bus;
|
||||
io.pi_sel.pc_dev = dev;
|
||||
io.pi_sel.pc_func = func;
|
||||
io.pi_reg = reg;
|
||||
io.pi_width = 4;
|
||||
io.pi_data = val;
|
||||
|
||||
return ioctl(pcifd, PCIOCWRITE, &io);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_nfuncs(int bus, int dev)
|
||||
{
|
||||
uint32_t hdr;
|
||||
|
||||
if (pci_read(bus, dev, 0, PCI_BHLC_REG, &hdr) != 0)
|
||||
return -1;
|
||||
|
||||
return (PCI_HDRTYPE_MULTIFN(hdr) ? 8 : 1);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_device_openbsd_map_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map)
|
||||
{
|
||||
struct mem_range_desc mr;
|
||||
struct mem_range_op mo;
|
||||
int prot = PROT_READ;
|
||||
|
||||
if (map->flags & PCI_DEV_MAP_FLAG_WRITABLE)
|
||||
prot |= PROT_WRITE;
|
||||
|
||||
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, aperturefd,
|
||||
map->base);
|
||||
if (map->memory == MAP_FAILED)
|
||||
return errno;
|
||||
|
||||
/* No need to set an MTRR if it's the default mode. */
|
||||
if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) ||
|
||||
(map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)) {
|
||||
mr.mr_base = map->base;
|
||||
mr.mr_len = map->size;
|
||||
mr.mr_flags = 0;
|
||||
if (map->flags & PCI_DEV_MAP_FLAG_CACHABLE)
|
||||
mr.mr_flags |= MDF_WRITEBACK;
|
||||
if (map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)
|
||||
mr.mr_flags |= MDF_WRITECOMBINE;
|
||||
strlcpy(mr.mr_owner, "pciaccess", sizeof(mr.mr_owner));
|
||||
|
||||
mo.mo_desc = &mr;
|
||||
mo.mo_arg[0] = MEMRANGE_SET_UPDATE;
|
||||
|
||||
if (ioctl(aperturefd, MEMRANGE_SET, &mo))
|
||||
return errno;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pci_device_openbsd_unmap_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map)
|
||||
{
|
||||
struct mem_range_desc mr;
|
||||
struct mem_range_op mo;
|
||||
|
||||
if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) ||
|
||||
(map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)) {
|
||||
mr.mr_base = map->base;
|
||||
mr.mr_len = map->size;
|
||||
mr.mr_flags = MDF_UNCACHEABLE;
|
||||
strlcpy(mr.mr_owner, "pciaccess", sizeof(mr.mr_owner));
|
||||
|
||||
mo.mo_desc = &mr;
|
||||
mo.mo_arg[0] = MEMRANGE_SET_REMOVE;
|
||||
|
||||
(void)ioctl(aperturefd, MEMRANGE_SET, &mo);
|
||||
}
|
||||
|
||||
return pci_device_generic_unmap_range(dev, map);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_device_openbsd_read(struct pci_device *dev, void *data,
|
||||
pciaddr_t offset, pciaddr_t size, pciaddr_t *bytes_read)
|
||||
{
|
||||
struct pci_io io;
|
||||
|
||||
io.pi_sel.pc_bus = dev->bus;
|
||||
io.pi_sel.pc_dev = dev->dev;
|
||||
io.pi_sel.pc_func = dev->func;
|
||||
|
||||
*bytes_read = 0;
|
||||
while (size > 0) {
|
||||
int toread = MIN(size, 4 - (offset & 0x3));
|
||||
|
||||
io.pi_reg = (offset & ~0x3);
|
||||
io.pi_width = 4;
|
||||
|
||||
if (ioctl(pcifd, PCIOCREAD, &io) == -1)
|
||||
return errno;
|
||||
|
||||
io.pi_data = htole32(io.pi_data);
|
||||
io.pi_data >>= ((offset & 0x3) * 8);
|
||||
|
||||
memcpy(data, &io.pi_data, toread);
|
||||
|
||||
offset += toread;
|
||||
data = (char *)data + toread;
|
||||
size -= toread;
|
||||
*bytes_read += toread;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pci_device_openbsd_write(struct pci_device *dev, const void *data,
|
||||
pciaddr_t offset, pciaddr_t size, pciaddr_t *bytes_written)
|
||||
{
|
||||
struct pci_io io;
|
||||
|
||||
if ((offset % 4) == 0 || (size % 4) == 0)
|
||||
return EINVAL;
|
||||
|
||||
io.pi_sel.pc_bus = dev->bus;
|
||||
io.pi_sel.pc_dev = dev->dev;
|
||||
io.pi_sel.pc_func = dev->func;
|
||||
|
||||
*bytes_written = 0;
|
||||
while (size > 0) {
|
||||
io.pi_reg = offset;
|
||||
io.pi_width = 4;
|
||||
memcpy(&io.pi_data, data, 4);
|
||||
|
||||
if (ioctl(pcifd, PCIOCWRITE, &io) == -1)
|
||||
return errno;
|
||||
|
||||
offset += 4;
|
||||
data = (char *)data + 4;
|
||||
size -= 4;
|
||||
*bytes_written += 4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
pci_device_openbsd_probe(struct pci_device *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
pci_device_openbsd_read_rom(struct pci_device *dev, void *buffer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_system_openbsd_destroy(void)
|
||||
{
|
||||
free(openbsd_pci_sys->pci_sys.devices);
|
||||
openbsd_pci_sys = NULL;
|
||||
close(aperturefd);
|
||||
close(pcifd);
|
||||
free(pci_sys);
|
||||
pci_sys = NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
pci_device_openbsd_probe(struct pci_device *device)
|
||||
{
|
||||
struct pci_device_private *priv = (struct pci_device_private *)device;
|
||||
struct pci_mem_region *region;
|
||||
uint64_t reg64, size64;
|
||||
uint32_t bar, reg, size;
|
||||
int bus, dev, func, err;
|
||||
|
||||
bus = device->bus;
|
||||
dev = device->dev;
|
||||
func = device->func;
|
||||
|
||||
err = pci_read(bus, dev, func, PCI_BHLC_REG, ®);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->header_type = PCI_HDRTYPE_TYPE(reg);
|
||||
if (priv->header_type != 0)
|
||||
return 0;
|
||||
|
||||
region = device->regions;
|
||||
for (bar = PCI_MAPREG_START; bar < PCI_MAPREG_END;
|
||||
bar += sizeof(uint32_t), region++) {
|
||||
err = pci_read(bus, dev, func, bar, ®);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* Probe the size of the region. */
|
||||
err = pci_write(bus, dev, func, bar, ~0);
|
||||
if (err)
|
||||
return err;
|
||||
pci_read(bus, dev, func, bar, &size);
|
||||
pci_write(bus, dev, func, bar, reg);
|
||||
|
||||
if (PCI_MAPREG_TYPE(reg) == PCI_MAPREG_TYPE_IO) {
|
||||
region->is_IO = 1;
|
||||
region->base_addr = PCI_MAPREG_IO_ADDR(reg);
|
||||
region->size = PCI_MAPREG_IO_SIZE(size);
|
||||
} else {
|
||||
if (PCI_MAPREG_MEM_PREFETCHABLE(reg))
|
||||
region->is_prefetchable = 1;
|
||||
switch(PCI_MAPREG_MEM_TYPE(reg)) {
|
||||
case PCI_MAPREG_MEM_TYPE_32BIT:
|
||||
case PCI_MAPREG_MEM_TYPE_32BIT_1M:
|
||||
region->base_addr = PCI_MAPREG_MEM_ADDR(reg);
|
||||
region->size = PCI_MAPREG_MEM_SIZE(size);
|
||||
break;
|
||||
case PCI_MAPREG_MEM_TYPE_64BIT:
|
||||
region->is_64 = 1;
|
||||
|
||||
reg64 = reg;
|
||||
size64 = size;
|
||||
|
||||
bar += sizeof(uint32_t);
|
||||
|
||||
err = pci_read(bus, dev, func, bar, ®);
|
||||
if (err)
|
||||
return err;
|
||||
reg64 |= (uint64_t)reg << 32;
|
||||
|
||||
err = pci_write(bus, dev, func, bar, ~0);
|
||||
if (err)
|
||||
return err;
|
||||
pci_read(bus, dev, func, bar, &size);
|
||||
pci_write(bus, dev, func, bar, reg64 >> 32);
|
||||
size64 |= (uint64_t)size << 32;
|
||||
|
||||
region->base_addr = PCI_MAPREG_MEM64_ADDR(reg64);
|
||||
region->size = PCI_MAPREG_MEM64_SIZE(size64);
|
||||
region++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct pci_system_methods openbsd_pci_methods = {
|
||||
.destroy = pci_system_openbsd_destroy,
|
||||
.destroy_device = NULL,
|
||||
.read_rom = pci_device_openbsd_read_rom,
|
||||
.probe = pci_device_openbsd_probe,
|
||||
.map = pci_device_openbsd_map,
|
||||
.unmap = pci_device_openbsd_unmap,
|
||||
.read = pci_device_openbsd_read,
|
||||
.write = pci_device_openbsd_write,
|
||||
.fill_capabilities = pci_fill_capabilities_generic,
|
||||
pci_system_openbsd_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
pci_device_openbsd_probe,
|
||||
pci_device_openbsd_map_range,
|
||||
pci_device_openbsd_unmap_range,
|
||||
pci_device_openbsd_read,
|
||||
pci_device_openbsd_write,
|
||||
pci_fill_capabilities_generic
|
||||
};
|
||||
|
||||
/**
|
||||
* Attempt to acces the OpenBSD PCI interface.
|
||||
*/
|
||||
int
|
||||
pci_system_openbsd_create(void)
|
||||
{
|
||||
openbsd_pci_sys = calloc(1, sizeof(struct openbsd_pci_system));
|
||||
if (openbsd_pci_sys = NULL)
|
||||
struct pci_device_private *device;
|
||||
int bus, dev, func, ndevs, nfuncs;
|
||||
uint32_t reg;
|
||||
|
||||
pcifd = open("/dev/pci", O_RDWR);
|
||||
if (pcifd == -1)
|
||||
return ENXIO;
|
||||
|
||||
pci_sys = calloc(1, sizeof(struct pci_system));
|
||||
if (pci_sys == NULL) {
|
||||
close(aperturefd);
|
||||
close(pcifd);
|
||||
return ENOMEM;
|
||||
pci_sys = &openbsd_pci_sys->pci_sys;
|
||||
}
|
||||
|
||||
pci_sys->methods = &openbsd_pci_methods;
|
||||
|
||||
|
||||
ndevs = 0;
|
||||
for (bus = 0; bus < 256; bus++) {
|
||||
for (dev = 0; dev < 32; dev++) {
|
||||
nfuncs = pci_nfuncs(bus, dev);
|
||||
for (func = 0; func < nfuncs; func++) {
|
||||
if (pci_read(bus, dev, func, PCI_ID_REG,
|
||||
®) != 0)
|
||||
continue;
|
||||
if (PCI_VENDOR(reg) == PCI_VENDOR_INVALID ||
|
||||
PCI_VENDOR(reg) == 0)
|
||||
continue;
|
||||
|
||||
ndevs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pci_sys->num_devices = ndevs;
|
||||
pci_sys->devices = calloc(ndevs, sizeof(struct pci_device_private));
|
||||
if (pci_sys->devices == NULL) {
|
||||
free(pci_sys);
|
||||
close(pcifd);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
device = pci_sys->devices;
|
||||
for (bus = 0; bus < 256; bus++) {
|
||||
for (dev = 0; dev < 32; dev++) {
|
||||
nfuncs = pci_nfuncs(bus, dev);
|
||||
for (func = 0; func < nfuncs; func++) {
|
||||
if (pci_read(bus, dev, func, PCI_ID_REG,
|
||||
®) != 0)
|
||||
continue;
|
||||
if (PCI_VENDOR(reg) == PCI_VENDOR_INVALID ||
|
||||
PCI_VENDOR(reg) == 0)
|
||||
continue;
|
||||
|
||||
device->base.domain = 0;
|
||||
device->base.bus = bus;
|
||||
device->base.dev = dev;
|
||||
device->base.func = func;
|
||||
device->base.vendor_id = PCI_VENDOR(reg);
|
||||
device->base.device_id = PCI_PRODUCT(reg);
|
||||
|
||||
if (pci_read(bus, dev, func, PCI_CLASS_REG,
|
||||
®) != 0)
|
||||
continue;
|
||||
|
||||
device->base.device_class =
|
||||
PCI_INTERFACE(reg) | PCI_CLASS(reg) << 16 |
|
||||
PCI_SUBCLASS(reg) << 8;
|
||||
device->base.revision = PCI_REVISION(reg);
|
||||
|
||||
if (pci_read(bus, dev, func, PCI_SUBVEND_0,
|
||||
®) != 0)
|
||||
continue;
|
||||
|
||||
device->base.subvendor_id = PCI_VENDOR(reg);
|
||||
device->base.subdevice_id = PCI_PRODUCT(reg);
|
||||
|
||||
device++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
pci_system_openbsd_init_dev_mem(int fd)
|
||||
{
|
||||
aperturefd = fd;
|
||||
}
|
||||
|
@ -29,16 +29,28 @@
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
# define _pci_hidden __attribute__((visibility("hidden")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
# define _pci_hidden __hidden
|
||||
#else /* not gcc >= 4 and not Sun Studio >= 8 */
|
||||
# define _pci_hidden
|
||||
#endif /* GNUC >= 4 */
|
||||
|
||||
struct pci_device_mapping;
|
||||
|
||||
int pci_fill_capabilities_generic( struct pci_device * dev );
|
||||
int pci_device_generic_unmap_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map);
|
||||
|
||||
struct pci_system_methods {
|
||||
void (*destroy)( void );
|
||||
void (*destroy_device)( struct pci_device * dev );
|
||||
int (*read_rom)( struct pci_device * dev, void * buffer );
|
||||
int (*probe)( struct pci_device * dev );
|
||||
int (*map)( struct pci_device * dev, unsigned region, int write_enable );
|
||||
int (*unmap)( struct pci_device * dev, unsigned region );
|
||||
int (*map_range)(struct pci_device *dev, struct pci_device_mapping *map);
|
||||
int (*unmap_range)(struct pci_device * dev,
|
||||
struct pci_device_mapping *map);
|
||||
|
||||
int (*read)(struct pci_device * dev, void * data, pciaddr_t offset,
|
||||
pciaddr_t size, pciaddr_t * bytes_read );
|
||||
@ -47,6 +59,15 @@ struct pci_system_methods {
|
||||
pciaddr_t size, pciaddr_t * bytes_written );
|
||||
|
||||
int (*fill_capabilities)( struct pci_device * dev );
|
||||
void (*enable)( struct pci_device *dev );
|
||||
};
|
||||
|
||||
struct pci_device_mapping {
|
||||
pciaddr_t base;
|
||||
pciaddr_t size;
|
||||
unsigned region;
|
||||
unsigned flags;
|
||||
void *memory;
|
||||
};
|
||||
|
||||
struct pci_device_private {
|
||||
@ -62,6 +83,11 @@ struct pci_device_private {
|
||||
const struct pci_agp_info * agp; /**< AGP capability information. */
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Base address of the device's expansion ROM.
|
||||
*/
|
||||
pciaddr_t rom_base;
|
||||
|
||||
/**
|
||||
* \name Bridge information.
|
||||
*/
|
||||
@ -71,7 +97,14 @@ struct pci_device_private {
|
||||
struct pci_pcmcia_bridge_info * pcmcia;
|
||||
} bridge;
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name Mappings active on this device.
|
||||
*/
|
||||
/*@{*/
|
||||
struct pci_device_mapping *mappings;
|
||||
unsigned num_mappings;
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
|
||||
@ -93,9 +126,16 @@ struct pci_system {
|
||||
* Array of known devices.
|
||||
*/
|
||||
struct pci_device_private * devices;
|
||||
|
||||
#ifdef HAVE_MTRR
|
||||
int mtrr_fd;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern struct pci_system * pci_sys;
|
||||
|
||||
extern int pci_system_linux_sysfs_create( void );
|
||||
extern int pci_system_freebsd_create( void );
|
||||
extern int pci_system_openbsd_create( void );
|
||||
extern void pci_system_openbsd_init_dev_mem( int );
|
||||
extern int pci_system_solx_devfs_create( void );
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
|
||||
#include "pciaccess.h"
|
||||
|
||||
@ -60,7 +61,10 @@ print_pci_device( struct pci_device * dev, int verbose )
|
||||
dev_name = "Device unknown";
|
||||
}
|
||||
|
||||
printf("\npci bus 0x%04x cardnum 0x%02x function 0x%02x:"
|
||||
printf("\npci ");
|
||||
if (dev->domain != 0)
|
||||
printf("domain 0x%04x ", dev->domain);
|
||||
printf("bus 0x%04x cardnum 0x%02x function 0x%02x:"
|
||||
" vendor 0x%04x device 0x%04x\n",
|
||||
dev->bus,
|
||||
dev->dev,
|
||||
@ -127,10 +131,10 @@ print_pci_device( struct pci_device * dev, int verbose )
|
||||
pci_device_probe( dev );
|
||||
for ( i = 0 ; i < 6 ; i++ ) {
|
||||
if ( dev->regions[i].base_addr != 0 ) {
|
||||
printf( " BASE%u 0x%08x addr 0x%08x %s",
|
||||
printf( " BASE%u 0x%08x SIZE %d %s",
|
||||
i,
|
||||
0,
|
||||
(intptr_t) dev->regions[i].base_addr,
|
||||
(size_t) dev->regions[i].size,
|
||||
(dev->regions[i].is_IO) ? "I/O" : "MEM" );
|
||||
|
||||
if ( ! dev->regions[i].is_IO ) {
|
||||
@ -176,8 +180,11 @@ int main( int argc, char ** argv )
|
||||
{
|
||||
struct pci_device_iterator * iter;
|
||||
struct pci_device * dev;
|
||||
int ret;
|
||||
|
||||
pci_system_init();
|
||||
ret = pci_system_init();
|
||||
if (ret != 0)
|
||||
err(1, "Couldn't initialize PCI system");
|
||||
|
||||
iter = pci_slot_match_iterator_create( NULL );
|
||||
|
||||
|
@ -100,19 +100,14 @@ static int xsvc_fd = -1;
|
||||
#define DEBUGON 0
|
||||
|
||||
|
||||
|
||||
static int pci_device_solx_devfs_map_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map);
|
||||
|
||||
static int pci_device_solx_devfs_read_rom( struct pci_device * dev,
|
||||
void * buffer );
|
||||
|
||||
static int pci_device_solx_devfs_probe( struct pci_device * dev );
|
||||
|
||||
static int pci_device_solx_devfs_map_region( struct pci_device * dev,
|
||||
unsigned region, int write_enable );
|
||||
|
||||
static int pci_device_solx_devfs_unmap_region( struct pci_device * dev,
|
||||
unsigned region );
|
||||
|
||||
static int pci_device_solx_devfs_read( struct pci_device * dev, void * data,
|
||||
pciaddr_t offset, pciaddr_t size, pciaddr_t * bytes_read );
|
||||
|
||||
@ -144,8 +139,8 @@ static const struct pci_system_methods solx_devfs_methods = {
|
||||
.destroy_device = NULL,
|
||||
.read_rom = pci_device_solx_devfs_read_rom,
|
||||
.probe = pci_device_solx_devfs_probe,
|
||||
.map = pci_device_solx_devfs_map_region,
|
||||
.unmap = pci_device_solx_devfs_unmap_region,
|
||||
.map_range = pci_device_solx_devfs_map_range,
|
||||
.unmap_range = pci_device_generic_unmap_range,
|
||||
|
||||
.read = pci_device_solx_devfs_read,
|
||||
.write = pci_device_solx_devfs_write,
|
||||
@ -599,7 +594,7 @@ pci_device_solx_devfs_probe( struct pci_device * dev )
|
||||
* using libdevinfo
|
||||
*/
|
||||
if ((rnode = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) {
|
||||
(void) fprintf(stderr, "di_init failed: $s\n",
|
||||
(void) fprintf(stderr, "di_init failed: %s\n",
|
||||
strerror(errno));
|
||||
err = errno;
|
||||
} else {
|
||||
@ -758,7 +753,7 @@ pci_device_solx_devfs_read( struct pci_device * dev, void * data,
|
||||
cfg_prg.offset = offset + i;
|
||||
if ((err = ioctl(root_fd, PCITOOL_DEVICE_GET_REG,
|
||||
&cfg_prg)) != 0) {
|
||||
fprintf(stderr, "read bdf<%x,%x,%x,%x> config space failure\n",
|
||||
fprintf(stderr, "read bdf<%x,%x,%x,%llx> config space failure\n",
|
||||
cfg_prg.bus_no,
|
||||
cfg_prg.dev_no,
|
||||
cfg_prg.func_no,
|
||||
@ -836,55 +831,39 @@ pci_device_solx_devfs_write( struct pci_device * dev, const void * data,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Solaris Version
|
||||
/**
|
||||
* Map a memory region for a device using /dev/xsvc.
|
||||
*
|
||||
* \param dev Device whose memory region is to be mapped.
|
||||
* \param map Parameters of the mapping that is to be created.
|
||||
*
|
||||
* \return
|
||||
* Zero on success or an \c errno value on failure.
|
||||
*/
|
||||
static int
|
||||
pci_device_solx_devfs_map_region( struct pci_device * dev, unsigned region,
|
||||
int write_enable )
|
||||
pci_device_solx_devfs_map_range(struct pci_device *dev,
|
||||
struct pci_device_mapping *map)
|
||||
{
|
||||
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
|
||||
? (PROT_READ | PROT_WRITE) : PROT_READ;
|
||||
int err = 0;
|
||||
|
||||
|
||||
if (xsvc_fd < 0) {
|
||||
if ((xsvc_fd = open("/dev/xsvc", O_RDWR)) < 0) {
|
||||
(void) fprintf(stderr, "can not open xsvc driver\n");
|
||||
|
||||
return (-1);
|
||||
(void) fprintf(stderr, "can not open xsvc driver\n");
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
|
||||
dev->regions[region].memory = mmap(NULL, dev->regions[region].size,
|
||||
(write_enable) ? (PROT_READ | PROT_WRITE) : PROT_READ, MAP_SHARED,
|
||||
xsvc_fd, dev->regions[region].base_addr);
|
||||
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, xsvc_fd,
|
||||
map->base);
|
||||
if (map->memory == MAP_FAILED) {
|
||||
err = errno;
|
||||
|
||||
if (dev->regions[region].memory == MAP_FAILED) {
|
||||
dev->regions[region].memory = 0;
|
||||
|
||||
(void) fprintf(stderr, "map rom region =%x failed",
|
||||
dev->regions[region].base_addr);
|
||||
return (-1);
|
||||
(void) fprintf(stderr, "map rom region =%llx failed",
|
||||
map->base);
|
||||
}
|
||||
|
||||
/*
|
||||
* Still used xsvc to do the user space mapping
|
||||
*/
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Solaris version
|
||||
*/
|
||||
static int
|
||||
pci_device_solx_devfs_unmap_region( struct pci_device * dev, unsigned region )
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if ( munmap( dev->regions[ region ].memory, dev->regions[ region ].size )
|
||||
== -1 ) {
|
||||
err = errno;
|
||||
}
|
||||
|
||||
dev->regions[ region ].memory = NULL;
|
||||
|
||||
return (err);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user