granttables.h revision 1.1
11.1Sbouyer/* $NetBSD: granttables.h,v 1.1 2006/03/06 20:30:40 bouyer Exp $ */
21.1Sbouyer/*
31.1Sbouyer * Copyright (c) 2006 Manuel Bouyer.
41.1Sbouyer *
51.1Sbouyer * Redistribution and use in source and binary forms, with or without
61.1Sbouyer * modification, are permitted provided that the following conditions
71.1Sbouyer * are met:
81.1Sbouyer * 1. Redistributions of source code must retain the above copyright
91.1Sbouyer *    notice, this list of conditions and the following disclaimer.
101.1Sbouyer * 2. Redistributions in binary form must reproduce the above copyright
111.1Sbouyer *    notice, this list of conditions and the following disclaimer in the
121.1Sbouyer *    documentation and/or other materials provided with the distribution.
131.1Sbouyer * 3. All advertising materials mentioning features or use of this software
141.1Sbouyer *    must display the following acknowledgement:
151.1Sbouyer *      This product includes software developed by Manuel Bouyer.
161.1Sbouyer * 4. The name of the author may not be used to endorse or promote products
171.1Sbouyer *    derived from this software without specific prior written permission.
181.1Sbouyer *
191.1Sbouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
201.1Sbouyer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
211.1Sbouyer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
221.1Sbouyer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
231.1Sbouyer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
241.1Sbouyer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
251.1Sbouyer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
261.1Sbouyer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
271.1Sbouyer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
281.1Sbouyer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
291.1Sbouyer *
301.1Sbouyer */
311.1Sbouyer
321.1Sbouyer/* Interface to the Xen Grant tables */
331.1Sbouyer#include <machine/xen3-public/grant_table.h>
341.1Sbouyer
351.1Sbouyer/* must be less or equal to what's configured in Xen */
361.1Sbouyer#define NR_GRANT_FRAMES 4
371.1Sbouyer
381.1Sbouyervoid xengnt_init(void);
391.1Sbouyer
401.1Sbouyer/*
411.1Sbouyer * grant access to a remote domain. Returns a handle on the allocated grant
421.1Sbouyer * entry in table in grant_ref_t *.
431.1Sbouyer */
441.1Sbouyerint xengnt_grant_access(domid_t, paddr_t, int, grant_ref_t *);
451.1Sbouyer
461.1Sbouyer/*
471.1Sbouyer * Revoke access. Caller is responsible to ensure that the grant entry is
481.1Sbouyer * not referenced any more.
491.1Sbouyer */
501.1Sbouyervoid xengnt_revoke_access(grant_ref_t);
511.1Sbouyer
521.1Sbouyer/* allow a page transfer from a remote domain */
531.1Sbouyerint xengnt_grant_transfer(domid_t, grant_ref_t *);
541.1Sbouyer
551.1Sbouyer/* end transfer, return the new page address or 0 */
561.1Sbouyerpaddr_t xengnt_revoke_transfer(grant_ref_t);
571.1Sbouyer
581.1Sbouyer/*
591.1Sbouyer * Query grant status (i.e. if remote has a valid mapping to this grant).
601.1Sbouyer * Returns GTF_reading | GTF_writing.
611.1Sbouyer */
621.1Sbouyerint xengnt_status(grant_ref_t);
63