Deleted Added
full compact
vmbus.c (307291) vmbus.c (307301)
1/*-
2 * Copyright (c) 2009-2012,2016 Microsoft Corp.
3 * Copyright (c) 2012 NetApp Inc.
4 * Copyright (c) 2012 Citrix Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 16 unchanged lines hidden (view full) ---

25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/*
30 * VM Bus Driver Implementation
31 */
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009-2012,2016 Microsoft Corp.
3 * Copyright (c) 2012 NetApp Inc.
4 * Copyright (c) 2012 Citrix Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 16 unchanged lines hidden (view full) ---

25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/*
30 * VM Bus Driver Implementation
31 */
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/vmbus/vmbus.c 307291 2016-10-14 07:40:04Z sephe $");
33__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/vmbus/vmbus.c 307301 2016-10-14 07:47:35Z sephe $");
34
35#include <sys/param.h>
36#include <sys/bus.h>
37#include <sys/kernel.h>
38#include <sys/lock.h>
39#include <sys/malloc.h>
40#include <sys/module.h>
41#include <sys/proc.h>

--- 158 unchanged lines hidden (view full) ---

200 mhc->mhc_free = NULL;
201 }
202
203 mtx_unlock(&mhc->mhc_free_lock);
204
205 return mh;
206}
207
34
35#include <sys/param.h>
36#include <sys/bus.h>
37#include <sys/kernel.h>
38#include <sys/lock.h>
39#include <sys/malloc.h>
40#include <sys/module.h>
41#include <sys/proc.h>

--- 158 unchanged lines hidden (view full) ---

200 mhc->mhc_free = NULL;
201 }
202
203 mtx_unlock(&mhc->mhc_free_lock);
204
205 return mh;
206}
207
208struct vmbus_msghc *
209vmbus_msghc_get(struct vmbus_softc *sc, size_t dsize)
208void
209vmbus_msghc_reset(struct vmbus_msghc *mh, size_t dsize)
210{
211 struct hypercall_postmsg_in *inprm;
210{
211 struct hypercall_postmsg_in *inprm;
212 struct vmbus_msghc *mh;
213
214 if (dsize > HYPERCALL_POSTMSGIN_DSIZE_MAX)
212
213 if (dsize > HYPERCALL_POSTMSGIN_DSIZE_MAX)
215 return NULL;
214 panic("invalid data size %zu", dsize);
216
215
217 mh = vmbus_msghc_get1(sc->vmbus_msg_hc, VMBUS_MSGHC_CTXF_DESTROY);
218 if (mh == NULL)
219 return NULL;
220
221 inprm = mh->mh_inprm;
222 memset(inprm, 0, HYPERCALL_POSTMSGIN_SIZE);
223 inprm->hc_connid = VMBUS_CONNID_MESSAGE;
224 inprm->hc_msgtype = HYPERV_MSGTYPE_CHANNEL;
225 inprm->hc_dsize = dsize;
216 inprm = mh->mh_inprm;
217 memset(inprm, 0, HYPERCALL_POSTMSGIN_SIZE);
218 inprm->hc_connid = VMBUS_CONNID_MESSAGE;
219 inprm->hc_msgtype = HYPERV_MSGTYPE_CHANNEL;
220 inprm->hc_dsize = dsize;
221}
226
222
223struct vmbus_msghc *
224vmbus_msghc_get(struct vmbus_softc *sc, size_t dsize)
225{
226 struct vmbus_msghc *mh;
227
228 if (dsize > HYPERCALL_POSTMSGIN_DSIZE_MAX)
229 panic("invalid data size %zu", dsize);
230
231 mh = vmbus_msghc_get1(sc->vmbus_msg_hc, VMBUS_MSGHC_CTXF_DESTROY);
232 if (mh == NULL)
233 return NULL;
234
235 vmbus_msghc_reset(mh, dsize);
227 return mh;
228}
229
230void
231vmbus_msghc_put(struct vmbus_softc *sc, struct vmbus_msghc *mh)
232{
233 struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc;
234

--- 1071 unchanged lines hidden ---
236 return mh;
237}
238
239void
240vmbus_msghc_put(struct vmbus_softc *sc, struct vmbus_msghc *mh)
241{
242 struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc;
243

--- 1071 unchanged lines hidden ---