svn commit: r264177 - in head/sys/dev/hyperv: netvsc storvsc

Warner Losh imp at FreeBSD.org
Sat Apr 5 22:42:02 UTC 2014


Author: imp
Date: Sat Apr  5 22:42:00 2014
New Revision: 264177
URL: http://svnweb.freebsd.org/changeset/base/264177

Log:
  Make some unwise casts. On i386 these casts wind up being safe. Rather
  than disturb the API, go with these casts to shut gcc up.

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c	Sat Apr  5 22:28:46 2014	(r264176)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c	Sat Apr  5 22:42:00 2014	(r264177)
@@ -182,7 +182,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
 	/* Send the gpadl notification request */
 
 	ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)init_pkt,
+	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
 	    HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 	    HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 	if (ret != 0) {
@@ -280,7 +280,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru
 	/* Send the gpadl notification request */
 
 	ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)init_pkt,
+	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
 	    HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 	    HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 	if (ret != 0) {
@@ -334,7 +334,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_
 
 		ret = hv_vmbus_channel_send_packet(net_dev->dev->channel,
 		    revoke_pkt, sizeof(nvsp_msg),
-		    (uint64_t)revoke_pkt,
+		    (uint64_t)(uintptr_t)revoke_pkt,
 		    HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
 
 		/*
@@ -402,7 +402,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne
 
 		ret = hv_vmbus_channel_send_packet(net_dev->dev->channel,
 		    revoke_pkt, sizeof(nvsp_msg),
-		    (uint64_t)revoke_pkt,
+		    (uint64_t)(uintptr_t)revoke_pkt,
 		    HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
 		/*
 		 * If we failed here, we might as well return and have a leak 
@@ -464,7 +464,7 @@ hv_nv_negotiate_nvsp_protocol(struct hv_
 
 	/* Send the init request */
 	ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)init_pkt,
+	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
 	    HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 	    HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 	if (ret != 0)
@@ -508,7 +508,7 @@ hv_nv_send_ndis_config(struct hv_device 
 
 	/* Send the configuration packet */
 	ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)init_pkt,
+	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
 	    HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
 	if (ret != 0)
 		return (-EINVAL);
@@ -580,7 +580,7 @@ hv_nv_connect_to_vsp(struct hv_device *d
 	/* Send the init request */
 
 	ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)init_pkt,
+	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
 	    HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
 	if (ret != 0) {
 		goto cleanup;
@@ -830,10 +830,10 @@ hv_nv_on_send(struct hv_device *device, 
 	if (pkt->page_buf_count) {
 		ret = hv_vmbus_channel_send_packet_pagebuffer(device->channel,
 		    pkt->page_buffers, pkt->page_buf_count,
-		    &send_msg, sizeof(nvsp_msg), (uint64_t)pkt);
+		    &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt);
 	} else {
 		ret = hv_vmbus_channel_send_packet(device->channel,
-		    &send_msg, sizeof(nvsp_msg), (uint64_t)pkt,
+		    &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt,
 		    HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 		    HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 	}

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Sat Apr  5 22:28:46 2014	(r264176)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Sat Apr  5 22:42:00 2014	(r264177)
@@ -344,7 +344,7 @@ netvsc_xmit_completion(void *context)
 	struct mbuf *mb;
 	uint8_t *buf;
 
-	mb = (struct mbuf *)packet->compl.send.send_completion_tid;
+	mb = (struct mbuf *)(uintptr_t)packet->compl.send.send_completion_tid;
 	buf = ((uint8_t *)packet) - HV_NV_PACKET_OFFSET_IN_BUF;
 
 	free(buf, M_DEVBUF);
@@ -494,7 +494,7 @@ retry_send:
 		/* Set the completion routine */
 		packet->compl.send.on_send_completion = netvsc_xmit_completion;
 		packet->compl.send.send_completion_context = packet;
-		packet->compl.send.send_completion_tid = (uint64_t)m_head;
+		packet->compl.send.send_completion_tid = (uint64_t)(uintptr_t)m_head;
 
 		/* Removed critical_enter(), does not appear necessary */
 		ret = hv_rf_on_send(device_ctx, packet);
@@ -682,7 +682,7 @@ netvsc_recv(struct hv_device *device_ctx
 	 */
 	for (i=0; i < packet->page_buf_count; i++) {
 		/* Shift virtual page number to form virtual page address */
-		uint8_t *vaddr = (uint8_t *)
+		uint8_t *vaddr = (uint8_t *)(uintptr_t)
 		    (packet->page_buffers[i].pfn << PAGE_SHIFT);
 
 		hv_m_append(m_new, packet->page_buffers[i].length,

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c	Sat Apr  5 22:28:46 2014	(r264176)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c	Sat Apr  5 22:42:00 2014	(r264177)
@@ -26,6 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #include <sys/param.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
@@ -334,7 +337,7 @@ hv_rf_on_receive(struct hv_device *devic
 		return (EINVAL);
 
 	/* Shift virtual page number to form virtual page address */
-	rndis_hdr = (rndis_msg *)(pkt->page_buffers[0].pfn << PAGE_SHIFT);
+	rndis_hdr = (rndis_msg *)(uintptr_t)(pkt->page_buffers[0].pfn << PAGE_SHIFT);
 
 	rndis_hdr = (void *)((unsigned long)rndis_hdr
 			+ pkt->page_buffers[0].offset);

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Sat Apr  5 22:28:46 2014	(r264176)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Sat Apr  5 22:42:00 2014	(r264177)
@@ -296,7 +296,7 @@ hv_storvsc_channel_init(struct hv_device
 			dev->channel,
 			vstor_packet,
 			sizeof(struct vstor_packet),
-			(uint64_t)request,
+			(uint64_t)(uintptr_t)request,
 			HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 			HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 
@@ -330,7 +330,7 @@ hv_storvsc_channel_init(struct hv_device
 			dev->channel,
 			vstor_packet,
 			sizeof(struct vstor_packet),
-			(uint64_t)request,
+			(uint64_t)(uintptr_t)request,
 			HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 			HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 
@@ -361,7 +361,7 @@ hv_storvsc_channel_init(struct hv_device
 				dev->channel,
 				vstor_packet,
 				sizeof(struct vstor_packet),
-				(uint64_t)request,
+				(uint64_t)(uintptr_t)request,
 				HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 				HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 
@@ -389,7 +389,7 @@ hv_storvsc_channel_init(struct hv_device
 			dev->channel,
 			vstor_packet,
 			sizeof(struct vstor_packet),
-			(uint64_t)request,
+			(uint64_t)(uintptr_t)request,
 			HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 			HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 
@@ -482,7 +482,7 @@ hv_storvsc_host_reset(struct hv_device *
 	ret = hv_vmbus_channel_send_packet(dev->channel,
 			vstor_packet,
 			sizeof(struct vstor_packet),
-			(uint64_t)&sc->hs_reset_req,
+			(uint64_t)(uintptr_t)&sc->hs_reset_req,
 			HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 			HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 
@@ -547,14 +547,14 @@ hv_storvsc_io_request(struct hv_device *
 				&request->data_buf,
 				vstor_packet, 
 				sizeof(struct vstor_packet), 
-				(uint64_t)request);
+				(uint64_t)(uintptr_t)request);
 
 	} else {
 		ret = hv_vmbus_channel_send_packet(
 			device->channel,
 			vstor_packet,
 			sizeof(struct vstor_packet),
-			(uint64_t)request,
+			(uint64_t)(uintptr_t)request,
 			HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
 			HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 	}
@@ -634,7 +634,7 @@ hv_storvsc_on_channel_callback(void *con
 			&request_id);
 
 	while ((ret == 0) && (bytes_recvd > 0)) {
-		request = (struct hv_storvsc_request *)request_id;
+		request = (struct hv_storvsc_request *)(uintptr_t)request_id;
 		KASSERT(request, ("request"));
 
 		if ((request == &sc->hs_init_req) ||


More information about the svn-src-head mailing list