pci-bridge.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:2k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * BK Id: SCCS/s.pci-bridge.h 1.11 05/21/01 01:31:30 cort
  3.  */
  4. #ifdef __KERNEL__
  5. #ifndef _ASM_PCI_BRIDGE_H
  6. #define _ASM_PCI_BRIDGE_H
  7. struct device_node;
  8. struct pci_controller;
  9. /*
  10.  * pci_io_base returns the memory address at which you can access
  11.  * the I/O space for PCI bus number `bus' (or NULL on error).
  12.  */
  13. extern void *pci_bus_io_base(unsigned int bus);
  14. extern unsigned long pci_bus_io_base_phys(unsigned int bus);
  15. extern unsigned long pci_bus_mem_base_phys(unsigned int bus);
  16. /*
  17.  * PCI <-> OF matching functions 
  18.  */
  19. extern int pci_device_from_OF_node(struct device_node *node,
  20.    u8* bus, u8* devfn);
  21. extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
  22. /* Get the PCI host controller for a bus */
  23. extern struct pci_controller* pci_bus_to_hose(int bus);
  24. /* Get the PCI host controller for an OF device */
  25. extern struct pci_controller*
  26. pci_find_hose_for_OF_device(struct device_node* node);
  27. /* Fill up host controller resources from the OF node */
  28. extern void
  29. pci_process_bridge_OF_ranges(struct pci_controller *hose,
  30.    struct device_node *dev, int primary);
  31. /*
  32.  * Structure of a PCI controller (host bridge)
  33.  */
  34. struct pci_controller {
  35. int index; /* used for pci_controller_num */
  36. struct pci_controller *next;
  37.         struct pci_bus *bus;
  38. void *arch_data;
  39. int first_busno;
  40. int last_busno;
  41.         
  42. void *io_base_virt;
  43. unsigned long io_base_phys;
  44. /* Some machines (PReP) have a non 1:1 mapping of
  45.  * the PCI memory space in the CPU bus space
  46.  */
  47. unsigned long pci_mem_offset;
  48. struct pci_ops *ops;
  49. volatile unsigned int *cfg_addr;
  50. volatile unsigned char *cfg_data;
  51. /* Currently, we limit ourselves to 1 IO range and 3 mem
  52.  * ranges since the common pci_bus structure can't handle more
  53.  */
  54. struct resource io_resource;
  55. struct resource mem_resources[3];
  56. int mem_resource_count;
  57. };
  58. /* These are used for config access before all the PCI probing
  59.    has been done. */
  60. int early_read_config_byte(struct pci_controller *hose, int bus, int dev_fn, int where, u8 *val);
  61. int early_read_config_word(struct pci_controller *hose, int bus, int dev_fn, int where, u16 *val);
  62. int early_read_config_dword(struct pci_controller *hose, int bus, int dev_fn, int where, u32 *val);
  63. int early_write_config_byte(struct pci_controller *hose, int bus, int dev_fn, int where, u8 val);
  64. int early_write_config_word(struct pci_controller *hose, int bus, int dev_fn, int where, u16 val);
  65. int early_write_config_dword(struct pci_controller *hose, int bus, int dev_fn, int where, u32 val);
  66. #endif
  67. #endif /* __KERNEL__ */