blob: 543e4e500a72f46d882fd1f9cf7a5d2ddd3f9114 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* $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
8#ifndef __SPARC64_EBUS_H
9#define __SPARC64_EBUS_H
10
11#include <asm/pbm.h>
12#include <asm/oplib.h>
13
14struct linux_ebus_child {
15 struct linux_ebus_child *next;
16 struct linux_ebus_device *parent;
17 struct linux_ebus *bus;
18 int prom_node;
19 char prom_name[64];
20 struct resource resource[PROMREG_MAX];
21 int num_addrs;
22 unsigned int irqs[PROMINTR_MAX];
23 int num_irqs;
24};
25
26struct linux_ebus_device {
27 struct linux_ebus_device *next;
28 struct linux_ebus_child *children;
29 struct linux_ebus *bus;
30 int prom_node;
31 char prom_name[64];
32 struct resource resource[PROMREG_MAX];
33 int num_addrs;
34 unsigned int irqs[PROMINTR_MAX];
35 int num_irqs;
36};
37
38struct linux_ebus {
39 struct linux_ebus *next;
40 struct linux_ebus_device *devices;
41 struct pci_pbm_info *parent;
42 struct pci_dev *self;
43 int index;
44 int is_rio;
45 int prom_node;
46 char prom_name[64];
47 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
48 int num_ebus_ranges;
49 struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX];
50 int num_ebus_intmap;
51 struct linux_prom_ebus_intmask ebus_intmask;
52};
53
54struct ebus_dma_info {
55 spinlock_t lock;
56 void __iomem *regs;
57
58 unsigned int flags;
59#define EBUS_DMA_FLAG_USE_EBDMA_HANDLER 0x00000001
60#define EBUS_DMA_FLAG_TCI_DISABLE 0x00000002
61
62 /* These are only valid is EBUS_DMA_FLAG_USE_EBDMA_HANDLER is
63 * set.
64 */
65 void (*callback)(struct ebus_dma_info *p, int event, void *cookie);
66 void *client_cookie;
67 unsigned int irq;
68#define EBUS_DMA_EVENT_ERROR 1
69#define EBUS_DMA_EVENT_DMA 2
70#define EBUS_DMA_EVENT_DEVICE 4
71
72 unsigned char name[64];
73};
74
75extern int ebus_dma_register(struct ebus_dma_info *p);
76extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on);
77extern void ebus_dma_unregister(struct ebus_dma_info *p);
78extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
79 size_t len);
80extern void ebus_dma_prepare(struct ebus_dma_info *p, int write);
81extern unsigned int ebus_dma_residue(struct ebus_dma_info *p);
82extern void ebus_dma_enable(struct ebus_dma_info *p, int on);
83
84extern struct linux_ebus *ebus_chain;
85
86extern void ebus_init(void);
87
88#define for_each_ebus(bus) \
89 for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
90
91#define for_each_ebusdev(dev, bus) \
92 for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
93
94#define for_each_edevchild(dev, child) \
95 for((child) = (dev)->children; (child); (child) = (child)->next)
96
97#endif /* !(__SPARC64_EBUS_H) */