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

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