powerpc: clean up vio.c
This cleans up vio.c after the removal of the legacy iSeries platform. It also removes some no longer referenced include files. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
committed by
Benjamin Herrenschmidt
parent
fcd6f76202
commit
b078766026
@@ -1,201 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2001 Mike Corrigan IBM Corporation
|
|
||||||
*
|
|
||||||
* 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) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* This file contains the "hypervisor call" interface which is used to
|
|
||||||
* drive the hypervisor from the OS.
|
|
||||||
*/
|
|
||||||
#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
|
|
||||||
#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
|
|
||||||
|
|
||||||
#include <linux/types.h>
|
|
||||||
#include <linux/dma-mapping.h>
|
|
||||||
|
|
||||||
#include <asm/iseries/hv_call_sc.h>
|
|
||||||
#include <asm/iseries/hv_types.h>
|
|
||||||
#include <asm/abs_addr.h>
|
|
||||||
|
|
||||||
struct HvLpEvent;
|
|
||||||
|
|
||||||
typedef u8 HvLpEvent_Type;
|
|
||||||
typedef u8 HvLpEvent_AckInd;
|
|
||||||
typedef u8 HvLpEvent_AckType;
|
|
||||||
|
|
||||||
typedef u8 HvLpDma_Direction;
|
|
||||||
typedef u8 HvLpDma_AddressType;
|
|
||||||
|
|
||||||
typedef u64 HvLpEvent_Rc;
|
|
||||||
typedef u64 HvLpDma_Rc;
|
|
||||||
|
|
||||||
#define HvCallEventAckLpEvent HvCallEvent + 0
|
|
||||||
#define HvCallEventCancelLpEvent HvCallEvent + 1
|
|
||||||
#define HvCallEventCloseLpEventPath HvCallEvent + 2
|
|
||||||
#define HvCallEventDmaBufList HvCallEvent + 3
|
|
||||||
#define HvCallEventDmaSingle HvCallEvent + 4
|
|
||||||
#define HvCallEventDmaToSp HvCallEvent + 5
|
|
||||||
#define HvCallEventGetOverflowLpEvents HvCallEvent + 6
|
|
||||||
#define HvCallEventGetSourceLpInstanceId HvCallEvent + 7
|
|
||||||
#define HvCallEventGetTargetLpInstanceId HvCallEvent + 8
|
|
||||||
#define HvCallEventOpenLpEventPath HvCallEvent + 9
|
|
||||||
#define HvCallEventSetLpEventStack HvCallEvent + 10
|
|
||||||
#define HvCallEventSignalLpEvent HvCallEvent + 11
|
|
||||||
#define HvCallEventSignalLpEventParms HvCallEvent + 12
|
|
||||||
#define HvCallEventSetInterLpQueueIndex HvCallEvent + 13
|
|
||||||
#define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14
|
|
||||||
#define HvCallEventRouter15 HvCallEvent + 15
|
|
||||||
|
|
||||||
static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex)
|
|
||||||
{
|
|
||||||
HvCall1(HvCallEventGetOverflowLpEvents, queueIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
|
|
||||||
{
|
|
||||||
HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
|
|
||||||
char *eventStackAddr, u32 eventStackSize)
|
|
||||||
{
|
|
||||||
HvCall3(HvCallEventSetLpEventStack, queueIndex,
|
|
||||||
virt_to_abs(eventStackAddr), eventStackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
|
|
||||||
u16 lpLogicalProcIndex)
|
|
||||||
{
|
|
||||||
HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex,
|
|
||||||
lpLogicalProcIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event)
|
|
||||||
{
|
|
||||||
return HvCall1(HvCallEventSignalLpEvent, virt_to_abs(event));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
|
|
||||||
HvLpEvent_Type type, u16 subtype, HvLpEvent_AckInd ackInd,
|
|
||||||
HvLpEvent_AckType ackType, HvLpInstanceId sourceInstanceId,
|
|
||||||
HvLpInstanceId targetInstanceId, u64 correlationToken,
|
|
||||||
u64 eventData1, u64 eventData2, u64 eventData3,
|
|
||||||
u64 eventData4, u64 eventData5)
|
|
||||||
{
|
|
||||||
/* Pack the misc bits into a single Dword to pass to PLIC */
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
u8 ack_and_target;
|
|
||||||
u8 type;
|
|
||||||
u16 subtype;
|
|
||||||
HvLpInstanceId src_inst;
|
|
||||||
HvLpInstanceId target_inst;
|
|
||||||
} parms;
|
|
||||||
u64 dword;
|
|
||||||
} packed;
|
|
||||||
|
|
||||||
packed.parms.ack_and_target = (ackType << 7) | (ackInd << 6) | targetLp;
|
|
||||||
packed.parms.type = type;
|
|
||||||
packed.parms.subtype = subtype;
|
|
||||||
packed.parms.src_inst = sourceInstanceId;
|
|
||||||
packed.parms.target_inst = targetInstanceId;
|
|
||||||
|
|
||||||
return HvCall7(HvCallEventSignalLpEventParms, packed.dword,
|
|
||||||
correlationToken, eventData1, eventData2,
|
|
||||||
eventData3, eventData4, eventData5);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag);
|
|
||||||
extern void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle);
|
|
||||||
extern dma_addr_t iseries_hv_map(void *vaddr, size_t size,
|
|
||||||
enum dma_data_direction direction);
|
|
||||||
extern void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
|
|
||||||
enum dma_data_direction direction);
|
|
||||||
|
|
||||||
static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
|
|
||||||
{
|
|
||||||
return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event)
|
|
||||||
{
|
|
||||||
return HvCall1(HvCallEventCancelLpEvent, virt_to_abs(event));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(
|
|
||||||
HvLpIndex targetLp, HvLpEvent_Type type)
|
|
||||||
{
|
|
||||||
return HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId(
|
|
||||||
HvLpIndex targetLp, HvLpEvent_Type type)
|
|
||||||
{
|
|
||||||
return HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp,
|
|
||||||
HvLpEvent_Type type)
|
|
||||||
{
|
|
||||||
HvCall2(HvCallEventOpenLpEventPath, targetLp, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp,
|
|
||||||
HvLpEvent_Type type)
|
|
||||||
{
|
|
||||||
HvCall2(HvCallEventCloseLpEventPath, targetLp, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
|
|
||||||
HvLpIndex remoteLp, HvLpDma_Direction direction,
|
|
||||||
HvLpInstanceId localInstanceId,
|
|
||||||
HvLpInstanceId remoteInstanceId,
|
|
||||||
HvLpDma_AddressType localAddressType,
|
|
||||||
HvLpDma_AddressType remoteAddressType,
|
|
||||||
/* Do these need to be converted to absolute addresses? */
|
|
||||||
u64 localBufList, u64 remoteBufList, u32 transferLength)
|
|
||||||
{
|
|
||||||
/* Pack the misc bits into a single Dword to pass to PLIC */
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
u8 flags;
|
|
||||||
HvLpIndex remote;
|
|
||||||
u8 type;
|
|
||||||
u8 reserved;
|
|
||||||
HvLpInstanceId local_inst;
|
|
||||||
HvLpInstanceId remote_inst;
|
|
||||||
} parms;
|
|
||||||
u64 dword;
|
|
||||||
} packed;
|
|
||||||
|
|
||||||
packed.parms.flags = (direction << 7) |
|
|
||||||
(localAddressType << 6) | (remoteAddressType << 5);
|
|
||||||
packed.parms.remote = remoteLp;
|
|
||||||
packed.parms.type = type;
|
|
||||||
packed.parms.reserved = 0;
|
|
||||||
packed.parms.local_inst = localInstanceId;
|
|
||||||
packed.parms.remote_inst = remoteInstanceId;
|
|
||||||
|
|
||||||
return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList,
|
|
||||||
remoteBufList, transferLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
|
|
||||||
u32 length, HvLpDma_Direction dir)
|
|
||||||
{
|
|
||||||
return HvCall4(HvCallEventDmaToSp, virt_to_abs(local), remote,
|
|
||||||
length, dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */
|
|
@@ -1,162 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2001 Mike Corrigan IBM Corporation
|
|
||||||
*
|
|
||||||
* 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) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This file contains the class for HV events in the system. */
|
|
||||||
|
|
||||||
#ifndef _ASM_POWERPC_ISERIES_HV_LP_EVENT_H
|
|
||||||
#define _ASM_POWERPC_ISERIES_HV_LP_EVENT_H
|
|
||||||
|
|
||||||
#include <asm/types.h>
|
|
||||||
#include <asm/ptrace.h>
|
|
||||||
#include <asm/iseries/hv_types.h>
|
|
||||||
#include <asm/iseries/hv_call_event.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* HvLpEvent is the structure for Lp Event messages passed between
|
|
||||||
* partitions through PLIC.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct HvLpEvent {
|
|
||||||
u8 flags; /* Event flags x00-x00 */
|
|
||||||
u8 xType; /* Type of message x01-x01 */
|
|
||||||
u16 xSubtype; /* Subtype for event x02-x03 */
|
|
||||||
u8 xSourceLp; /* Source LP x04-x04 */
|
|
||||||
u8 xTargetLp; /* Target LP x05-x05 */
|
|
||||||
u8 xSizeMinus1; /* Size of Derived class - 1 x06-x06 */
|
|
||||||
u8 xRc; /* RC for Ack flows x07-x07 */
|
|
||||||
u16 xSourceInstanceId; /* Source sides instance id x08-x09 */
|
|
||||||
u16 xTargetInstanceId; /* Target sides instance id x0A-x0B */
|
|
||||||
union {
|
|
||||||
u32 xSubtypeData; /* Data usable by the subtype x0C-x0F */
|
|
||||||
u16 xSubtypeDataShort[2]; /* Data as 2 shorts */
|
|
||||||
u8 xSubtypeDataChar[4]; /* Data as 4 chars */
|
|
||||||
} x;
|
|
||||||
|
|
||||||
u64 xCorrelationToken; /* Unique value for source/type x10-x17 */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef void (*LpEventHandler)(struct HvLpEvent *);
|
|
||||||
|
|
||||||
/* Register a handler for an event type - returns 0 on success */
|
|
||||||
extern int HvLpEvent_registerHandler(HvLpEvent_Type eventType,
|
|
||||||
LpEventHandler hdlr);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unregister a handler for an event type
|
|
||||||
*
|
|
||||||
* This call will sleep until the handler being removed is guaranteed to
|
|
||||||
* be no longer executing on any CPU. Do not call with locks held.
|
|
||||||
*
|
|
||||||
* returns 0 on success
|
|
||||||
* Unregister will fail if there are any paths open for the type
|
|
||||||
*/
|
|
||||||
extern int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Open an Lp Event Path for an event type
|
|
||||||
* returns 0 on success
|
|
||||||
* openPath will fail if there is no handler registered for the event type.
|
|
||||||
* The lpIndex specified is the partition index for the target partition
|
|
||||||
* (for VirtualIo, VirtualLan and SessionMgr) other types specify zero)
|
|
||||||
*/
|
|
||||||
extern int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Close an Lp Event Path for a type and partition
|
|
||||||
* returns 0 on success
|
|
||||||
*/
|
|
||||||
extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
|
|
||||||
|
|
||||||
#define HvLpEvent_Type_Hypervisor 0
|
|
||||||
#define HvLpEvent_Type_MachineFac 1
|
|
||||||
#define HvLpEvent_Type_SessionMgr 2
|
|
||||||
#define HvLpEvent_Type_SpdIo 3
|
|
||||||
#define HvLpEvent_Type_VirtualBus 4
|
|
||||||
#define HvLpEvent_Type_PciIo 5
|
|
||||||
#define HvLpEvent_Type_RioIo 6
|
|
||||||
#define HvLpEvent_Type_VirtualLan 7
|
|
||||||
#define HvLpEvent_Type_VirtualIo 8
|
|
||||||
#define HvLpEvent_Type_NumTypes 9
|
|
||||||
|
|
||||||
#define HvLpEvent_Rc_Good 0
|
|
||||||
#define HvLpEvent_Rc_BufferNotAvailable 1
|
|
||||||
#define HvLpEvent_Rc_Cancelled 2
|
|
||||||
#define HvLpEvent_Rc_GenericError 3
|
|
||||||
#define HvLpEvent_Rc_InvalidAddress 4
|
|
||||||
#define HvLpEvent_Rc_InvalidPartition 5
|
|
||||||
#define HvLpEvent_Rc_InvalidSize 6
|
|
||||||
#define HvLpEvent_Rc_InvalidSubtype 7
|
|
||||||
#define HvLpEvent_Rc_InvalidSubtypeData 8
|
|
||||||
#define HvLpEvent_Rc_InvalidType 9
|
|
||||||
#define HvLpEvent_Rc_PartitionDead 10
|
|
||||||
#define HvLpEvent_Rc_PathClosed 11
|
|
||||||
#define HvLpEvent_Rc_SubtypeError 12
|
|
||||||
|
|
||||||
#define HvLpEvent_Function_Ack 0
|
|
||||||
#define HvLpEvent_Function_Int 1
|
|
||||||
|
|
||||||
#define HvLpEvent_AckInd_NoAck 0
|
|
||||||
#define HvLpEvent_AckInd_DoAck 1
|
|
||||||
|
|
||||||
#define HvLpEvent_AckType_ImmediateAck 0
|
|
||||||
#define HvLpEvent_AckType_DeferredAck 1
|
|
||||||
|
|
||||||
#define HV_LP_EVENT_INT 0x01
|
|
||||||
#define HV_LP_EVENT_DO_ACK 0x02
|
|
||||||
#define HV_LP_EVENT_DEFERRED_ACK 0x04
|
|
||||||
#define HV_LP_EVENT_VALID 0x80
|
|
||||||
|
|
||||||
#define HvLpDma_Direction_LocalToRemote 0
|
|
||||||
#define HvLpDma_Direction_RemoteToLocal 1
|
|
||||||
|
|
||||||
#define HvLpDma_AddressType_TceIndex 0
|
|
||||||
#define HvLpDma_AddressType_RealAddress 1
|
|
||||||
|
|
||||||
#define HvLpDma_Rc_Good 0
|
|
||||||
#define HvLpDma_Rc_Error 1
|
|
||||||
#define HvLpDma_Rc_PartitionDead 2
|
|
||||||
#define HvLpDma_Rc_PathClosed 3
|
|
||||||
#define HvLpDma_Rc_InvalidAddress 4
|
|
||||||
#define HvLpDma_Rc_InvalidLength 5
|
|
||||||
|
|
||||||
static inline int hvlpevent_is_valid(struct HvLpEvent *h)
|
|
||||||
{
|
|
||||||
return h->flags & HV_LP_EVENT_VALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void hvlpevent_invalidate(struct HvLpEvent *h)
|
|
||||||
{
|
|
||||||
h->flags &= ~ HV_LP_EVENT_VALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int hvlpevent_is_int(struct HvLpEvent *h)
|
|
||||||
{
|
|
||||||
return h->flags & HV_LP_EVENT_INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int hvlpevent_is_ack(struct HvLpEvent *h)
|
|
||||||
{
|
|
||||||
return !hvlpevent_is_int(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int hvlpevent_need_ack(struct HvLpEvent *h)
|
|
||||||
{
|
|
||||||
return h->flags & HV_LP_EVENT_DO_ACK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */
|
|
@@ -1,37 +0,0 @@
|
|||||||
#ifndef _ASM_POWERPC_ISERIES_IOMMU_H
|
|
||||||
#define _ASM_POWERPC_ISERIES_IOMMU_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2005 Stephen Rothwell, IBM Corporation
|
|
||||||
*
|
|
||||||
* 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) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the:
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 59 Temple Place, Suite 330,
|
|
||||||
* Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct pci_dev;
|
|
||||||
struct vio_dev;
|
|
||||||
struct device_node;
|
|
||||||
struct iommu_table;
|
|
||||||
|
|
||||||
/* Get table parameters from HV */
|
|
||||||
extern void iommu_table_getparms_iSeries(unsigned long busno,
|
|
||||||
unsigned char slotno, unsigned char virtbus,
|
|
||||||
struct iommu_table *tbl);
|
|
||||||
|
|
||||||
extern struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev);
|
|
||||||
extern void iommu_vio_init(void);
|
|
||||||
|
|
||||||
#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
|
|
@@ -1,265 +0,0 @@
|
|||||||
/* -*- 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
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* common functions and structures. Currently (at the time I
|
|
||||||
* wrote this comment) the iSeries virtual I/O device drivers
|
|
||||||
* that use this are
|
|
||||||
* drivers/block/viodasd.c
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef _ASM_POWERPC_ISERIES_VIO_H
|
|
||||||
#define _ASM_POWERPC_ISERIES_VIO_H
|
|
||||||
|
|
||||||
#include <asm/iseries/hv_types.h>
|
|
||||||
#include <asm/iseries/hv_lp_event.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* iSeries virtual I/O events use the subtype field in
|
|
||||||
* 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
|
|
||||||
|
|
||||||
#define VIOMAXBLOCKDMA 12
|
|
||||||
|
|
||||||
struct open_data {
|
|
||||||
u64 disk_size;
|
|
||||||
u16 max_disk;
|
|
||||||
u16 cylinders;
|
|
||||||
u16 tracks;
|
|
||||||
u16 sectors;
|
|
||||||
u16 bytes_per_sector;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct rw_data {
|
|
||||||
u64 offset;
|
|
||||||
struct {
|
|
||||||
u32 token;
|
|
||||||
u32 reserved;
|
|
||||||
u64 len;
|
|
||||||
} dma_info[VIOMAXBLOCKDMA];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vioblocklpevent {
|
|
||||||
struct HvLpEvent event;
|
|
||||||
u32 reserved;
|
|
||||||
u16 version;
|
|
||||||
u16 sub_result;
|
|
||||||
u16 disk;
|
|
||||||
u16 flags;
|
|
||||||
union {
|
|
||||||
struct open_data open_data;
|
|
||||||
struct rw_data rw_data;
|
|
||||||
u64 changed;
|
|
||||||
} u;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define vioblockflags_ro 0x0001
|
|
||||||
|
|
||||||
enum vioblocksubtype {
|
|
||||||
vioblockopen = 0x0001,
|
|
||||||
vioblockclose = 0x0002,
|
|
||||||
vioblockread = 0x0003,
|
|
||||||
vioblockwrite = 0x0004,
|
|
||||||
vioblockflush = 0x0005,
|
|
||||||
vioblockcheck = 0x0007
|
|
||||||
};
|
|
||||||
|
|
||||||
struct viocdlpevent {
|
|
||||||
struct HvLpEvent event;
|
|
||||||
u32 reserved;
|
|
||||||
u16 version;
|
|
||||||
u16 sub_result;
|
|
||||||
u16 disk;
|
|
||||||
u16 flags;
|
|
||||||
u32 token;
|
|
||||||
u64 offset; /* On open, max number of disks */
|
|
||||||
u64 len; /* On open, size of the disk */
|
|
||||||
u32 block_size; /* Only set on open */
|
|
||||||
u32 media_size; /* Only set on open */
|
|
||||||
};
|
|
||||||
|
|
||||||
enum viocdsubtype {
|
|
||||||
viocdopen = 0x0001,
|
|
||||||
viocdclose = 0x0002,
|
|
||||||
viocdread = 0x0003,
|
|
||||||
viocdwrite = 0x0004,
|
|
||||||
viocdlockdoor = 0x0005,
|
|
||||||
viocdgetinfo = 0x0006,
|
|
||||||
viocdcheck = 0x0007
|
|
||||||
};
|
|
||||||
|
|
||||||
struct viotapelpevent {
|
|
||||||
struct HvLpEvent event;
|
|
||||||
u32 reserved;
|
|
||||||
u16 version;
|
|
||||||
u16 sub_type_result;
|
|
||||||
u16 tape;
|
|
||||||
u16 flags;
|
|
||||||
u32 token;
|
|
||||||
u64 len;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
u32 tape_op;
|
|
||||||
u32 count;
|
|
||||||
} op;
|
|
||||||
struct {
|
|
||||||
u32 type;
|
|
||||||
u32 resid;
|
|
||||||
u32 dsreg;
|
|
||||||
u32 gstat;
|
|
||||||
u32 erreg;
|
|
||||||
u32 file_no;
|
|
||||||
u32 block_no;
|
|
||||||
} get_status;
|
|
||||||
struct {
|
|
||||||
u32 block_no;
|
|
||||||
} get_pos;
|
|
||||||
} u;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum viotapesubtype {
|
|
||||||
viotapeopen = 0x0001,
|
|
||||||
viotapeclose = 0x0002,
|
|
||||||
viotaperead = 0x0003,
|
|
||||||
viotapewrite = 0x0004,
|
|
||||||
viotapegetinfo = 0x0005,
|
|
||||||
viotapeop = 0x0006,
|
|
||||||
viotapegetpos = 0x0007,
|
|
||||||
viotapesetpos = 0x0008,
|
|
||||||
viotapegetstatus = 0x0009
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Each subtype can register a handler to process their events.
|
|
||||||
* The handler must have this interface.
|
|
||||||
*/
|
|
||||||
typedef void (vio_event_handler_t) (struct HvLpEvent * event);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
extern struct vio_dev *vio_create_viodasd(u32 unit);
|
|
||||||
|
|
||||||
extern HvLpIndex viopath_hostLp;
|
|
||||||
extern HvLpIndex viopath_ourLp;
|
|
||||||
|
|
||||||
#define VIOCHAR_MAX_DATA 200
|
|
||||||
|
|
||||||
#define VIOMAJOR_SUBTYPE_MASK 0xff00
|
|
||||||
#define VIOMINOR_SUBTYPE_MASK 0x00ff
|
|
||||||
#define VIOMAJOR_SUBTYPE_SHIFT 8
|
|
||||||
|
|
||||||
#define VIOVERSION 0x0101
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
};
|
|
||||||
extern const struct vio_error_entry *vio_lookup_rc(
|
|
||||||
const struct vio_error_entry *local_table, u16 rc);
|
|
||||||
|
|
||||||
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
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _ASM_POWERPC_ISERIES_VIO_H */
|
|
@@ -34,11 +34,6 @@
|
|||||||
#include <asm/abs_addr.h>
|
#include <asm/abs_addr.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
#include <asm/hvcall.h>
|
#include <asm/hvcall.h>
|
||||||
#include <asm/iseries/vio.h>
|
|
||||||
#include <asm/iseries/hv_types.h>
|
|
||||||
#include <asm/iseries/hv_lp_config.h>
|
|
||||||
#include <asm/iseries/hv_call_xm.h>
|
|
||||||
#include <asm/iseries/iommu.h>
|
|
||||||
|
|
||||||
static struct bus_type vio_bus_type;
|
static struct bus_type vio_bus_type;
|
||||||
|
|
||||||
@@ -1042,7 +1037,6 @@ static void vio_cmo_sysfs_init(void)
|
|||||||
vio_bus_type.bus_attrs = vio_cmo_bus_attrs;
|
vio_bus_type.bus_attrs = vio_cmo_bus_attrs;
|
||||||
}
|
}
|
||||||
#else /* CONFIG_PPC_SMLPAR */
|
#else /* CONFIG_PPC_SMLPAR */
|
||||||
/* Dummy functions for iSeries platform */
|
|
||||||
int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
|
int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
|
||||||
void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {}
|
void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {}
|
||||||
static int vio_cmo_bus_probe(struct vio_dev *viodev) { return 0; }
|
static int vio_cmo_bus_probe(struct vio_dev *viodev) { return 0; }
|
||||||
@@ -1060,9 +1054,6 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
|
|||||||
struct iommu_table *tbl;
|
struct iommu_table *tbl;
|
||||||
unsigned long offset, size;
|
unsigned long offset, size;
|
||||||
|
|
||||||
if (firmware_has_feature(FW_FEATURE_ISERIES))
|
|
||||||
return vio_build_iommu_table_iseries(dev);
|
|
||||||
|
|
||||||
dma_window = of_get_property(dev->dev.of_node,
|
dma_window = of_get_property(dev->dev.of_node,
|
||||||
"ibm,my-dma-window", NULL);
|
"ibm,my-dma-window", NULL);
|
||||||
if (!dma_window)
|
if (!dma_window)
|
||||||
@@ -1195,8 +1186,7 @@ static void __devinit vio_dev_release(struct device *dev)
|
|||||||
{
|
{
|
||||||
struct iommu_table *tbl = get_iommu_table_base(dev);
|
struct iommu_table *tbl = get_iommu_table_base(dev);
|
||||||
|
|
||||||
/* iSeries uses a common table for all vio devices */
|
if (tbl)
|
||||||
if (!firmware_has_feature(FW_FEATURE_ISERIES) && tbl)
|
|
||||||
iommu_free_table(tbl, dev->of_node ?
|
iommu_free_table(tbl, dev->of_node ?
|
||||||
dev->of_node->full_name : dev_name(dev));
|
dev->of_node->full_name : dev_name(dev));
|
||||||
of_node_put(dev->of_node);
|
of_node_put(dev->of_node);
|
||||||
@@ -1244,12 +1234,6 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
|
|||||||
viodev->name = of_node->name;
|
viodev->name = of_node->name;
|
||||||
viodev->type = of_node->type;
|
viodev->type = of_node->type;
|
||||||
viodev->unit_address = *unit_address;
|
viodev->unit_address = *unit_address;
|
||||||
if (firmware_has_feature(FW_FEATURE_ISERIES)) {
|
|
||||||
unit_address = of_get_property(of_node,
|
|
||||||
"linux,unit_address", NULL);
|
|
||||||
if (unit_address != NULL)
|
|
||||||
viodev->unit_address = *unit_address;
|
|
||||||
}
|
|
||||||
viodev->dev.of_node = of_node_get(of_node);
|
viodev->dev.of_node = of_node_get(of_node);
|
||||||
|
|
||||||
if (firmware_has_feature(FW_FEATURE_CMO))
|
if (firmware_has_feature(FW_FEATURE_CMO))
|
||||||
|
Reference in New Issue
Block a user