sparc: Remove dinky old-style SBUS probing facilities.
[firefly-linux-kernel-4.4.55.git] / arch / sparc / include / asm / sbus_32.h
1 /*
2  * sbus.h:  Defines for the Sun SBus.
3  *
4  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5  */
6
7 #ifndef _SPARC_SBUS_H
8 #define _SPARC_SBUS_H
9
10 #include <linux/dma-mapping.h>
11 #include <linux/ioport.h>
12 #include <linux/of_device.h>
13
14 #include <asm/oplib.h>
15 #include <asm/prom.h>
16 #include <asm/scatterlist.h>
17
18 /* We scan which devices are on the SBus using the PROM node device
19  * tree.  SBus devices are described in two different ways.  You can
20  * either get an absolute address at which to access the device, or
21  * you can get a SBus 'slot' number and an offset within that slot.
22  */
23
24 /* The base address at which to calculate device OBIO addresses. */
25 #define SUN_SBUS_BVADDR        0xf8000000
26 #define SBUS_OFF_MASK          0x01ffffff
27
28 /* These routines are used to calculate device address from slot
29  * numbers + offsets, and vice versa.
30  */
31
32 static inline unsigned long sbus_devaddr(int slotnum, unsigned long offset)
33 {
34   return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<25)+(offset));
35 }
36
37 static inline int sbus_dev_slot(unsigned long dev_addr)
38 {
39   return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>25);
40 }
41
42 struct sbus_bus;
43
44 /* Linux SBUS device tables */
45 struct sbus_dev {
46         struct of_device        ofdev;
47         struct sbus_bus         *bus;
48         struct sbus_dev         *next;
49         struct sbus_dev         *child;
50         struct sbus_dev         *parent;
51         int prom_node;
52         char prom_name[64];
53         int slot;
54 };
55 #define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev)
56
57 /* This struct describes the SBus(s) found on this machine. */
58 struct sbus_bus {
59         struct of_device        ofdev;
60         struct sbus_dev         *devices;       /* Link to devices on this SBus */
61         struct sbus_bus         *next;          /* next SBus, if more than one SBus */
62         int                     prom_node;      /* PROM device tree node for this SBus */
63         char                    prom_name[64];  /* Usually "sbus" or "sbi" */
64         int                     clock_freq;
65 };
66 #define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev)
67
68 static inline int
69 sbus_is_slave(struct sbus_dev *dev)
70 {
71         /* XXX Have to write this for sun4c's */
72         return 0;
73 }
74
75 /* These yield IOMMU mappings in consistent mode. */
76 void prom_adjust_ranges(struct linux_prom_ranges *, int,
77                         struct linux_prom_ranges *, int);
78
79 extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
80 extern int sbus_arch_preinit(void);
81 extern void sbus_arch_postinit(void);
82
83 #endif /* !(_SPARC_SBUS_H) */