root/include/asm-sparc/sbus.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. sbus_devaddr
  2. sbus_dev_slot
  3. sbus_dev_offset
  4. sbus_is_slave

   1 /* $Id: sbus.h,v 1.8 1995/11/25 02:32:38 davem Exp $
   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 <asm/oplib.h>
  11 
  12 /* We scan which devices are on the SBus using the PROM node device
  13  * tree.  SBus devices are described in two different ways.  You can
  14  * either get an absolute address at which to access the device, or
  15  * you can get a SBus 'slot' number and an offset within that slot.
  16  */
  17 
  18 /* The base address at which to calculate device OBIO addresses. */
  19 #define SUN_SBUS_BVADDR        0xf8000000
  20 #define SBUS_OFF_MASK          0x01ffffff
  21 
  22 /* These routines are used to calculate device address from slot
  23  * numbers + offsets, and vice versa.
  24  */
  25 
  26 extern inline unsigned long sbus_devaddr(int slotnum, unsigned long offset)
     /* [previous][next][first][last][top][bottom][index][help] */
  27 {
  28   return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<25)+(offset));
  29 }
  30 
  31 extern inline int sbus_dev_slot(unsigned long dev_addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  32 {
  33   return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>25);
  34 }
  35 
  36 extern inline unsigned long sbus_dev_offset(unsigned long dev_addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  37 {
  38   return (unsigned long) (((dev_addr)-SUN_SBUS_BVADDR)&SBUS_OFF_MASK);
  39 }
  40 
  41 struct linux_sbus;
  42 
  43 /* Linux SBUS device tables */
  44 struct linux_sbus_device {
  45   struct linux_sbus_device *next;      /* next device on this SBus or null */
  46   struct linux_sbus_device *child;     /* For ledma and espdma on sun4m */
  47   struct linux_sbus *my_bus;           /* Back ptr to sbus */
  48   int prom_node;                       /* PROM device tree node for this device */
  49   char prom_name[64];                  /* PROM device name */
  50   char linux_name[64];                 /* Name used internally by Linux */
  51 
  52   struct linux_prom_registers reg_addrs[PROMREG_MAX];
  53   int num_registers;
  54 
  55   struct linux_prom_irqs irqs[PROMINTR_MAX];
  56   int num_irqs;
  57 
  58   unsigned long sbus_addr;             /* Absolute base address for device. */
  59   unsigned long sbus_vaddrs[PROMVADDR_MAX];
  60   unsigned long num_vaddrs;
  61   unsigned long offset;                /* Offset given by PROM */
  62   int slot;
  63 };
  64 
  65 /* This struct describes the SBus(s) found on this machine. */
  66 struct linux_sbus {
  67   struct linux_sbus *next;             /* next SBus, if more than one SBus */
  68   struct linux_sbus_device *devices;   /* Link to devices on this SBus */
  69   int prom_node;                       /* PROM device tree node for this SBus */
  70   char prom_name[64];                  /* Usually "sbus" */
  71   int clock_freq;
  72 };
  73 
  74 extern struct linux_sbus *SBus_chain;
  75 
  76 extern inline int
  77 sbus_is_slave(struct linux_sbus_device *dev)
     /* [previous][next][first][last][top][bottom][index][help] */
  78 {
  79         /* Have to write this for sun4c's */
  80         return 0;
  81 }
  82 
  83 /* Device probing routines could find these handy */
  84 #define for_each_sbus(bus) \
  85         for((bus) = SBus_chain; (bus); (bus)=(bus)->next)
  86 
  87 #define for_each_sbusdev(device, bus) \
  88         for((device) = (bus)->devices; (device); (device)=(device)->next)
  89 
  90 #endif /* !(_SPARC_SBUS_H) */

/* [previous][next][first][last][top][bottom][index][help] */