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

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