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.3 1995/11/25 00:59:59 davem 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         };
  31 
  32         return -1;
  33 }
  34 
  35 /* Close the device described by device handle 'dhandle'. */
  36 void
  37 prom_close(int dhandle)
     /* [previous][next][first][last][top][bottom][index][help] */
  38 {
  39         switch(prom_vers) {
  40         case PROM_V0:
  41                 (*(romvec->pv_v0devops.v0_devclose))(dhandle);
  42                 return;
  43         case PROM_V2:
  44         case PROM_V3:
  45         case PROM_P1275:
  46                 (*(romvec->pv_v2devops.v2_dev_close))(dhandle);
  47                 return;
  48         };
  49         return;
  50 }
  51 
  52 /* Seek to specified location described by 'seekhi' and 'seeklo'
  53  * for device 'dhandle'.
  54  */
  55 void
  56 prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo)
     /* [previous][next][first][last][top][bottom][index][help] */
  57 {
  58         switch(prom_vers) {
  59         case PROM_V0:
  60                 (*(romvec->pv_v0devops.v0_seekdev))(dhandle, seekhi, seeklo);
  61                 break;
  62         case PROM_V2:
  63         case PROM_V3:
  64         case PROM_P1275:
  65                 (*(romvec->pv_v2devops.v2_dev_seek))(dhandle, seekhi, seeklo);
  66                 break;
  67         };
  68 
  69         return;
  70 }

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