Guest User

Untitled

a guest
Apr 1st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #define PCI_CONFIG_DATA    0x0CFC
  2. #define PCI_CONFIG_ADDRESS 0x0CF8
  3.  
  4. uint32_t pci_config_readd(pci_bdf_t addr,uint offset) {
  5.   int bus=addr.bus;
  6.   int dev=addr.dev;
  7.   int func=addr.func;
  8.   uint32_t val;
  9.   int address = 0x80000000|(bus<<16)|(dev<<11)|(func<<8)|(offset&0xFC);
  10.   outl(PCI_CONFIG_ADDRESS,address);
  11.   val = inl(PCI_CONFIG_DATA);
  12.   return val;
  13. }
  14.  
  15. uint barOffset = 0x010; //Bar 0
  16. uint32_t pci_read=pci_config_readd(addr,barOffset);
  17. const uint8_t *pci=(uint8_t*)((uint32_t)(pci_read & 0xFFFFFF00));
Advertisement
Add Comment
Please, Sign In to add comment