root/arch/sparc/prom/devops.c

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

DEFINITIONS

This source file includes following definitions.
  1. prom_devopen
  2. prom_close
  3. prom_seek

   1 /* $Id: devops.c,v 1.4 1996/04/04 16:30:58 tridge Exp $
   2  * devops.c:  Device operations using the PROM.
   3  *
   4  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   5  */
   6 
   7 #include <asm/openprom.h>
   8 #include <asm/oplib.h>
   9 
  10 /* Open the device described by the string 'dstr'.  Returns the handle
  11  * to that device used for subsequent operations on that device.
  12  * Returns -1 on failure.
  13  */
  14 int
  15 prom_devopen(char *dstr)
     /* [previous][next][first][last][top][bottom][index][help] */
  16 {
  17         int handle;
  18         switch(prom_vers) {
  19         case PROM_V0:
  20                 handle = (*(romvec->pv_v0devops.v0_devopen))(dstr);
  21                 if(handle == 0) return -1;
  22                 return handle;
  23                 break;
  24         case PROM_V2:
  25         case PROM_V3:
  26         case PROM_P1275:
  27                 handle = (*(romvec->pv_v2devops.v2_dev_open))(dstr);
  28                 return handle;
  29                 break;
  30         case PROM_AP1000:
  31                 break;
  32         };
  33 
  34         return -1;
  35 }
  36 
  37 /* Close the device described by device handle 'dhandle'. */
  38 void
  39 prom_close(int dhandle)
     /* [previous][next][first][last][top][bottom][index][help] */
  40 {
  41         switch(prom_vers) {
  42         case PROM_V0:
  43                 (*(romvec->pv_v0devops.v0_devclose))(dhandle);
  44                 return;
  45         case PROM_V2:
  46         case PROM_V3:
  47         case PROM_P1275:
  48                 (*(romvec->pv_v2devops.v2_dev_close))(dhandle);
  49                 return;
  50         case PROM_AP1000:
  51                 return;
  52         };
  53         return;
  54 }
  55 
  56 /* Seek to specified location described by 'seekhi' and 'seeklo'
  57  * for device 'dhandle'.
  58  */
  59 void
  60 prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo)
     /* [previous][next][first][last][top][bottom][index][help] */
  61 {
  62         switch(prom_vers) {
  63         case PROM_V0:
  64                 (*(romvec->pv_v0devops.v0_seekdev))(dhandle, seekhi, seeklo);
  65                 break;
  66         case PROM_V2:
  67         case PROM_V3:
  68         case PROM_P1275:
  69                 (*(romvec->pv_v2devops.v2_dev_seek))(dhandle, seekhi, seeklo);
  70                 break;
  71         case PROM_AP1000:
  72                 break;
  73         };
  74 
  75         return;
  76 }

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