1 /* sbus.h: Defines for the Sun SBus. 2 * 3 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 */ 5
6 #ifndef_SPARC_SBUS_H 7 #define_SPARC_SBUS_H 8
9 #include <asm/openprom.h> /* For linux_prom_registers and linux_prom_irqs */ 10
11 /* We scan which devices are on the SBus using the PROM node device 12 * tree. SBus devices are described in two different ways. You can 13 * either get an absolute address at which to access the device, or 14 * you can get a SBus 'slot' number and an offset within that slot. 15 */ 16
17 /* The base address at which to calculate device OBIO addresses. */ 18 #defineSUN_SBUS_BVADDR 0xf8000000
19 #defineSBUS_OFF_MASK 0x01ffffff
20
21 /* These routines are used to calculate device address from slot 22 * numbers + offsets, and vice versa. 23 */ 24
25 externinlineunsignedlong sbus_devaddr(intslotnum, unsignedlongoffset)
/* */ 26 { 27 return (unsignedlong) (SUN_SBUS_BVADDR+((slotnum)<<25)+(offset));
28 } 29
30 externinlineint sbus_dev_slot(unsignedlongdev_addr)
/* */ 31 { 32 return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>25);
33 } 34
35 externinlineunsignedlong sbus_dev_offset(unsignedlongdev_addr)
/* */ 36 { 37 return (unsignedlong) (((dev_addr)-SUN_SBUS_BVADDR)&SBUS_OFF_MASK);
38 } 39
40 /* Handy macro */ 41 #define STRUCT_ALIGN(addr) ((addr+7)&(~7))
42
43 /* Linus SBUS device tables */ 44 structlinux_sbus_device{ 45 structlinux_sbus_device *next; /* next device on this SBus or null */ 46 intprom_node; /* PROM device tree node for this device */ 47 char *prom_name; /* PROM device name */ 48 char *linux_name; /* Name used internally by Linux */ 49
50 /* device register addresses */ 51 structlinux_prom_registers reg_addrs[PROMREG_MAX];
52 int num_registers;
53
54 /* List of IRQ's this device uses. */ 55 structlinux_prom_irqsirqs[PROMINTR_MAX];
56 int num_irqs;
57
58 unsignedlong sbus_addr; /* Absolute base address for device. */ 59 unsignedlong sbus_vaddrs[PROMVADDR_MAX];
60 unsignedlong num_vaddrs;
61 unsignedlongoffset; /* Offset given by PROM */ 62 intslot; /* Device slot number */ 63 };
64
65 /* This struct describes the SBus-es found on this machine. */ 66 structlinux_sbus{ 67 structlinux_sbus *next; /* next SBus, if more than one SBus */ 68 structlinux_sbus_device *devices; /* Link to devices on this SBus */ 69 intprom_node; /* PROM device tree node for this SBus */ 70 char *prom_name; /* Usually "sbus" */ 71 int clock_freq; /* Speed of this SBus */ 72 };
73
74 externstructlinux_sbus Linux_SBus;
75
76 #endif/* !(_SPARC_SBUS_H) */