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. 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. struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
  41. int num_ebus_ranges;
  42. struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX];
  43. int num_ebus_intmap;
  44. struct linux_prom_ebus_intmask ebus_intmask;
  45. };
  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) */