ebus.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* $Id: ebus.h,v 1.10 2001/03/14 05:00:55 davem Exp $
  2. * ebus.h: PCI to Ebus pseudo driver software state.
  3. *
  4. * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
  5. * Copyright (C) 1999 David S. Miller (davem@redhat.com)
  6. */
  7. #ifndef __SPARC64_EBUS_H
  8. #define __SPARC64_EBUS_H
  9. #include <asm/pbm.h>
  10. #include <asm/oplib.h>
  11. #include <asm/prom.h>
  12. #include <asm/of_device.h>
  13. struct linux_ebus_child {
  14. struct linux_ebus_child *next;
  15. struct linux_ebus_device *parent;
  16. struct linux_ebus *bus;
  17. struct device_node *prom_node;
  18. struct resource resource[PROMREG_MAX];
  19. int num_addrs;
  20. unsigned int irqs[PROMINTR_MAX];
  21. int num_irqs;
  22. };
  23. struct linux_ebus_device {
  24. struct of_device ofdev;
  25. struct linux_ebus_device *next;
  26. struct linux_ebus_child *children;
  27. struct linux_ebus *bus;
  28. struct device_node *prom_node;
  29. struct resource resource[PROMREG_MAX];
  30. int num_addrs;
  31. unsigned int irqs[PROMINTR_MAX];
  32. int num_irqs;
  33. };
  34. #define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
  35. struct linux_ebus {
  36. struct of_device ofdev;
  37. struct linux_ebus *next;
  38. struct linux_ebus_device *devices;
  39. struct pci_pbm_info *parent;
  40. struct pci_dev *self;
  41. int index;
  42. int is_rio;
  43. struct device_node *prom_node;
  44. };
  45. #define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
  46. struct ebus_dma_info {
  47. spinlock_t lock;
  48. void __iomem *regs;
  49. unsigned int flags;
  50. #define EBUS_DMA_FLAG_USE_EBDMA_HANDLER 0x00000001
  51. #define EBUS_DMA_FLAG_TCI_DISABLE 0x00000002
  52. /* These are only valid is EBUS_DMA_FLAG_USE_EBDMA_HANDLER is
  53. * set.
  54. */
  55. void (*callback)(struct ebus_dma_info *p, int event, void *cookie);
  56. void *client_cookie;
  57. unsigned int irq;
  58. #define EBUS_DMA_EVENT_ERROR 1
  59. #define EBUS_DMA_EVENT_DMA 2
  60. #define EBUS_DMA_EVENT_DEVICE 4
  61. unsigned char name[64];
  62. };
  63. extern int ebus_dma_register(struct ebus_dma_info *p);
  64. extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on);
  65. extern void ebus_dma_unregister(struct ebus_dma_info *p);
  66. extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
  67. size_t len);
  68. extern void ebus_dma_prepare(struct ebus_dma_info *p, int write);
  69. extern unsigned int ebus_dma_residue(struct ebus_dma_info *p);
  70. extern unsigned int ebus_dma_addr(struct ebus_dma_info *p);
  71. extern void ebus_dma_enable(struct ebus_dma_info *p, int on);
  72. extern struct linux_ebus *ebus_chain;
  73. extern void ebus_init(void);
  74. #define for_each_ebus(bus) \
  75. for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
  76. #define for_each_ebusdev(dev, bus) \
  77. for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
  78. #define for_each_edevchild(dev, child) \
  79. for((child) = (dev)->children; (child); (child) = (child)->next)
  80. #endif /* !(__SPARC64_EBUS_H) */