* Return value:
* 1 if the insertion succeeds, 0 if the queue was full.
*/
-unsigned char
-visor_signal_insert(struct channel_header __iomem *pChannel, u32 Queue,
- void *pSignal)
+unsigned char spar_signal_insert(struct channel_header __iomem *ch, u32 queue,
+ void *sig)
{
void __iomem *psignal;
unsigned int head, tail, nof;
struct signal_queue_header __iomem *pqhdr =
(struct signal_queue_header __iomem *)
- ((char __iomem *) pChannel + readq(&pChannel->ch_space_offset))
- + Queue;
+ ((char __iomem *) ch + readq(&ch->ch_space_offset))
+ + queue;
/* capture current head and tail */
head = readl(&pqhdr->head);
*/
psignal = (char __iomem *)pqhdr + readq(&pqhdr->sig_base_offset) +
(head * readl(&pqhdr->signal_size));
- memcpy_toio(psignal, pSignal, readl(&pqhdr->signal_size));
+ memcpy_toio(psignal, sig, readl(&pqhdr->signal_size));
mb(); /* channel synch */
writel(head, &pqhdr->head);
writeq(readq(&pqhdr->num_sent) + 1, &pqhdr->num_sent);
return 1;
}
-EXPORT_SYMBOL_GPL(visor_signal_insert);
+EXPORT_SYMBOL_GPL(spar_signal_insert);
/*
* Routine Description:
unsigned long flags;
spin_lock_irqsave(lock, flags);
- result = visor_signal_insert(pChannel, Queue, pSignal);
+ result = spar_signal_insert(pChannel, Queue, pSignal);
spin_unlock_irqrestore(lock, flags);
return result;
}
* is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
*/
static inline int
-ULTRA_check_channel_client(void __iomem *pChannel,
- uuid_le expectedTypeGuid,
- char *channelName,
- u64 expectedMinBytes,
- u32 expectedVersionId,
- u64 expectedSignature,
- char *fileName, int lineNumber, void *logCtx)
+spar_check_channel_client(void __iomem *ch,
+ uuid_le expected_uuid,
+ char *chname,
+ u64 expected_min_bytes,
+ u32 expected_version,
+ u64 expected_signature)
{
- if (uuid_le_cmp(expectedTypeGuid, NULL_UUID_LE) != 0) {
+ if (uuid_le_cmp(expected_uuid, NULL_UUID_LE) != 0) {
uuid_le guid;
memcpy_fromio(&guid,
- &((struct channel_header __iomem *)(pChannel))->chtype,
- sizeof(guid));
+ &((struct channel_header __iomem *)(ch))->chtype,
+ sizeof(guid));
/* caller wants us to verify type GUID */
- if (uuid_le_cmp(guid, expectedTypeGuid) != 0) {
+ if (uuid_le_cmp(guid, expected_uuid) != 0) {
pr_err("Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n",
- channelName, &expectedTypeGuid,
- &expectedTypeGuid, &guid);
+ chname, &expected_uuid,
+ &expected_uuid, &guid);
return 0;
}
}
- if (expectedMinBytes > 0) { /* caller wants us to verify
+ if (expected_min_bytes > 0) { /* caller wants us to verify
* channel size */
unsigned long long bytes =
readq(&((struct channel_header __iomem *)
- (pChannel))->size);
- if (bytes < expectedMinBytes) {
+ (ch))->size);
+ if (bytes < expected_min_bytes) {
pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
- channelName, &expectedTypeGuid,
- (unsigned long long)expectedMinBytes, bytes);
+ chname, &expected_uuid,
+ (unsigned long long)expected_min_bytes, bytes);
return 0;
}
}
- if (expectedVersionId > 0) { /* caller wants us to verify
+ if (expected_version > 0) { /* caller wants us to verify
* channel version */
unsigned long ver = readl(&((struct channel_header __iomem *)
- (pChannel))->version_id);
- if (ver != expectedVersionId) {
+ (ch))->version_id);
+ if (ver != expected_version) {
pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n",
- channelName, &expectedTypeGuid,
- (unsigned long)expectedVersionId, ver);
+ chname, &expected_uuid,
+ (unsigned long)expected_version, ver);
return 0;
}
}
- if (expectedSignature > 0) { /* caller wants us to verify
+ if (expected_signature > 0) { /* caller wants us to verify
* channel signature */
unsigned long long sig =
readq(&((struct channel_header __iomem *)
- (pChannel))->signature);
- if (sig != expectedSignature) {
+ (ch))->signature);
+ if (sig != expected_signature) {
pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8llx actual=0x%-8.8llx\n",
- channelName, &expectedTypeGuid,
- expectedSignature, sig);
+ chname, &expected_uuid,
+ expected_signature, sig);
return 0;
}
}
return 1;
}
-/* Generic function useful for validating any type of channel when it is about
- * to be initialized by the server of the channel.
- * Note that <logCtx> is only needed for callers in the EFI environment, and
- * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
- */
-static inline int
-ULTRA_check_channel_server(uuid_le typeGuid,
- char *channelName,
- u64 expectedMinBytes,
- u64 actualBytes,
- char *fileName, int lineNumber, void *logCtx)
-{
- if (expectedMinBytes > 0) /* caller wants us to verify
- * channel size */
- if (actualBytes < expectedMinBytes) {
- pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8llx actual=0x%-8.8llx\n",
- channelName, &typeGuid, expectedMinBytes,
- actualBytes);
- return 0;
- }
- return 1;
-}
-
/* Given a file pathname <s> (with '/' or '\' separating directory nodes),
* returns a pointer to the beginning of a node within that pathname such
* that the number of nodes from that pointer to the end of the string is
* full.
*/
-unsigned char visor_signal_insert(struct channel_header __iomem *pChannel,
- u32 Queue, void *pSignal);
+unsigned char spar_signal_insert(struct channel_header __iomem *ch, u32 queue,
+ void *sig);
/*
* Routine Description:
* channel struct withOUT needing to increment this. */
#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID 1
-#define ULTRA_CONTROLVM_CHANNEL_OK_CLIENT(pChannel, logCtx) \
- (ULTRA_check_channel_client(pChannel, \
- UltraControlvmChannelProtocolGuid, \
- "controlvm", \
- sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \
- ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \
- ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE, \
- __FILE__, __LINE__, logCtx))
-#define ULTRA_CONTROLVM_CHANNEL_OK_SERVER(actualBytes, logCtx) \
- (ULTRA_check_channel_server(UltraControlvmChannelProtocolGuid, \
- "controlvm", \
- sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \
- actualBytes, __FILE__, __LINE__, logCtx))
+#define SPAR_CONTROLVM_CHANNEL_OK_CLIENT(pChannel) \
+ (spar_check_channel_client(pChannel, \
+ UltraControlvmChannelProtocolGuid, \
+ "controlvm", \
+ sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \
+ ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \
+ ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE))
#define MY_DEVICE_INDEX 0
#define MAX_MACDATA_LEN 8 /* number of bytes for MAC address in config packet */
#define ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID 2
#define ULTRA_DIAG_CHANNEL_OK_CLIENT(pChannel, logCtx) \
- (ULTRA_check_channel_client(pChannel, \
+ (spar_check_channel_client(pChannel, \
UltraDiagChannelProtocolGuid, \
"diag", \
sizeof(ULTRA_DIAG_CHANNEL_PROTOCOL), \
ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID, \
- ULTRA_DIAG_CHANNEL_PROTOCOL_SIGNATURE, \
- __FILE__, __LINE__, logCtx))
+ ULTRA_DIAG_CHANNEL_PROTOCOL_SIGNATURE))
#define ULTRA_DIAG_CHANNEL_OK_SERVER(actualBytes, logCtx) \
(ULTRA_check_channel_server(UltraDiagChannelProtocolGuid, \
"diag", \
#define ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID 2
#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID 1
-#define ULTRA_VHBA_CHANNEL_OK_CLIENT(pChannel, logCtx) \
- (ULTRA_check_channel_client(pChannel, spar_vhba_channel_protocol_uuid, \
- "vhba", MIN_IO_CHANNEL_SIZE, \
- ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \
- ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE, \
- __FILE__, __LINE__, logCtx))
-#define ULTRA_VHBA_CHANNEL_OK_SERVER(actualBytes, logCtx) \
- (ULTRA_check_channel_server(spar_vhba_channel_protocol_uuid, \
- "vhba", MIN_IO_CHANNEL_SIZE, actualBytes, \
- __FILE__, __LINE__, logCtx))
-#define ULTRA_VNIC_CHANNEL_OK_CLIENT(pChannel, logCtx) \
- (ULTRA_check_channel_client(pChannel, spar_vnic_channel_protocol_uuid, \
- "vnic", MIN_IO_CHANNEL_SIZE, \
- ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \
- ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE, \
- __FILE__, __LINE__, logCtx))
-#define ULTRA_VNIC_CHANNEL_OK_SERVER(actualBytes, logCtx) \
- (ULTRA_check_channel_server(spar_vnic_channel_protocol_uuid, \
- "vnic", MIN_IO_CHANNEL_SIZE, actualBytes, \
- __FILE__, __LINE__, logCtx))
-#define ULTRA_VSWITCH_CHANNEL_OK_CLIENT(pChannel, logCtx) \
- (ULTRA_check_channel_client(pChannel, UltraVswitchChannelProtocolGuid, \
- "vswitch", MIN_IO_CHANNEL_SIZE, \
- ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID, \
- ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE, \
- __FILE__, __LINE__, logCtx))
-#define ULTRA_VSWITCH_CHANNEL_OK_SERVER(actualBytes, logCtx) \
- (ULTRA_check_channel_server(UltraVswitchChannelProtocolGuid, \
- "vswitch", MIN_IO_CHANNEL_SIZE, \
- actualBytes, \
- __FILE__, __LINE__, logCtx))
+#define SPAR_VHBA_CHANNEL_OK_CLIENT(pChannel, logCtx) \
+ (spar_check_channel_client(pChannel, spar_vhba_channel_protocol_uuid, \
+ "vhba", MIN_IO_CHANNEL_SIZE, \
+ ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \
+ ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE))
+#define SPAR_VNIC_CHANNEL_OK_CLIENT(pChannel, logCtx) \
+ (spar_check_channel_client(pChannel, spar_vnic_channel_protocol_uuid, \
+ "vnic", MIN_IO_CHANNEL_SIZE, \
+ ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \
+ ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE))
+#define SPAR_VSWITCH_CHANNEL_OK_CLIENT(pChannel, logCtx) \
+ (spar_check_channel_client(pChannel, UltraVswitchChannelProtocolGuid, \
+ "vswitch", MIN_IO_CHANNEL_SIZE, \
+ ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID, \
+ ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE))
+
/*
* Everything necessary to handle SCSI & NIC traffic between Guest Partition and
* IO Partition is defined below. */
* increment this. */
#define ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID 1
-#define ULTRA_VBUS_CHANNEL_OK_CLIENT(pChannel, logCtx) \
- (ULTRA_check_channel_client(pChannel, \
- UltraVbusChannelProtocolGuid, \
- "vbus", \
- sizeof(struct ultra_vbus_channel_protocol),\
+#define SPAR_VBUS_CHANNEL_OK_CLIENT(pChannel, logCtx) \
+ (spar_check_channel_client(pChannel, \
+ UltraVbusChannelProtocolGuid, \
+ "vbus", \
+ sizeof(struct ultra_vbus_channel_protocol),\
ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID, \
- ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE, \
- __FILE__, __LINE__, logCtx))
-
-#define ULTRA_VBUS_CHANNEL_OK_SERVER(actualBytes, logCtx) \
- (ULTRA_check_channel_server(UltraVbusChannelProtocolGuid, \
- "vbus", \
- sizeof(struct ultra_vbus_channel_protocol),\
- actualBytes, \
- __FILE__, __LINE__, logCtx))
-
+ ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE)) \
#pragma pack(push, 1) /* both GCC and VC now allow this pragma */
typedef struct _ULTRA_VBUS_HEADERINFO {
rc = NULL;
goto Away;
}
- if (!ULTRA_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) {
+ if (!SPAR_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) {
ERRDRV("%s channel cannot be used", __func__);
uislib_iounmap(pChan);
rc = NULL;
__iomem *) (dev->
chanptr))->
chtype);
- if (!ULTRA_VHBA_CHANNEL_OK_CLIENT
+ if (!SPAR_VHBA_CHANNEL_OK_CLIENT
(dev->chanptr, NULL)) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed:[CLIENT]VHBA dev %d chan invalid.",
devNo);
__iomem *) (dev->
chanptr))->
chtype);
- if (!ULTRA_VNIC_CHANNEL_OK_CLIENT
+ if (!SPAR_VNIC_CHANNEL_OK_CLIENT
(dev->chanptr, NULL)) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed: VNIC[CLIENT] dev %d chan invalid.",
devNo);
spin_lock_irqsave(lock, flags);
if (!spar_channel_client_acquire_os(queueinfo->chan, channelId))
goto unlock;
- if (visor_signal_insert(queueinfo->chan, whichqueue, pSignal)) {
+ if (spar_signal_insert(queueinfo->chan, whichqueue, pSignal)) {
queueinfo->packets_sent++;
rc = 1;
}
(addr,
sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL),
UltraControlvmChannelProtocolGuid);
- if (ULTRA_CONTROLVM_CHANNEL_OK_CLIENT
- (visorchannel_get_header(ControlVm_channel),
- NULL)) {
+ if (SPAR_CONTROLVM_CHANNEL_OK_CLIENT(
+ visorchannel_get_header(ControlVm_channel))) {
LOGINF("Channel %s (ControlVm) discovered",
visorchannel_id(ControlVm_channel, s));
initialize_controlvm_payload();