1 /*
2  * Copyright 2014, General Dynamics C4 Systems
3  *
4  * SPDX-License-Identifier: GPL-2.0-only
5  */
6 
7 #pragma once
8 
9 #include <types.h>
10 #include <api/failures.h>
11 #include <object/structures.h>
12 
13 #define NUM_IO_PORTS BIT(16)
14 
15 /* given a pointer to an 8K IO port bitmap, set a range of bits to 0 or 1 based on the `set` parameter */
16 void setIOPortMask(void *ioport_bitmap, uint16_t low, uint16_t high, bool_t set);
17 
18 exception_t decodeX86PortInvocation(word_t invLabel, word_t length, cptr_t cptr, cte_t *slot, cap_t cap,
19                                     bool_t call, word_t *buffer);
20 exception_t decodeX86PortControlInvocation(word_t invLabel, word_t length, cptr_t cptr, cte_t *slot, cap_t cap,
21                                            word_t *buffer);
22 
23 /* used to clean up the final capability to an allocated I/O port range */
24 void freeIOPortRange(uint16_t first_port, uint16_t last_port);
25 
26