1 /* 2 * Copyright 2008, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PCI2_H 6 #define _PCI2_H 7 8 9 #include <device_manager.h> 10 #include <PCI.h> 11 12 13 typedef struct pci_device pci_device; 14 15 typedef struct pci_device_module_info { 16 driver_module_info info; 17 18 uint8 (*read_io_8)(pci_device *device, addr_t mappedIOAddress); 19 void (*write_io_8)(pci_device *device, addr_t mappedIOAddress, 20 uint8 value); 21 uint16 (*read_io_16)(pci_device *device, addr_t mappedIOAddress); 22 void (*write_io_16)(pci_device *device, addr_t mappedIOAddress, 23 uint16 value); 24 uint32 (*read_io_32)(pci_device *device, addr_t mappedIOAddress); 25 void (*write_io_32)(pci_device *device, addr_t mappedIOAddress, 26 uint32 value); 27 28 phys_addr_t (*ram_address)(pci_device *device, phys_addr_t physicalAddress); 29 30 uint32 (*read_pci_config)(pci_device *device, uint16 offset, 31 uint8 size); 32 void (*write_pci_config)(pci_device *device, uint16 offset, 33 uint8 size, uint32 value); 34 status_t (*find_pci_capability)(pci_device *device, uint8 capID, 35 uint8 *offset); 36 void (*get_pci_info)(pci_device *device, struct pci_info *info); 37 status_t (*find_pci_extended_capability)(pci_device *device, uint16 capID, 38 uint16 *offset); 39 } pci_device_module_info; 40 41 42 /* Attributes of PCI device nodes */ 43 #define B_PCI_DEVICE_DOMAIN "pci/domain" /* uint32 */ 44 #define B_PCI_DEVICE_BUS "pci/bus" /* uint8 */ 45 #define B_PCI_DEVICE_DEVICE "pci/device" /* uint8 */ 46 #define B_PCI_DEVICE_FUNCTION "pci/function" /* uint8 */ 47 48 #endif /* _PCI2_H */ 49