Fix build of hyperv with base gcc on i386
Summary: Base gcc fails to compile `sys/dev/hyperv/pcib/vmbus_pcib.c` for i386, with the following -Werror warnings: cc1: warnings being treated as errors /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'new_pcichild_device': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:567: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'vmbus_pcib_on_channel_callback': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:940: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_pci_protocol_negotiation': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1012: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_pci_enter_d0': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1073: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_send_resources_allocated': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1125: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'vmbus_pcib_map_msi': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1730: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] This is because on i386, several casts from `uint64_t` to a pointer reduce the value from 64 bit to 32 bit. For gcc, this can be fixed by an intermediate cast to uintptr_t. Note that I am assuming the incoming values will always fit into 32 bit! Differential Revision: https://reviews.freebsd.org/D15753 MFC after: 3 days
This commit is contained in:
parent
37ac37f90c
commit
aaf1312351
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=337322
@ -564,7 +564,7 @@ new_pcichild_device(struct hv_pcibus *hbus, struct pci_func_desc *desc)
|
||||
|
||||
ret = vmbus_chan_send(hbus->sc->chan,
|
||||
VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
|
||||
res_req, sizeof(*res_req), (uint64_t)&ctxt.pkt);
|
||||
res_req, sizeof(*res_req), (uint64_t)(uintptr_t)&ctxt.pkt);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
@ -937,7 +937,8 @@ vmbus_pcib_on_channel_callback(struct vmbus_channel *chan, void *arg)
|
||||
|
||||
switch (pkt->cph_type) {
|
||||
case VMBUS_CHANPKT_TYPE_COMP:
|
||||
comp_packet = (struct pci_packet *)pkt->cph_xactid;
|
||||
comp_packet =
|
||||
(struct pci_packet *)(uintptr_t)pkt->cph_xactid;
|
||||
response = (struct pci_response *)pkt;
|
||||
comp_packet->completion_func(comp_packet->compl_ctxt,
|
||||
response, bytes_rxed);
|
||||
@ -1009,7 +1010,7 @@ hv_pci_protocol_negotiation(struct hv_pcibus *hbus)
|
||||
|
||||
ret = vmbus_chan_send(hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND,
|
||||
VMBUS_CHANPKT_FLAG_RC, version_req, sizeof(*version_req),
|
||||
(uint64_t)&ctxt.pkt);
|
||||
(uint64_t)(uintptr_t)&ctxt.pkt);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
@ -1070,7 +1071,7 @@ hv_pci_enter_d0(struct hv_pcibus *hbus)
|
||||
|
||||
ret = vmbus_chan_send(hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND,
|
||||
VMBUS_CHANPKT_FLAG_RC, d0_entry, sizeof(*d0_entry),
|
||||
(uint64_t)&ctxt.pkt);
|
||||
(uint64_t)(uintptr_t)&ctxt.pkt);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
@ -1122,7 +1123,8 @@ hv_send_resources_allocated(struct hv_pcibus *hbus)
|
||||
|
||||
ret = vmbus_chan_send(hbus->sc->chan,
|
||||
VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
|
||||
&pkt->message, sizeof(*res_assigned), (uint64_t)pkt);
|
||||
&pkt->message, sizeof(*res_assigned),
|
||||
(uint64_t)(uintptr_t)pkt);
|
||||
if (ret) {
|
||||
free_completion(&comp_pkt.host_event);
|
||||
break;
|
||||
@ -1727,7 +1729,7 @@ vmbus_pcib_map_msi(device_t pcib, device_t child, int irq,
|
||||
|
||||
ret = vmbus_chan_send(sc->chan, VMBUS_CHANPKT_TYPE_INBAND,
|
||||
VMBUS_CHANPKT_FLAG_RC, int_pkt, sizeof(*int_pkt),
|
||||
(uint64_t)&ctxt.pkt);
|
||||
(uint64_t)(uintptr_t)&ctxt.pkt);
|
||||
if (ret) {
|
||||
free_completion(&comp.comp_pkt.host_event);
|
||||
return (ret);
|
||||
|
Loading…
Reference in New Issue
Block a user