diff options
author | dim <dim@FreeBSD.org> | 2013-10-10 16:25:53 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-10-10 16:25:53 +0000 |
commit | ee09e09e18dadec88f8003162abd4820c128df3f (patch) | |
tree | b83245d0c490fc27fc2c4a3adbf7b37352827c9e /sys/dev/hyperv | |
parent | 83e71fe4f722622edac7f1b6b79ea5e801a75ea8 (diff) | |
download | FreeBSD-src-ee09e09e18dadec88f8003162abd4820c128df3f.zip FreeBSD-src-ee09e09e18dadec88f8003162abd4820c128df3f.tar.gz |
In sys/dev/hyperv, fix a number of gcc warnings about usage of anonymous
union members in strict C99, by giving them names. While here, add some
FreeBSD keywords where they were missing.
Approved by: re (gjb)
Reviewed by: grehan
Diffstat (limited to 'sys/dev/hyperv')
-rw-r--r-- | sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 40 | ||||
-rw-r--r-- | sys/dev/hyperv/storvsc/hv_vstorage.h | 6 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_channel.c | 5 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_hv.c | 34 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c | 4 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_vmbus_priv.h | 20 |
6 files changed, 60 insertions, 49 deletions
diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c index c89f42e..f4418b9 100644 --- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -32,6 +32,8 @@ * converted into VSCSI protocol messages which are delivered to the parent * partition StorVSP driver over the Hyper-V VMBUS. */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/proc.h> @@ -322,10 +324,10 @@ hv_storvsc_channel_init(struct hv_device *dev) vstor_packet->operation = VSTOR_OPERATION_QUERYPROTOCOLVERSION; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - vstor_packet->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT; + vstor_packet->u.version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT; /* revision is only significant for Windows guests */ - vstor_packet->version.revision = 0; + vstor_packet->u.version.revision = 0; ret = hv_vmbus_channel_send_packet( dev->channel, @@ -532,11 +534,11 @@ hv_storvsc_io_request(struct hv_device *device, vstor_packet->flags |= REQUEST_COMPLETION_FLAG; - vstor_packet->vm_srb.length = sizeof(struct vmscsi_req); + vstor_packet->u.vm_srb.length = sizeof(struct vmscsi_req); - vstor_packet->vm_srb.sense_info_len = SENSE_BUFFER_SIZE; + vstor_packet->u.vm_srb.sense_info_len = SENSE_BUFFER_SIZE; - vstor_packet->vm_srb.transfer_len = request->data_buf.length; + vstor_packet->u.vm_srb.transfer_len = request->data_buf.length; vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; @@ -583,7 +585,7 @@ hv_storvsc_on_iocompletion(struct storvsc_softc *sc, { struct vmscsi_req *vm_srb; - vm_srb = &vstor_packet->vm_srb; + vm_srb = &vstor_packet->u.vm_srb; request->sense_info_len = 0; if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && @@ -594,7 +596,7 @@ hv_storvsc_on_iocompletion(struct storvsc_softc *sc, ("vm_srb->sense_info_len <= " "request->sense_info_len")); - memcpy(request->sense_data, vm_srb->sense_data, + memcpy(request->sense_data, vm_srb->u.sense_data, vm_srb->sense_info_len); request->sense_info_len = vm_srb->sense_info_len; @@ -1298,35 +1300,35 @@ create_storvsc_request(union ccb *ccb, struct hv_storvsc_request *reqp) uint32_t pfn; /* refer to struct vmscsi_req for meanings of these two fields */ - reqp->vstor_packet.vm_srb.port = + reqp->vstor_packet.u.vm_srb.port = cam_sim_unit(xpt_path_sim(ccb->ccb_h.path)); - reqp->vstor_packet.vm_srb.path_id = + reqp->vstor_packet.u.vm_srb.path_id = cam_sim_bus(xpt_path_sim(ccb->ccb_h.path)); - reqp->vstor_packet.vm_srb.target_id = ccb->ccb_h.target_id; - reqp->vstor_packet.vm_srb.lun = ccb->ccb_h.target_lun; + reqp->vstor_packet.u.vm_srb.target_id = ccb->ccb_h.target_id; + reqp->vstor_packet.u.vm_srb.lun = ccb->ccb_h.target_lun; - reqp->vstor_packet.vm_srb.cdb_len = csio->cdb_len; + reqp->vstor_packet.u.vm_srb.cdb_len = csio->cdb_len; if(ccb->ccb_h.flags & CAM_CDB_POINTER) { - memcpy(&reqp->vstor_packet.vm_srb.cdb, csio->cdb_io.cdb_ptr, + memcpy(&reqp->vstor_packet.u.vm_srb.u.cdb, csio->cdb_io.cdb_ptr, csio->cdb_len); } else { - memcpy(&reqp->vstor_packet.vm_srb.cdb, csio->cdb_io.cdb_bytes, + memcpy(&reqp->vstor_packet.u.vm_srb.u.cdb, csio->cdb_io.cdb_bytes, csio->cdb_len); } switch (ccb->ccb_h.flags & CAM_DIR_MASK) { case CAM_DIR_OUT: - reqp->vstor_packet.vm_srb.data_in = WRITE_TYPE; + reqp->vstor_packet.u.vm_srb.data_in = WRITE_TYPE; break; case CAM_DIR_IN: - reqp->vstor_packet.vm_srb.data_in = READ_TYPE; + reqp->vstor_packet.u.vm_srb.data_in = READ_TYPE; break; case CAM_DIR_NONE: - reqp->vstor_packet.vm_srb.data_in = UNKNOWN_TYPE; + reqp->vstor_packet.u.vm_srb.data_in = UNKNOWN_TYPE; break; default: - reqp->vstor_packet.vm_srb.data_in = UNKNOWN_TYPE; + reqp->vstor_packet.u.vm_srb.data_in = UNKNOWN_TYPE; break; } @@ -1375,7 +1377,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp) union ccb *ccb = reqp->ccb; struct ccb_scsiio *csio = &ccb->csio; struct storvsc_softc *sc = reqp->softc; - struct vmscsi_req *vm_srb = &reqp->vstor_packet.vm_srb; + struct vmscsi_req *vm_srb = &reqp->vstor_packet.u.vm_srb; if (reqp->retries > 0) { mtx_lock(&sc->hs_lock); diff --git a/sys/dev/hyperv/storvsc/hv_vstorage.h b/sys/dev/hyperv/storvsc/hv_vstorage.h index d01d084..2632676 100644 --- a/sys/dev/hyperv/storvsc/hv_vstorage.h +++ b/sys/dev/hyperv/storvsc/hv_vstorage.h @@ -24,6 +24,8 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ */ #ifndef __HV_VSTORAGE_H__ @@ -107,7 +109,7 @@ struct vmscsi_req { uint8_t sense_data[SENSE_BUFFER_SIZE]; uint8_t reserved_array[MAX_DATA_BUFFER_LENGTH_WITH_PADDING]; - }; + } u; } __packed; @@ -191,7 +193,7 @@ struct vstor_packet { * Used during version negotiations. */ struct vmstor_proto_ver version; - }; + } u; } __packed; diff --git a/sys/dev/hyperv/vmbus/hv_channel.c b/sys/dev/hyperv/vmbus/hv_channel.c index 17dfd76..c467c22 100644 --- a/sys/dev/hyperv/vmbus/hv_channel.c +++ b/sys/dev/hyperv/vmbus/hv_channel.c @@ -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/malloc.h> #include <sys/systm.h> @@ -70,7 +73,7 @@ vmbus_channel_set_event(hv_vmbus_channel *channel) synch_set_bit(channel->monitor_bit, (uint32_t *)&monitor_page-> - trigger_group[channel->monitor_group].pending); + trigger_group[channel->monitor_group].u.pending); } else { hv_vmbus_set_event(channel->offer_msg.child_rel_id); } diff --git a/sys/dev/hyperv/vmbus/hv_hv.c b/sys/dev/hyperv/vmbus/hv_hv.c index c316732..77d3b0b 100644 --- a/sys/dev/hyperv/vmbus/hv_hv.c +++ b/sys/dev/hyperv/vmbus/hv_hv.c @@ -240,8 +240,8 @@ hv_vmbus_init(void) if (virt_addr == NULL) goto cleanup; - hypercall_msr.enable = 1; - hypercall_msr.guest_physical_address = + hypercall_msr.u.enable = 1; + hypercall_msr.u.guest_physical_address = (hv_get_phys_addr(virt_addr) >> PAGE_SHIFT); wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t); @@ -251,7 +251,7 @@ hv_vmbus_init(void) hypercall_msr.as_uint64_t = 0; hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); - if (!hypercall_msr.enable) + if (!hypercall_msr.u.enable) goto cleanup; hv_vmbus_g_context.hypercall_page = virt_addr; @@ -284,7 +284,7 @@ hv_vmbus_init(void) cleanup: if (virt_addr != NULL) { - if (hypercall_msr.enable) { + if (hypercall_msr.u.enable) { hypercall_msr.as_uint64_t = 0; wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t); @@ -426,8 +426,8 @@ hv_vmbus_synic_init(void *arg) */ simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.simp_enabled = 1; - simp.base_simp_gpa = ((hv_get_phys_addr( + simp.u.simp_enabled = 1; + simp.u.base_simp_gpa = ((hv_get_phys_addr( hv_vmbus_g_context.syn_ic_msg_page[cpu])) >> PAGE_SHIFT); wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); @@ -436,23 +436,23 @@ hv_vmbus_synic_init(void *arg) * Setup the Synic's event page */ siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.siefp_enabled = 1; - siefp.base_siefp_gpa = ((hv_get_phys_addr( + siefp.u.siefp_enabled = 1; + siefp.u.base_siefp_gpa = ((hv_get_phys_addr( hv_vmbus_g_context.syn_ic_event_page[cpu])) >> PAGE_SHIFT); wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ - shared_sint.vector = setup_args->vector; - shared_sint.masked = FALSE; - shared_sint.auto_eoi = FALSE; + shared_sint.u.vector = setup_args->vector; + shared_sint.u.masked = FALSE; + shared_sint.u.auto_eoi = FALSE; wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, shared_sint.as_uint64_t); /* Enable the global synic bit */ sctrl.as_uint64_t = rdmsr(HV_X64_MSR_SCONTROL); - sctrl.enable = 1; + sctrl.u.enable = 1; wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); @@ -480,7 +480,7 @@ void hv_vmbus_synic_cleanup(void *arg) shared_sint.as_uint64_t = rdmsr( HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); - shared_sint.masked = 1; + shared_sint.u.masked = 1; /* * Disable the interrupt @@ -490,14 +490,14 @@ void hv_vmbus_synic_cleanup(void *arg) shared_sint.as_uint64_t); simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.simp_enabled = 0; - simp.base_simp_gpa = 0; + simp.u.simp_enabled = 0; + simp.u.base_simp_gpa = 0; wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.siefp_enabled = 0; - siefp.base_siefp_gpa = 0; + siefp.u.siefp_enabled = 0; + siefp.u.base_siefp_gpa = 0; wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); } diff --git a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c index 08c6112..fb9e147 100644 --- a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c +++ b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c @@ -29,6 +29,8 @@ /* * VM Bus Driver Implementation */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/bus.h> @@ -113,7 +115,7 @@ vmbus_msg_swintr(void *dummy) */ wmb(); - if (msg->header.message_flags.message_pending) { + if (msg->header.message_flags.u.message_pending) { /* * This will cause message queue rescan to possibly * deliver another msg from the hypervisor diff --git a/sys/dev/hyperv/vmbus/hv_vmbus_priv.h b/sys/dev/hyperv/vmbus/hv_vmbus_priv.h index 4607d50..6bc875d 100644 --- a/sys/dev/hyperv/vmbus/hv_vmbus_priv.h +++ b/sys/dev/hyperv/vmbus/hv_vmbus_priv.h @@ -24,6 +24,8 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ */ #ifndef __HYPERV_PRIV_H__ @@ -285,7 +287,7 @@ typedef union { struct { uint8_t message_pending:1; uint8_t reserved:7; - }; + } u; } hv_vmbus_msg_flags; typedef uint64_t hv_vmbus_partition_id; @@ -393,7 +395,7 @@ typedef union { */ uint64_t os_id : 8; uint64_t vendor_id : 16; - }; + } u; } hv_vmbus_x64_msr_guest_os_id_contents; /* @@ -407,7 +409,7 @@ typedef union { uint64_t enable :1; uint64_t reserved :11; uint64_t guest_physical_address :52; - }; + } u; } hv_vmbus_x64_msr_hypercall_contents; typedef union { @@ -415,7 +417,7 @@ typedef union { struct { uint32_t group_enable :4; uint32_t rsvd_z :28; - }; + } u; } hv_vmbus_monitor_trigger_state; typedef union { @@ -423,7 +425,7 @@ typedef union { struct { uint32_t pending; uint32_t armed; - }; + } u; } hv_vmbus_monitor_trigger_group; typedef struct { @@ -499,7 +501,7 @@ typedef union { uint64_t simp_enabled : 1; uint64_t preserved : 11; uint64_t base_simp_gpa : 52; - }; + } u; } hv_vmbus_synic_simp; /* @@ -511,7 +513,7 @@ typedef union { uint64_t siefp_enabled : 1; uint64_t preserved : 11; uint64_t base_siefp_gpa : 52; - }; + } u; } hv_vmbus_synic_siefp; /* @@ -525,7 +527,7 @@ typedef union { uint64_t masked : 1; uint64_t auto_eoi : 1; uint64_t reserved2 : 46; - }; + } u; } hv_vmbus_synic_sint; /* @@ -536,7 +538,7 @@ typedef union _hv_vmbus_synic_scontrol { struct { uint64_t enable : 1; uint64_t reserved : 63; - }; + } u; } hv_vmbus_synic_scontrol; /* |