ebus.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* $Id: ebus.h,v 1.2 1999/09/11 23:05:55 zaitcev Exp $
  2. * ebus.h: PCI to Ebus pseudo driver software state.
  3. *
  4. * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
  5. *
  6. * Adopted for sparc by V. Roganov and G. Raiko.
  7. */
  8. #ifndef __SPARC_EBUS_H
  9. #define __SPARC_EBUS_H
  10. #ifndef _LINUX_IOPORT_H
  11. #include <linux/ioport.h>
  12. #endif
  13. #include <asm/oplib.h>
  14. #include <asm/prom.h>
  15. #include <asm/of_device.h>
  16. struct linux_ebus_child {
  17. struct linux_ebus_child *next;
  18. struct linux_ebus_device *parent;
  19. struct linux_ebus *bus;
  20. struct device_node *prom_node;
  21. struct resource resource[PROMREG_MAX];
  22. int num_addrs;
  23. unsigned int irqs[PROMINTR_MAX];
  24. int num_irqs;
  25. };
  26. struct linux_ebus_device {
  27. struct of_device ofdev;
  28. struct linux_ebus_device *next;
  29. struct linux_ebus_child *children;
  30. struct linux_ebus *bus;
  31. struct device_node *prom_node;
  32. struct resource resource[PROMREG_MAX];
  33. int num_addrs;
  34. unsigned int irqs[PROMINTR_MAX];
  35. int num_irqs;
  36. };
  37. #define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
  38. struct linux_ebus {
  39. struct of_device ofdev;
  40. struct linux_ebus *next;
  41. struct linux_ebus_device *devices;
  42. struct linux_pbm_info *parent;
  43. struct pci_dev *self;
  44. struct device_node *prom_node;
  45. };
  46. #define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
  47. struct linux_ebus_dma {
  48. unsigned int dcsr;
  49. unsigned int dacr;
  50. unsigned int dbcr;
  51. };
  52. #define EBUS_DCSR_INT_PEND 0x00000001
  53. #define EBUS_DCSR_ERR_PEND 0x00000002
  54. #define EBUS_DCSR_DRAIN 0x00000004
  55. #define EBUS_DCSR_INT_EN 0x00000010
  56. #define EBUS_DCSR_RESET 0x00000080
  57. #define EBUS_DCSR_WRITE 0x00000100
  58. #define EBUS_DCSR_EN_DMA 0x00000200
  59. #define EBUS_DCSR_CYC_PEND 0x00000400
  60. #define EBUS_DCSR_DIAG_RD_DONE 0x00000800
  61. #define EBUS_DCSR_DIAG_WR_DONE 0x00001000
  62. #define EBUS_DCSR_EN_CNT 0x00002000
  63. #define EBUS_DCSR_TC 0x00004000
  64. #define EBUS_DCSR_DIS_CSR_DRN 0x00010000
  65. #define EBUS_DCSR_BURST_SZ_MASK 0x000c0000
  66. #define EBUS_DCSR_BURST_SZ_1 0x00080000
  67. #define EBUS_DCSR_BURST_SZ_4 0x00000000
  68. #define EBUS_DCSR_BURST_SZ_8 0x00040000
  69. #define EBUS_DCSR_BURST_SZ_16 0x000c0000
  70. #define EBUS_DCSR_DIAG_EN 0x00100000
  71. #define EBUS_DCSR_DIS_ERR_PEND 0x00400000
  72. #define EBUS_DCSR_TCI_DIS 0x00800000
  73. #define EBUS_DCSR_EN_NEXT 0x01000000
  74. #define EBUS_DCSR_DMA_ON 0x02000000
  75. #define EBUS_DCSR_A_LOADED 0x04000000
  76. #define EBUS_DCSR_NA_LOADED 0x08000000
  77. #define EBUS_DCSR_DEV_ID_MASK 0xf0000000
  78. extern struct linux_ebus *ebus_chain;
  79. extern void ebus_init(void);
  80. #define for_each_ebus(bus) \
  81. for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
  82. #define for_each_ebusdev(dev, bus) \
  83. for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
  84. #define for_each_edevchild(dev, child) \
  85. for((child) = (dev)->children; (child); (child) = (child)->next)
  86. #endif /* !(__SPARC_EBUS_H) */