xref: /freebsd/usr.sbin/bhyve/amd64/post.c (revision 4d65a7c6951cea0333f1a0c1b32c38489cdfa6c5)
1*f927afc1SMark Johnston /*-
2*f927afc1SMark Johnston  * SPDX-License-Identifier: BSD-2-Clause
3*f927afc1SMark Johnston  *
4*f927afc1SMark Johnston  * Copyright (c) 2011 NetApp, Inc.
5*f927afc1SMark Johnston  * All rights reserved.
6*f927afc1SMark Johnston  *
7*f927afc1SMark Johnston  * Redistribution and use in source and binary forms, with or without
8*f927afc1SMark Johnston  * modification, are permitted provided that the following conditions
9*f927afc1SMark Johnston  * are met:
10*f927afc1SMark Johnston  * 1. Redistributions of source code must retain the above copyright
11*f927afc1SMark Johnston  *    notice, this list of conditions and the following disclaimer.
12*f927afc1SMark Johnston  * 2. Redistributions in binary form must reproduce the above copyright
13*f927afc1SMark Johnston  *    notice, this list of conditions and the following disclaimer in the
14*f927afc1SMark Johnston  *    documentation and/or other materials provided with the distribution.
15*f927afc1SMark Johnston  *
16*f927afc1SMark Johnston  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
17*f927afc1SMark Johnston  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*f927afc1SMark Johnston  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*f927afc1SMark Johnston  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
20*f927afc1SMark Johnston  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*f927afc1SMark Johnston  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*f927afc1SMark Johnston  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*f927afc1SMark Johnston  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*f927afc1SMark Johnston  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*f927afc1SMark Johnston  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*f927afc1SMark Johnston  * SUCH DAMAGE.
27*f927afc1SMark Johnston  */
28*f927afc1SMark Johnston 
29*f927afc1SMark Johnston #include <sys/types.h>
30*f927afc1SMark Johnston 
31*f927afc1SMark Johnston #include <assert.h>
32*f927afc1SMark Johnston 
33*f927afc1SMark Johnston #include "inout.h"
34*f927afc1SMark Johnston #include "pci_lpc.h"
35*f927afc1SMark Johnston 
36*f927afc1SMark Johnston static int
post_data_handler(struct vmctx * ctx __unused,int in,int port __unused,int bytes,uint32_t * eax,void * arg __unused)37*f927afc1SMark Johnston post_data_handler(struct vmctx *ctx __unused, int in,
38*f927afc1SMark Johnston     int port __unused, int bytes, uint32_t *eax, void *arg __unused)
39*f927afc1SMark Johnston {
40*f927afc1SMark Johnston 	assert(in == 1);
41*f927afc1SMark Johnston 
42*f927afc1SMark Johnston 	if (bytes != 1)
43*f927afc1SMark Johnston 		return (-1);
44*f927afc1SMark Johnston 
45*f927afc1SMark Johnston 	*eax = 0xff;		/* return some garbage */
46*f927afc1SMark Johnston 	return (0);
47*f927afc1SMark Johnston }
48*f927afc1SMark Johnston 
49*f927afc1SMark Johnston INOUT_PORT(post, 0x84, IOPORT_F_IN, post_data_handler);
50*f927afc1SMark Johnston SYSRES_IO(0x84, 1);
51