diff options
author | Prarit Bhargava | 2015-05-06 00:36:15 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2015-05-08 15:26:01 +0200 |
commit | c79b28f7332e54903f6c81ff1157cbd3bf761a17 (patch) | |
tree | 6e115d759eb9d11035372ac0d21b504116f24508 /drivers/staging/unisys/visorbus/visorbus_private.h | |
parent | staging: unisys: move parser.[ch] functionality into visorchipset (diff) | |
download | kernel-qcow2-linux-c79b28f7332e54903f6c81ff1157cbd3bf761a17.tar.gz kernel-qcow2-linux-c79b28f7332e54903f6c81ff1157cbd3bf761a17.tar.xz kernel-qcow2-linux-c79b28f7332e54903f6c81ff1157cbd3bf761a17.zip |
staging: unisys: move visorchipset files to visorbus
Move visorchipset_main.c and visorchipset.h to visorbus/visorchipset.c and
visorbus/visorbus_private.h. This leaves an empty visorchipset directory
which can also be destroyed.
As a result of this patch the visorchipset init code now calls the
visorbus_init() directly. Similarily the visorchipset exit code now
cleans up by calling visorbus_exit().
No other functional changes were made.
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys/visorbus/visorbus_private.h')
-rw-r--r-- | drivers/staging/unisys/visorbus/visorbus_private.h | 218 |
1 files changed, 218 insertions, 0 deletions
diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h new file mode 100644 index 000000000000..68d770f29115 --- /dev/null +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -0,0 +1,218 @@ +/* visorchipset.h + * + * Copyright (C) 2010 - 2013 UNISYS CORPORATION + * All rights reserved. + * + * 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, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + */ + +#ifndef __VISORCHIPSET_H__ +#define __VISORCHIPSET_H__ + +#include <linux/uuid.h> + +#include "channel.h" +#include "controlvmchannel.h" +#include "procobjecttree.h" +#include "vbusdeviceinfo.h" +#include "vbushelper.h" + +#define VISORCHIPSET_MMAP_CONTROLCHANOFFSET 0x00000000 + +/** Describes the state from the perspective of which controlvm messages have + * been received for a bus or device. + */ + +enum PARSER_WHICH_STRING { + PARSERSTRING_INITIATOR, + PARSERSTRING_TARGET, + PARSERSTRING_CONNECTION, + PARSERSTRING_NAME, +}; + +struct visorchannel; +struct parser_context *parser_init(u64 addr, u32 bytes, bool isLocal, + bool *tryAgain); +struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, bool local, + bool *retry); +void parser_param_start(struct parser_context *ctx, + PARSER_WHICH_STRING which_string); +void *parser_param_get(struct parser_context *ctx, char *nam, int namesize); +void *parser_string_get(struct parser_context *ctx); +uuid_le parser_id_get(struct parser_context *ctx); +char *parser_simpleString_get(struct parser_context *ctx); +void *parser_byte_stream_get(struct parser_context *ctx, unsigned long *nbytes); +void parser_done(struct parser_context *ctx); + +struct visorchipset_state { + u32 created:1; + u32 attached:1; + u32 configured:1; + u32 running:1; + /* Add new fields above. */ + /* Remaining bits in this 32-bit word are unused. */ +}; + +enum visorchipset_addresstype { + /** address is guest physical, but outside of the physical memory + * region that is controlled by the running OS (this is the normal + * address type for Supervisor channels) + */ + ADDRTYPE_LOCALPHYSICAL, + + /** address is guest physical, and withIN the confines of the + * physical memory controlled by the running OS. + */ + ADDRTYPE_LOCALTEST, +}; + +enum crash_obj_type { + CRASH_DEV, + CRASH_BUS, +}; + +/** Attributes for a particular Supervisor channel. + */ +struct visorchipset_channel_info { + enum visorchipset_addresstype addr_type; + HOSTADDRESS channel_addr; + struct irq_info intr; + u64 n_channel_bytes; + uuid_le channel_type_uuid; + uuid_le channel_inst_uuid; +}; + +/** Attributes for a particular Supervisor device. + * Any visorchipset client can query these attributes using + * visorchipset_get_client_device_info() or + * visorchipset_get_server_device_info(). + */ +struct visorchipset_device_info { + struct list_head entry; + u32 bus_no; + u32 dev_no; + uuid_le dev_inst_uuid; + struct visorchipset_state state; + struct visorchipset_channel_info chan_info; + u32 reserved1; /* control_vm_id */ + u64 reserved2; + u32 switch_no; /* when devState.attached==1 */ + u32 internal_port_no; /* when devState.attached==1 */ + struct controlvm_message_header pending_msg_hdr;/* CONTROLVM_MESSAGE */ + /** For private use by the bus driver */ + void *bus_driver_context; +}; + +/** Attributes for a particular Supervisor bus. + * (For a service partition acting as the server for buses/devices, there + * is a 1-to-1 relationship between busses and guest partitions.) + * Any visorchipset client can query these attributes using + * visorchipset_get_client_bus_info() or visorchipset_get_bus_info(). + */ +struct visorchipset_bus_info { + struct list_head entry; + u32 bus_no; + struct visorchipset_state state; + struct visorchipset_channel_info chan_info; + uuid_le partition_uuid; + u64 partition_handle; + u8 *name; /* UTF8 */ + u8 *description; /* UTF8 */ + u64 reserved1; + u32 reserved2; + struct { + u32 server:1; + /* Add new fields above. */ + /* Remaining bits in this 32-bit word are unused. */ + } flags; + struct controlvm_message_header pending_msg_hdr;/* CONTROLVM MsgHdr */ + /** For private use by the bus driver */ + void *bus_driver_context; +}; + +/* These functions will be called from within visorchipset when certain + * events happen. (The implementation of these functions is outside of + * visorchipset.) + */ +struct visorchipset_busdev_notifiers { + void (*bus_create)(u32 bus_no); + void (*bus_destroy)(u32 bus_no); + void (*device_create)(u32 bus_no, u32 dev_no); + void (*device_destroy)(u32 bus_no, u32 dev_no); + void (*device_pause)(u32 bus_no, u32 dev_no); + void (*device_resume)(u32 bus_no, u32 dev_no); +}; + +/* These functions live inside visorchipset, and will be called to indicate + * responses to specific events (by code outside of visorchipset). + * For now, the value for each response is simply either: + * 0 = it worked + * -1 = it failed + */ +struct visorchipset_busdev_responders { + void (*bus_create)(u32 bus_no, int response); + void (*bus_destroy)(u32 bus_no, int response); + void (*device_create)(u32 bus_no, u32 dev_no, int response); + void (*device_destroy)(u32 bus_no, u32 dev_no, int response); + void (*device_pause)(u32 bus_no, u32 dev_no, int response); + void (*device_resume)(u32 bus_no, u32 dev_no, int response); +}; + +/** Register functions (in the bus driver) to get called by visorchipset + * whenever a bus or device appears for which this service partition is + * to be the server for. visorchipset will fill in <responders>, to + * indicate functions the bus driver should call to indicate message + * responses. + */ +void +visorchipset_register_busdev_client( + struct visorchipset_busdev_notifiers *notifiers, + struct visorchipset_busdev_responders *responders, + struct ultra_vbus_deviceinfo *driver_info); + +/** Register functions (in the bus driver) to get called by visorchipset + * whenever a bus or device appears for which this service partition is + * to be the client for. visorchipset will fill in <responders>, to + * indicate functions the bus driver should call to indicate message + * responses. + */ +void +visorchipset_register_busdev_server( + struct visorchipset_busdev_notifiers *notifiers, + struct visorchipset_busdev_responders *responders, + struct ultra_vbus_deviceinfo *driver_info); + +void visorchipset_device_pause_response(u32 bus_no, u32 dev_no, int response); + +bool visorchipset_get_bus_info(u32 bus_no, + struct visorchipset_bus_info *bus_info); +bool visorchipset_get_device_info(u32 bus_no, u32 dev_no, + struct visorchipset_device_info *dev_info); +bool visorchipset_set_bus_context(u32 bus_no, void *context); +bool visorchipset_set_device_context(u32 bus_no, u32 dev_no, void *context); +int visorchipset_chipset_ready(void); +int visorchipset_chipset_selftest(void); +int visorchipset_chipset_notready(void); +void visorchipset_save_message(struct controlvm_message *msg, + enum crash_obj_type type); +void *visorchipset_cache_alloc(struct kmem_cache *pool, + bool ok_to_block, char *fn, int ln); +void visorchipset_cache_free(struct kmem_cache *pool, void *p, + char *fn, int ln); +int visorchipset_file_init(dev_t majorDev, + struct visorchannel **pControlVm_channel); +void visorchipset_file_cleanup(dev_t major_dev); + +/* visorbus init and exit functions */ +int __init visorbus_init(void); +void visorbus_exit(void); +#endif |