# How to get PCI Private Driver Data Pointer?



## Farhan Khan (Jan 7, 2017)

Hi all,

I am trying to figure out how FreeBSD's PCI kernel modules work, maybe to do some light porting from Linux.

My understanding is that during the 
	
	



```
attach
```
 call, the device will provide the driver with a pointer to a list of function pointers, which, when parsed, can be used to perform I/O operations. This understanding stems from a comparable method in Linux, specifically these lines https://github.com/lwfinger/rtlwifi_new/blob/master/pci.c#L2223-L2226 where the PCI and Realtek private driver data pointers are assigned and then utilized by the read/write/configure operations.

If this understanding is correct, how is this done in FreeBSD? I cannot seem to find the equivalent code in the 
	
	



```
attach
```
 function here: https://github.com/freebsd/freebsd/blob/master/sys/dev/ath/if_ath_pci.c#L234

Thank you


----------



## SirDice (Jan 9, 2017)

This might help: FreeBSD Architecture Handbook: Chapter 11. PCI Devices


----------

