ebus.h 2.5 KB

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