diff options
author | Erik Arfvidson <erik.arfvidson@unisys.com> | 2015-05-05 18:37:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-08 15:27:31 +0200 |
commit | d5b3f1dccee4dedeff8e264b58fbfe90a6033ecf (patch) | |
tree | 81b2be2f0d31f914da3db23fdcd9dd614a63ef8b | |
parent | 01f125ca99f038775daae9e5963a4bf368623986 (diff) |
staging: unisys: move timskmod.h functionality
This patch removes all timksmod.h pound defines. It also removes
visorkmodutils.c since it no longer has any use by itself. Since
visorkmodutils.c is no longer needed the module_init for
visorchipset.c is modified to call visorutil_spar_detect directly
instead of the extern variable in timksmod.h.
Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/unisys/include/periodic_work.h | 1 | ||||
-rw-r--r-- | drivers/staging/unisys/include/timskmod.h | 94 | ||||
-rw-r--r-- | drivers/staging/unisys/include/visorbus.h | 10 | ||||
-rw-r--r-- | drivers/staging/unisys/visorbus/visorbus_main.c | 9 | ||||
-rw-r--r-- | drivers/staging/unisys/visorbus/visorbus_private.h | 2 | ||||
-rw-r--r-- | drivers/staging/unisys/visorbus/visorchannel.c | 14 | ||||
-rw-r--r-- | drivers/staging/unisys/visorbus/visorchipset.c | 38 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/periodic_work.c | 4 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/visorkmodutils.c | 71 |
10 files changed, 50 insertions, 195 deletions
diff --git a/drivers/staging/unisys/include/periodic_work.h b/drivers/staging/unisys/include/periodic_work.h index 21939db22bba..65bad08dcb01 100644 --- a/drivers/staging/unisys/include/periodic_work.h +++ b/drivers/staging/unisys/include/periodic_work.h @@ -20,6 +20,7 @@ #include "timskmod.h" + /* PERIODIC_WORK an opaque structure to users. * Fields are declared only in the implementation .c files. */ diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index 2ee227559181..30d8e7a7e0cd 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h @@ -51,98 +51,4 @@ #include <linux/seq_file.h> #include <linux/mm.h> -/* #define DEBUG */ -#if !defined SUCCESS -#define SUCCESS 0 -#endif -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#define STRUCTSEQUAL(x, y) (memcmp(&x, &y, sizeof(x)) == 0) -#ifndef HOSTADDRESS -#define HOSTADDRESS unsigned long long -#endif - -#define sizeofmember(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER)) -/** "Covered quotient" function */ -#define COVQ(v, d) (((v) + (d) - 1) / (d)) -#define SWAPPOINTERS(p1, p2) \ - do { \ - void *SWAPPOINTERS_TEMP = (void *)p1; \ - (void *)(p1) = (void *)(p2); \ - (void *)(p2) = SWAPPOINTERS_TEMP; \ - } while (0) - -#define WARNDRV(fmt, args...) LOGWRN(fmt, ## args) -#define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args) - -#define PRINTKDEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args) -#define TBDDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args) -#define HUHDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args) -#define ERRDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args) -#define ERRDEVX(devno, fmt, args...) LOGERRDEVX(devno, fmt, ## args) -#define WARNDEV(devname, fmt, args...) LOGWRNDEV(devname, fmt, ## args) -#define SECUREDEV(devname, fmt, args...) LOGWRNDEV(devname, fmt, ## args) -#define INFODEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args) -#define INFODEVX(devno, fmt, args...) LOGINFDEVX(devno, fmt, ## args) - -/** Verifies the consistency of your PRIVATEDEVICEDATA structure using - * conventional "signature" fields: - * <p> - * - sig1 should contain the size of the structure - * - sig2 should contain a pointer to the beginning of the structure - */ -#define DDLOOKSVALID(dd) \ - ((dd != NULL) && \ - ((dd)->sig1 == sizeof(PRIVATEDEVICEDATA)) && \ - ((dd)->sig2 == dd)) - -/** Verifies the consistency of your PRIVATEFILEDATA structure using - * conventional "signature" fields: - * <p> - * - sig1 should contain the size of the structure - * - sig2 should contain a pointer to the beginning of the structure - */ -#define FDLOOKSVALID(fd) \ - ((fd != NULL) && \ - ((fd)->sig1 == sizeof(PRIVATEFILEDATA)) && \ - ((fd)->sig2 == fd)) - -/** Sleep for an indicated number of seconds (for use in kernel mode). - * x - the number of seconds to sleep. - */ -#define SLEEP(x) \ - do { __set_current_state(TASK_INTERRUPTIBLE); \ - schedule_timeout((x)*HZ); \ - } while (0) - -/** Sleep for an indicated number of jiffies (for use in kernel mode). - * x - the number of jiffies to sleep. - */ -#define SLEEPJIFFIES(x) \ - do { __set_current_state(TASK_INTERRUPTIBLE); \ - schedule_timeout(x); \ - } while (0) - -static inline struct cdev *cdev_alloc_init(struct module *owner, - const struct file_operations *fops) -{ - struct cdev *cdev = NULL; - - cdev = cdev_alloc(); - if (!cdev) - return NULL; - cdev->ops = fops; - cdev->owner = owner; - - /* Note that the memory allocated for cdev will be deallocated - * when the usage count drops to 0, because it is controlled - * by a kobject of type ktype_cdev_dynamic. (This - * deallocation could very well happen outside of our kernel - * module, like via the cdev_put in __fput() for example.) - */ - return cdev; -} - -extern int unisys_spar_platform; - #endif diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index bce8aa255f74..f97e203c2e7f 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -37,10 +37,6 @@ #include "periodic_work.h" #include "channel.h" -#ifndef HOSTADDRESS -#define HOSTADDRESS u64 -#endif - struct visor_driver; struct visor_device; @@ -170,9 +166,9 @@ void visorbus_disable_channel_interrupts(struct visor_device *dev); * <channel_bytes> and <guid> arguments may be 0 if we are a channel CLIENT. * In this case, the values can simply be read from the channel header. */ -struct visorchannel *visorchannel_create(HOSTADDRESS physaddr, +struct visorchannel *visorchannel_create(u64 physaddr, ulong channel_bytes, uuid_le guid); -struct visorchannel *visorchannel_create_with_lock(HOSTADDRESS physaddr, +struct visorchannel *visorchannel_create_with_lock(u64 physaddr, ulong channel_bytes, uuid_le guid); void visorchannel_destroy(struct visorchannel *channel); @@ -189,7 +185,7 @@ bool visorchannel_signalinsert(struct visorchannel *channel, u32 queue, int visorchannel_signalqueue_slots_avail(struct visorchannel *channel, u32 queue); int visorchannel_signalqueue_max_slots(struct visorchannel *channel, u32 queue); -HOSTADDRESS visorchannel_get_physaddr(struct visorchannel *channel); +u64 visorchannel_get_physaddr(struct visorchannel *channel); ulong visorchannel_get_nbytes(struct visorchannel *channel); char *visorchannel_id(struct visorchannel *channel, char *s); char *visorchannel_zoneid(struct visorchannel *channel, char *s); diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index b522ea4d2c2d..914298b73282 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1428,7 +1428,7 @@ remove_visor_device(struct visor_device *dev) } static struct visor_device * -find_visor_device_by_channel(HOSTADDRESS channel_physaddr) +find_visor_device_by_channel(u64 channel_physaddr) { struct list_head *listentry, *listtmp; @@ -1607,8 +1607,9 @@ fix_vbus_dev_info(struct visor_device *visordev) * type name */ for (i = 0; visordrv->channel_types[i].name; i++) { - if (STRUCTSEQUAL(visordrv->channel_types[i].guid, - visordev->channel_type_guid)) { + if (memcmp(&visordrv->channel_types[i].guid, + &visordev->channel_type_guid, + sizeof(visordrv->channel_types[i].guid)) == 0) { chan_type_name = visordrv->channel_types[i].name; break; } @@ -1667,7 +1668,7 @@ create_bus_instance(int id) if ((visorchipset_get_bus_info(id, &bus_info)) && (bus_info.chan_info.channel_addr > 0) && (bus_info.chan_info.n_channel_bytes > 0)) { - HOSTADDRESS channel_addr = bus_info.chan_info.channel_addr; + u64 channel_addr = bus_info.chan_info.channel_addr; unsigned long n_channel_bytes = (unsigned long) bus_info.chan_info.n_channel_bytes; diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 1153c99e813f..32e26ed52085 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -54,7 +54,7 @@ enum visorchipset_addresstype { */ struct visorchipset_channel_info { enum visorchipset_addresstype addr_type; - HOSTADDRESS channel_addr; + u64 channel_addr; struct irq_info intr; u64 n_channel_bytes; uuid_le channel_type_uuid; diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index bf1e039df7af..44ea43462803 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -27,7 +27,7 @@ #define MYDRVNAME "visorchannel" struct visorchannel { - HOSTADDRESS physaddr; + u64 physaddr; ulong nbytes; void __iomem *mapped; struct channel_header chan_hdr; @@ -50,7 +50,7 @@ struct visorchannel { * but does NOT modify this data area. */ static struct visorchannel * -visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, +visorchannel_create_guts(u64 physaddr, ulong channel_bytes, ulong off, uuid_le guid, bool needs_lock) { struct visorchannel *channel; @@ -112,7 +112,7 @@ cleanup: } struct visorchannel * -visorchannel_create(HOSTADDRESS physaddr, ulong channel_bytes, uuid_le guid) +visorchannel_create(u64 physaddr, ulong channel_bytes, uuid_le guid) { return visorchannel_create_guts(physaddr, channel_bytes, 0, guid, false); @@ -120,7 +120,7 @@ visorchannel_create(HOSTADDRESS physaddr, ulong channel_bytes, uuid_le guid) EXPORT_SYMBOL_GPL(visorchannel_create); struct visorchannel * -visorchannel_create_with_lock(HOSTADDRESS physaddr, ulong channel_bytes, +visorchannel_create_with_lock(u64 physaddr, ulong channel_bytes, uuid_le guid) { return visorchannel_create_guts(physaddr, channel_bytes, 0, guid, @@ -141,7 +141,7 @@ visorchannel_destroy(struct visorchannel *channel) } EXPORT_SYMBOL_GPL(visorchannel_destroy); -HOSTADDRESS +u64 visorchannel_get_physaddr(struct visorchannel *channel) { return channel->physaddr; @@ -177,7 +177,7 @@ visorchannel_zoneid(struct visorchannel *channel, char *s) } EXPORT_SYMBOL_GPL(visorchannel_zoneid); -HOSTADDRESS +u64 visorchannel_get_clientpartition(struct visorchannel *channel) { return channel->chan_hdr.partition_handle; @@ -498,7 +498,7 @@ void visorchannel_debug(struct visorchannel *channel, int num_queues, struct seq_file *seq, u32 off) { - HOSTADDRESS addr = 0; + u64 addr = 0; ulong nbytes = 0, nbytes_region = 0; struct channel_header hdr; struct channel_header *phdr = &hdr; diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index fde89938cee5..8ff79c0eeff2 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -47,6 +47,14 @@ #define VISORCHIPSET_MMAP_CONTROLCHANOFFSET 0x00000000 + +#define UNISYS_SPAR_LEAF_ID 0x40000000 + +/* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */ +#define UNISYS_SPAR_ID_EBX 0x73696e55 +#define UNISYS_SPAR_ID_ECX 0x70537379 +#define UNISYS_SPAR_ID_EDX 0x34367261 + /* * Module parameters */ @@ -1675,7 +1683,7 @@ my_device_destroy(struct controlvm_message *inmsg) * for failure. */ static int -initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, +initialize_controlvm_payload_info(u64 phys_addr, u64 offset, u32 bytes, struct visor_controlvm_payload_info *info) { u8 __iomem *payload = NULL; @@ -1723,7 +1731,7 @@ destroy_controlvm_payload_info(struct visor_controlvm_payload_info *info) static void initialize_controlvm_payload(void) { - HOSTADDRESS phys_addr = visorchannel_get_physaddr(controlvm_channel); + u64 phys_addr = visorchannel_get_physaddr(controlvm_channel); u64 payload_offset = 0; u32 payload_bytes = 0; @@ -2056,7 +2064,7 @@ parahotplug_process_message(struct controlvm_message *inmsg) * either successfully or with an error. */ static bool -handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) +handle_command(struct controlvm_message inmsg, u64 channel_addr) { struct controlvm_message_packet *cmd = &inmsg.cmd; u64 parm_addr; @@ -2152,7 +2160,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) return true; } -static HOSTADDRESS controlvm_get_channel_address(void) +static u64 controlvm_get_channel_address(void) { u64 addr = 0; u32 size = 0; @@ -2589,7 +2597,7 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd, sizeof(vrtc_offset))) { return -EFAULT; } - return SUCCESS; + return 0; case VMCALL_UPDATE_PHYSICAL_TIME: if (copy_from_user(&adjustment, (void __user *)arg, sizeof(adjustment))) { @@ -2642,7 +2650,7 @@ static int visorchipset_init(struct acpi_device *acpi_device) { int rc = 0; - HOSTADDRESS addr; + u64 addr; memset(&busdev_notifiers, 0, sizeof(busdev_notifiers)); memset(&controlvm_payload_info, 0, sizeof(controlvm_payload_info)); @@ -2758,7 +2766,6 @@ static const struct acpi_device_id unisys_device_ids[] = { {"PNP0A07", 0}, {"", 0}, }; -MODULE_DEVICE_TABLE(acpi, unisys_device_ids); static struct acpi_driver unisys_acpi_driver = { .name = "unisys_acpi", @@ -2770,12 +2777,25 @@ static struct acpi_driver unisys_acpi_driver = { .remove = visorchipset_exit, }, }; +static __init uint32_t visorutil_spar_detect(void) +{ + unsigned int eax, ebx, ecx, edx; + + if (cpu_has_hypervisor) { + /* check the ID */ + cpuid(UNISYS_SPAR_LEAF_ID, &eax, &ebx, &ecx, &edx); + return (ebx == UNISYS_SPAR_ID_EBX) && + (ecx == UNISYS_SPAR_ID_ECX) && + (edx == UNISYS_SPAR_ID_EDX); + } else { + return 0; + } +} static int init_unisys(void) { int result; - - if (!unisys_spar_platform) + if (!visorutil_spar_detect()) return -ENODEV; result = acpi_bus_register_driver(&unisys_acpi_driver); diff --git a/drivers/staging/unisys/visorutil/Makefile b/drivers/staging/unisys/visorutil/Makefile index f29978772ca3..88db08517471 100644 --- a/drivers/staging/unisys/visorutil/Makefile +++ b/drivers/staging/unisys/visorutil/Makefile @@ -4,6 +4,6 @@ obj-$(CONFIG_UNISYS_VISORUTIL) += visorutil.o -visorutil-y := charqueue.o periodic_work.o visorkmodutils.o +visorutil-y := charqueue.o periodic_work.o ccflags-y += -Idrivers/staging/unisys/include diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index aa357a297f48..aa0c1f875729 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -18,6 +18,7 @@ /* * Helper functions to schedule periodic work in Linux kernel mode. */ +#include <linux/sched.h> #include "timskmod.h" #include "periodic_work.h" @@ -192,7 +193,8 @@ bool visor_periodic_work_stop(struct periodic_work *pw) } if (pw->is_scheduled) { write_unlock(&pw->lock); - SLEEPJIFFIES(10); + __set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(10); write_lock(&pw->lock); } else { pw->want_to_stop = false; diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c deleted file mode 100644 index 0b8f5c163400..000000000000 --- a/drivers/staging/unisys/visorutil/visorkmodutils.c +++ /dev/null @@ -1,71 +0,0 @@ -/* timskmodutils.c - * - * 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. - */ - -#include "timskmod.h" - -#define MYDRVNAME "timskmodutils" - -/* s-Par uses the Intel processor's VT-X features to separate groups of - * processors into partitions. The firmware sets the hypervisor bit and - * reports an ID in the HV capabilities leaf so that the partition's OS - * knows s-Par is present and managing the processors. - */ - -#define UNISYS_SPAR_LEAF_ID 0x40000000 - -/* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */ -#define UNISYS_SPAR_ID_EBX 0x73696e55 -#define UNISYS_SPAR_ID_ECX 0x70537379 -#define UNISYS_SPAR_ID_EDX 0x34367261 - -int unisys_spar_platform; -EXPORT_SYMBOL_GPL(unisys_spar_platform); - -static __init uint32_t visorutil_spar_detect(void) -{ - unsigned int eax, ebx, ecx, edx; - - if (cpu_has_hypervisor) { - /* check the ID */ - cpuid(UNISYS_SPAR_LEAF_ID, &eax, &ebx, &ecx, &edx); - return (ebx == UNISYS_SPAR_ID_EBX) && - (ecx == UNISYS_SPAR_ID_ECX) && - (edx == UNISYS_SPAR_ID_EDX); - } else { - return 0; - } -} - -static __init int visorutil_mod_init(void) -{ - if (visorutil_spar_detect()) { - unisys_spar_platform = true; - return 0; - } else { - return -ENODEV; - } -} - -static __exit void -visorutil_mod_exit(void) -{ -} - -module_init(visorutil_mod_init); -module_exit(visorutil_mod_exit); - -MODULE_LICENSE("GPL"); |