[PATCH 07/14] staging: unisys: Add support to update Features bits in channel queues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: David Kershner <david.kershner@xxxxxxxxxx>

Add support to visorbus to update the features in the channel queues.
Signal queues features is the memory location to disable/enable signal
queue interrupts.

Signed-off-by: David Kershner <david.kershner@xxxxxxxxxx>
Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/include/visorbus.h      |  4 +++
 drivers/staging/unisys/visorbus/visorchannel.c | 46 ++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index 9235536..644ca30 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -218,6 +218,10 @@ char *visorchannel_uuid_id(uuid_le *guid, char *s);
 void visorchannel_debug(struct visorchannel *channel, int num_queues,
 			struct seq_file *seq, u32 off);
 void __iomem *visorchannel_get_header(struct visorchannel *channel);
+void visorchannel_set_sig_features(struct visorchannel *channel, u32 queue,
+				   u64 features);
+void visorchannel_clear_sig_features(struct visorchannel *channel, u32 queue,
+				     u64 features);
 
 #define BUS_ROOT_DEVICE		UINT_MAX
 struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index a4e117f..2ef79fa 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -538,6 +538,52 @@ visorchannel_signalqueue_max_slots(struct visorchannel *channel, u32 queue)
 }
 EXPORT_SYMBOL_GPL(visorchannel_signalqueue_max_slots);
 
+/**
+ *	visorchannel_clear_or_set_sig_features
+ *
+ *	Clear or set bits within the 64-bit features word for the
+ *	specified channel and queue.
+ *	@channel: the channel to modify features for.
+ *	@queue: the queue number to modify features for.
+ *	@features: a mask of feature bits usage based on is_set flag;
+ *	@is_set: if is_set is true, 1 bits indicate which features bits
+ *		 you want to set within the feature word;
+ *		 if is_set is false, 1 bits indicate which feature bits
+ *		 you want to clear within the features word
+ */
+void
+visorchannel_clear_or_set_sig_features(struct visorchannel *channel,
+				       u32 queue, u64 features, bool is_set)
+{
+	struct signal_queue_header sig_hdr;
+
+	if (!sig_read_header(channel, queue, &sig_hdr))
+		return;
+	sig_hdr.features = (is_set) ? sig_hdr.features | features :
+			   sig_hdr.features & !features;
+	if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, features))
+		return;
+	wmb(); /* required to sync channel with IOSP */
+}
+
+void
+visorchannel_clear_sig_features(struct visorchannel *channel, u32 queue,
+				u64 features)
+{
+	visorchannel_clear_or_set_sig_features(channel, queue, features,
+					       false);
+}
+EXPORT_SYMBOL_GPL(visorchannel_clear_sig_features);
+
+void
+visorchannel_set_sig_features(struct visorchannel *channel, u32 queue,
+			      u64 features)
+{
+	visorchannel_clear_or_set_sig_features(channel, queue, features,
+					       true);
+}
+EXPORT_SYMBOL_GPL(visorchannel_set_sig_features);
+
 static void
 sigqueue_debug(struct signal_queue_header *q, int which, struct seq_file *seq)
 {
-- 
2.5.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux