11.1Srin/* $NetBSD: eficpufunc.c,v 1.1 2023/07/24 01:56:59 rin Exp $ */ 21.1Srin 31.1Srin/*- 41.1Srin * Copyright (c) 2023 The NetBSD Foundation, Inc. 51.1Srin * All rights reserved. 61.1Srin * 71.1Srin * Redistribution and use in source and binary forms, with or without 81.1Srin * modification, are permitted provided that the following conditions 91.1Srin * are met: 101.1Srin * 1. Redistributions of source code must retain the above copyright 111.1Srin * notice, this list of conditions and the following disclaimer. 121.1Srin * 2. Redistributions in binary form must reproduce the above copyright 131.1Srin * notice, this list of conditions and the following disclaimer in the 141.1Srin * documentation and/or other materials provided with the distribution. 151.1Srin * 161.1Srin * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171.1Srin * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181.1Srin * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191.1Srin * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201.1Srin * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211.1Srin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221.1Srin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231.1Srin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241.1Srin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251.1Srin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261.1Srin * POSSIBILITY OF SUCH DAMAGE. 271.1Srin */ 281.1Srin 291.1Srin#include <sys/cdefs.h> 301.1Srin#include <sys/types.h> 311.1Srin 321.1Srin#include "eficpufunc.h" 331.1Srin 341.1Srinuint8_t 351.1Srininb(uint32_t addr) 361.1Srin{ 371.1Srin uint8_t c; 381.1Srin 391.1Srin __asm volatile ("inb %%dx, %%al" : "=a"(c) : "d"(addr)); 401.1Srin return c; 411.1Srin} 421.1Srin 431.1Srinvoid 441.1Srinoutb(uint32_t addr, uint8_t c) 451.1Srin{ 461.1Srin 471.1Srin __asm volatile ("outb %%al, %%dx" : : "a"(c), "d"(addr)); 481.1Srin} 49