ebus.h 2.7 KB

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