home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / asm-powerpc / iseries / vio.h < prev   
Encoding:
C/C++ Source or Header  |  2006-08-11  |  4.0 KB  |  130 lines

  1. /* -*- linux-c -*-
  2.  *
  3.  *  iSeries Virtual I/O Message Path header
  4.  *
  5.  *  Authors: Dave Boutcher <boutcher@us.ibm.com>
  6.  *           Ryan Arnold <ryanarn@us.ibm.com>
  7.  *           Colin Devilbiss <devilbis@us.ibm.com>
  8.  *
  9.  * (C) Copyright 2000 IBM Corporation
  10.  *
  11.  * This header file is used by the iSeries virtual I/O device
  12.  * drivers.  It defines the interfaces to the common functions
  13.  * (implemented in drivers/char/viopath.h) as well as defining
  14.  * common functions and structures.  Currently (at the time I
  15.  * wrote this comment) the iSeries virtual I/O device drivers
  16.  * that use this are
  17.  *   drivers/block/viodasd.c
  18.  *   drivers/char/viocons.c
  19.  *   drivers/char/viotape.c
  20.  *   drivers/cdrom/viocd.c
  21.  *
  22.  * The iSeries virtual ethernet support (veth.c) uses a whole
  23.  * different set of functions.
  24.  *
  25.  * This program is free software;  you can redistribute it and/or
  26.  * modify it under the terms of the GNU General Public License as
  27.  * published by the Free Software Foundation; either version 2 of the
  28.  * License, or (at your option) anyu later version.
  29.  *
  30.  * This program is distributed in the hope that it will be useful, but
  31.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  32.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  33.  * General Public License for more details.
  34.  *
  35.  * You should have received a copy of the GNU General Public License
  36.  * along with this program; if not, write to the Free Software Foundation,
  37.  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  38.  *
  39.  */
  40. #ifndef _ASM_POWERPC_ISERIES_VIO_H
  41. #define _ASM_POWERPC_ISERIES_VIO_H
  42.  
  43. #include <asm/iseries/hv_types.h>
  44. #include <asm/iseries/hv_lp_event.h>
  45.  
  46. /*
  47.  * iSeries virtual I/O events use the subtype field in
  48.  * HvLpEvent to figure out what kind of vio event is coming
  49.  * in.  We use a table to route these, and this defines
  50.  * the maximum number of distinct subtypes
  51.  */
  52. #define VIO_MAX_SUBTYPES 8
  53.  
  54. /*
  55.  * Each subtype can register a handler to process their events.
  56.  * The handler must have this interface.
  57.  */
  58. typedef void (vio_event_handler_t) (struct HvLpEvent * event);
  59.  
  60. extern int viopath_open(HvLpIndex remoteLp, int subtype, int numReq);
  61. extern int viopath_close(HvLpIndex remoteLp, int subtype, int numReq);
  62. extern int vio_setHandler(int subtype, vio_event_handler_t * beh);
  63. extern int vio_clearHandler(int subtype);
  64. extern int viopath_isactive(HvLpIndex lp);
  65. extern HvLpInstanceId viopath_sourceinst(HvLpIndex lp);
  66. extern HvLpInstanceId viopath_targetinst(HvLpIndex lp);
  67. extern void vio_set_hostlp(void);
  68. extern void *vio_get_event_buffer(int subtype);
  69. extern void vio_free_event_buffer(int subtype, void *buffer);
  70.  
  71. extern HvLpIndex viopath_hostLp;
  72. extern HvLpIndex viopath_ourLp;
  73.  
  74. #define VIOCHAR_MAX_DATA    200
  75.  
  76. #define VIOMAJOR_SUBTYPE_MASK    0xff00
  77. #define VIOMINOR_SUBTYPE_MASK    0x00ff
  78. #define VIOMAJOR_SUBTYPE_SHIFT    8
  79.  
  80. #define VIOVERSION        0x0101
  81.  
  82. /*
  83.  * This is the general structure for VIO errors; each module should have
  84.  * a table of them, and each table should be terminated by an entry of
  85.  * { 0, 0, NULL }.  Then, to find a specific error message, a module
  86.  * should pass its local table and the return code.
  87.  */
  88. struct vio_error_entry {
  89.     u16 rc;
  90.     int errno;
  91.     const char *msg;
  92. };
  93. extern const struct vio_error_entry *vio_lookup_rc(
  94.         const struct vio_error_entry *local_table, u16 rc);
  95.  
  96. enum viosubtypes {
  97.     viomajorsubtype_monitor = 0x0100,
  98.     viomajorsubtype_blockio = 0x0200,
  99.     viomajorsubtype_chario = 0x0300,
  100.     viomajorsubtype_config = 0x0400,
  101.     viomajorsubtype_cdio = 0x0500,
  102.     viomajorsubtype_tape = 0x0600,
  103.     viomajorsubtype_scsi = 0x0700
  104. };
  105.  
  106. enum vioconfigsubtype {
  107.     vioconfigget = 0x0001,
  108. };
  109.  
  110. enum viorc {
  111.     viorc_good = 0x0000,
  112.     viorc_noConnection = 0x0001,
  113.     viorc_noReceiver = 0x0002,
  114.     viorc_noBufferAvailable = 0x0003,
  115.     viorc_invalidMessageType = 0x0004,
  116.     viorc_invalidRange = 0x0201,
  117.     viorc_invalidToken = 0x0202,
  118.     viorc_DMAError = 0x0203,
  119.     viorc_useError = 0x0204,
  120.     viorc_releaseError = 0x0205,
  121.     viorc_invalidDisk = 0x0206,
  122.     viorc_openRejected = 0x0301
  123. };
  124.  
  125. struct device;
  126.  
  127. extern struct device *iSeries_vio_dev;
  128.  
  129. #endif /* _ASM_POWERPC_ISERIES_VIO_H */
  130.