pci-bridge.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * include/asm-xtensa/pci-bridge.h
  3. *
  4. * This file is subject to the terms and conditions of the GNU General
  5. * Public License. See the file "COPYING" in the main directory of
  6. * this archive for more details.
  7. *
  8. * Copyright (C) 2005 Tensilica Inc.
  9. */
  10. #ifndef _XTENSA_PCI_BRIDGE_H
  11. #define _XTENSA_PCI_BRIDGE_H
  12. #ifdef __KERNEL__
  13. struct device_node;
  14. struct pci_controller;
  15. /*
  16. * pciauto_bus_scan() enumerates the pci space.
  17. */
  18. extern int pciauto_bus_scan(struct pci_controller *, int);
  19. struct pci_space {
  20. unsigned long start;
  21. unsigned long end;
  22. unsigned long base;
  23. };
  24. /*
  25. * Structure of a PCI controller (host bridge)
  26. */
  27. struct pci_controller {
  28. int index; /* used for pci_controller_num */
  29. struct pci_controller *next;
  30. struct pci_bus *bus;
  31. void *arch_data;
  32. int first_busno;
  33. int last_busno;
  34. struct pci_ops *ops;
  35. volatile unsigned int *cfg_addr;
  36. volatile unsigned char *cfg_data;
  37. /* Currently, we limit ourselves to 1 IO range and 3 mem
  38. * ranges since the common pci_bus structure can't handle more
  39. */
  40. struct resource io_resource;
  41. struct resource mem_resources[3];
  42. int mem_resource_count;
  43. /* Host bridge I/O and Memory space
  44. * Used for BAR placement algorithms
  45. */
  46. struct pci_space io_space;
  47. struct pci_space mem_space;
  48. /* Return the interrupt number fo a device. */
  49. int (*map_irq)(struct pci_dev*, u8, u8);
  50. };
  51. static inline void pcibios_init_resource(struct resource *res,
  52. unsigned long start, unsigned long end, int flags, char *name)
  53. {
  54. res->start = start;
  55. res->end = end;
  56. res->flags = flags;
  57. res->name = name;
  58. res->parent = NULL;
  59. res->sibling = NULL;
  60. res->child = NULL;
  61. }
  62. /* These are used for config access before all the PCI probing has been done. */
  63. int early_read_config_byte(struct pci_controller*, int, int, int, u8*);
  64. int early_read_config_word(struct pci_controller*, int, int, int, u16*);
  65. int early_read_config_dword(struct pci_controller*, int, int, int, u32*);
  66. int early_write_config_byte(struct pci_controller*, int, int, int, u8);
  67. int early_write_config_word(struct pci_controller*, int, int, int, u16);
  68. int early_write_config_dword(struct pci_controller*, int, int, int, u32);
  69. #endif /* __KERNEL__ */
  70. #endif /* _XTENSA_PCI_BRIDGE_H */