ebus.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/oplib.h>
  10. #include <asm/prom.h>
  11. #include <asm/of_device.h>
  12. struct linux_ebus_child {
  13. struct linux_ebus_child *next;
  14. struct linux_ebus_device *parent;
  15. struct linux_ebus *bus;
  16. struct device_node *prom_node;
  17. struct resource resource[PROMREG_MAX];
  18. int num_addrs;
  19. unsigned int irqs[PROMINTR_MAX];
  20. int num_irqs;
  21. };
  22. struct linux_ebus_device {
  23. struct of_device ofdev;
  24. struct linux_ebus_device *next;
  25. struct linux_ebus_child *children;
  26. struct linux_ebus *bus;
  27. struct device_node *prom_node;
  28. struct resource resource[PROMREG_MAX];
  29. int num_addrs;
  30. unsigned int irqs[PROMINTR_MAX];
  31. int num_irqs;
  32. };
  33. #define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
  34. struct linux_ebus {
  35. struct of_device ofdev;
  36. struct linux_ebus *next;
  37. struct linux_ebus_device *devices;
  38. struct pci_dev *self;
  39. int index;
  40. int is_rio;
  41. struct device_node *prom_node;
  42. };
  43. #define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
  44. struct ebus_dma_info {
  45. spinlock_t lock;
  46. void __iomem *regs;
  47. unsigned int flags;
  48. #define EBUS_DMA_FLAG_USE_EBDMA_HANDLER 0x00000001
  49. #define EBUS_DMA_FLAG_TCI_DISABLE 0x00000002
  50. /* These are only valid is EBUS_DMA_FLAG_USE_EBDMA_HANDLER is
  51. * set.
  52. */
  53. void (*callback)(struct ebus_dma_info *p, int event, void *cookie);
  54. void *client_cookie;
  55. unsigned int irq;
  56. #define EBUS_DMA_EVENT_ERROR 1
  57. #define EBUS_DMA_EVENT_DMA 2
  58. #define EBUS_DMA_EVENT_DEVICE 4
  59. unsigned char name[64];
  60. };
  61. extern int ebus_dma_register(struct ebus_dma_info *p);
  62. extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on);
  63. extern void ebus_dma_unregister(struct ebus_dma_info *p);
  64. extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
  65. size_t len);
  66. extern void ebus_dma_prepare(struct ebus_dma_info *p, int write);
  67. extern unsigned int ebus_dma_residue(struct ebus_dma_info *p);
  68. extern unsigned int ebus_dma_addr(struct ebus_dma_info *p);
  69. extern void ebus_dma_enable(struct ebus_dma_info *p, int on);
  70. extern struct linux_ebus *ebus_chain;
  71. extern void ebus_init(void);
  72. #define for_each_ebus(bus) \
  73. for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
  74. #define for_each_ebusdev(dev, bus) \
  75. for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
  76. #define for_each_edevchild(dev, child) \
  77. for((child) = (dev)->children; (child); (child) = (child)->next)
  78. #endif /* !(__SPARC64_EBUS_H) */