2005-04-17 06:20:36 +08:00
|
|
|
/* -*- linux-c -*-
|
|
|
|
*
|
|
|
|
* iSeries Virtual I/O Message Path header
|
|
|
|
*
|
|
|
|
* Authors: Dave Boutcher <boutcher@us.ibm.com>
|
|
|
|
* Ryan Arnold <ryanarn@us.ibm.com>
|
|
|
|
* Colin Devilbiss <devilbis@us.ibm.com>
|
|
|
|
*
|
|
|
|
* (C) Copyright 2000 IBM Corporation
|
2005-06-22 08:15:34 +08:00
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* This header file is used by the iSeries virtual I/O device
|
|
|
|
* drivers. It defines the interfaces to the common functions
|
|
|
|
* (implemented in drivers/char/viopath.h) as well as defining
|
2005-06-22 08:15:34 +08:00
|
|
|
* common functions and structures. Currently (at the time I
|
2005-04-17 06:20:36 +08:00
|
|
|
* wrote this comment) the iSeries virtual I/O device drivers
|
2005-06-22 08:15:34 +08:00
|
|
|
* that use this are
|
|
|
|
* drivers/block/viodasd.c
|
2005-04-17 06:20:36 +08:00
|
|
|
* drivers/char/viocons.c
|
|
|
|
* drivers/char/viotape.c
|
|
|
|
* drivers/cdrom/viocd.c
|
|
|
|
*
|
|
|
|
* The iSeries virtual ethernet support (veth.c) uses a whole
|
|
|
|
* different set of functions.
|
2005-06-22 08:15:34 +08:00
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) anyu later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
2005-06-22 08:15:34 +08:00
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
2005-04-17 06:20:36 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2005-06-22 08:15:34 +08:00
|
|
|
* General Public License for more details.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2005-06-22 08:15:34 +08:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2005-04-17 06:20:36 +08:00
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
2005-11-02 12:53:01 +08:00
|
|
|
#ifndef _ASM_POWERPC_ISERIES_VIO_H
|
|
|
|
#define _ASM_POWERPC_ISERIES_VIO_H
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-11-02 10:46:07 +08:00
|
|
|
#include <asm/iseries/hv_types.h>
|
2005-11-02 09:08:31 +08:00
|
|
|
#include <asm/iseries/hv_lp_event.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:15:34 +08:00
|
|
|
/*
|
|
|
|
* iSeries virtual I/O events use the subtype field in
|
2005-04-17 06:20:36 +08:00
|
|
|
* HvLpEvent to figure out what kind of vio event is coming
|
|
|
|
* in. We use a table to route these, and this defines
|
|
|
|
* the maximum number of distinct subtypes
|
|
|
|
*/
|
|
|
|
#define VIO_MAX_SUBTYPES 8
|
|
|
|
|
2005-06-22 08:15:34 +08:00
|
|
|
/*
|
|
|
|
* Each subtype can register a handler to process their events.
|
2005-04-17 06:20:36 +08:00
|
|
|
* The handler must have this interface.
|
|
|
|
*/
|
|
|
|
typedef void (vio_event_handler_t) (struct HvLpEvent * event);
|
|
|
|
|
2005-06-22 08:15:35 +08:00
|
|
|
extern int viopath_open(HvLpIndex remoteLp, int subtype, int numReq);
|
|
|
|
extern int viopath_close(HvLpIndex remoteLp, int subtype, int numReq);
|
|
|
|
extern int vio_setHandler(int subtype, vio_event_handler_t * beh);
|
|
|
|
extern int vio_clearHandler(int subtype);
|
|
|
|
extern int viopath_isactive(HvLpIndex lp);
|
|
|
|
extern HvLpInstanceId viopath_sourceinst(HvLpIndex lp);
|
|
|
|
extern HvLpInstanceId viopath_targetinst(HvLpIndex lp);
|
|
|
|
extern void vio_set_hostlp(void);
|
|
|
|
extern void *vio_get_event_buffer(int subtype);
|
|
|
|
extern void vio_free_event_buffer(int subtype, void *buffer);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern HvLpIndex viopath_hostLp;
|
|
|
|
extern HvLpIndex viopath_ourLp;
|
|
|
|
|
2005-06-22 08:15:34 +08:00
|
|
|
#define VIOCHAR_MAX_DATA 200
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:15:34 +08:00
|
|
|
#define VIOMAJOR_SUBTYPE_MASK 0xff00
|
|
|
|
#define VIOMINOR_SUBTYPE_MASK 0x00ff
|
|
|
|
#define VIOMAJOR_SUBTYPE_SHIFT 8
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:15:34 +08:00
|
|
|
#define VIOVERSION 0x0101
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the general structure for VIO errors; each module should have
|
|
|
|
* a table of them, and each table should be terminated by an entry of
|
|
|
|
* { 0, 0, NULL }. Then, to find a specific error message, a module
|
|
|
|
* should pass its local table and the return code.
|
|
|
|
*/
|
|
|
|
struct vio_error_entry {
|
|
|
|
u16 rc;
|
|
|
|
int errno;
|
|
|
|
const char *msg;
|
|
|
|
};
|
2005-06-22 08:15:34 +08:00
|
|
|
extern const struct vio_error_entry *vio_lookup_rc(
|
|
|
|
const struct vio_error_entry *local_table, u16 rc);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
enum viosubtypes {
|
|
|
|
viomajorsubtype_monitor = 0x0100,
|
|
|
|
viomajorsubtype_blockio = 0x0200,
|
|
|
|
viomajorsubtype_chario = 0x0300,
|
|
|
|
viomajorsubtype_config = 0x0400,
|
|
|
|
viomajorsubtype_cdio = 0x0500,
|
|
|
|
viomajorsubtype_tape = 0x0600,
|
|
|
|
viomajorsubtype_scsi = 0x0700
|
|
|
|
};
|
|
|
|
|
|
|
|
enum vioconfigsubtype {
|
|
|
|
vioconfigget = 0x0001,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum viorc {
|
|
|
|
viorc_good = 0x0000,
|
|
|
|
viorc_noConnection = 0x0001,
|
|
|
|
viorc_noReceiver = 0x0002,
|
|
|
|
viorc_noBufferAvailable = 0x0003,
|
|
|
|
viorc_invalidMessageType = 0x0004,
|
|
|
|
viorc_invalidRange = 0x0201,
|
|
|
|
viorc_invalidToken = 0x0202,
|
|
|
|
viorc_DMAError = 0x0203,
|
|
|
|
viorc_useError = 0x0204,
|
|
|
|
viorc_releaseError = 0x0205,
|
|
|
|
viorc_invalidDisk = 0x0206,
|
|
|
|
viorc_openRejected = 0x0301
|
|
|
|
};
|
|
|
|
|
2006-07-13 16:51:22 +08:00
|
|
|
/*
|
|
|
|
* The structure of the events that flow between us and OS/400 for chario
|
|
|
|
* events. You can't mess with this unless the OS/400 side changes too.
|
|
|
|
*/
|
|
|
|
struct viocharlpevent {
|
|
|
|
struct HvLpEvent event;
|
|
|
|
u32 reserved;
|
|
|
|
u16 version;
|
|
|
|
u16 subtype_result_code;
|
|
|
|
u8 virtual_device;
|
|
|
|
u8 len;
|
|
|
|
u8 data[VIOCHAR_MAX_DATA];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define VIOCHAR_WINDOW 10
|
|
|
|
|
|
|
|
enum viocharsubtype {
|
|
|
|
viocharopen = 0x0001,
|
|
|
|
viocharclose = 0x0002,
|
|
|
|
viochardata = 0x0003,
|
|
|
|
viocharack = 0x0004,
|
|
|
|
viocharconfig = 0x0005
|
|
|
|
};
|
|
|
|
|
|
|
|
enum viochar_rc {
|
|
|
|
viochar_rc_ebusy = 1
|
|
|
|
};
|
|
|
|
|
2005-11-02 12:53:01 +08:00
|
|
|
#endif /* _ASM_POWERPC_ISERIES_VIO_H */
|