1*5084Sjohnlev/* 2*5084Sjohnlev * CDDL HEADER START 3*5084Sjohnlev * 4*5084Sjohnlev * The contents of this file are subject to the terms of the 5*5084Sjohnlev * Common Development and Distribution License (the "License"). 6*5084Sjohnlev * You may not use this file except in compliance with the License. 7*5084Sjohnlev * 8*5084Sjohnlev * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5084Sjohnlev * or http://www.opensolaris.org/os/licensing. 10*5084Sjohnlev * See the License for the specific language governing permissions 11*5084Sjohnlev * and limitations under the License. 12*5084Sjohnlev * 13*5084Sjohnlev * When distributing Covered Code, include this CDDL HEADER in each 14*5084Sjohnlev * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5084Sjohnlev * If applicable, add the following below this CDDL HEADER, with the 16*5084Sjohnlev * fields enclosed by brackets "[]" replaced with your own identifying 17*5084Sjohnlev * information: Portions Copyright [yyyy] [name of copyright owner] 18*5084Sjohnlev * 19*5084Sjohnlev * CDDL HEADER END 20*5084Sjohnlev */ 21*5084Sjohnlev 22*5084Sjohnlev/* 23*5084Sjohnlev * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24*5084Sjohnlev * Use is subject to license terms. 25*5084Sjohnlev */ 26*5084Sjohnlev 27*5084Sjohnlev#pragma ident "%Z%%M% %I% %E% SMI" 28*5084Sjohnlev 29*5084Sjohnlev#include <sys/asm_linkage.h> 30*5084Sjohnlev#include <sys/asm_misc.h> 31*5084Sjohnlev 32*5084Sjohnlev#if defined(__lint) 33*5084Sjohnlev 34*5084Sjohnlev#include "dboot_asm.h" 35*5084Sjohnlev 36*5084Sjohnlev/* ARGSUSED */ 37*5084Sjohnlevuint32_t 38*5084Sjohnlevget_cpuid_edx(uint32_t *eax) 39*5084Sjohnlev{ return (0); } 40*5084Sjohnlev 41*5084Sjohnlev/* ARGSUSED */ 42*5084Sjohnlevvoid 43*5084Sjohnlevoutb(int port, uint8_t value) 44*5084Sjohnlev{} 45*5084Sjohnlev 46*5084Sjohnlev/* ARGSUSED */ 47*5084Sjohnlevuint8_t 48*5084Sjohnlevinb(int port) 49*5084Sjohnlev{ return (0); } 50*5084Sjohnlev 51*5084Sjohnlev#else /* __lint */ 52*5084Sjohnlev 53*5084Sjohnlev#if defined(__amd64) 54*5084Sjohnlev 55*5084Sjohnlev /* 56*5084Sjohnlev * do a cpuid instruction, returning the eax/edx values 57*5084Sjohnlev * 58*5084Sjohnlev * uint32_t get_cpuid_edx(uint32_t *eax) 59*5084Sjohnlev */ 60*5084Sjohnlev ENTRY_NP(get_cpuid_edx) 61*5084Sjohnlev pushq %rbx 62*5084Sjohnlev movl (%rdi), %eax 63*5084Sjohnlev cpuid 64*5084Sjohnlev movl %eax, (%rdi) 65*5084Sjohnlev movl %edx, %eax 66*5084Sjohnlev popq %rbx 67*5084Sjohnlev ret 68*5084Sjohnlev SET_SIZE(get_cpuid_edx) 69*5084Sjohnlev 70*5084Sjohnlev /* 71*5084Sjohnlev * void outb(int port, uint8_t value) 72*5084Sjohnlev */ 73*5084Sjohnlev ENTRY(outb) 74*5084Sjohnlev movw %di, %dx 75*5084Sjohnlev movb %sil, %al 76*5084Sjohnlev outb (%dx) 77*5084Sjohnlev ret 78*5084Sjohnlev SET_SIZE(outb) 79*5084Sjohnlev 80*5084Sjohnlev /* 81*5084Sjohnlev * uint8_t inb(int port) 82*5084Sjohnlev */ 83*5084Sjohnlev ENTRY(inb) 84*5084Sjohnlev xorl %eax, %eax 85*5084Sjohnlev movw %di, %dx 86*5084Sjohnlev inb (%dx) 87*5084Sjohnlev ret 88*5084Sjohnlev SET_SIZE(inb) 89*5084Sjohnlev 90*5084Sjohnlev#elif defined(__i386) 91*5084Sjohnlev 92*5084Sjohnlev .code32 93*5084Sjohnlev 94*5084Sjohnlev /* 95*5084Sjohnlev * do a cpuid instruction, returning the eax/edx values 96*5084Sjohnlev * 97*5084Sjohnlev * uint32_t get_cpuid_edx(uint32_t *eax) 98*5084Sjohnlev */ 99*5084Sjohnlev ENTRY_NP(get_cpuid_edx) 100*5084Sjohnlev movl 4(%esp), %ecx 101*5084Sjohnlev movl (%ecx), %eax 102*5084Sjohnlev pushl %ebx 103*5084Sjohnlev cpuid 104*5084Sjohnlev popl %ebx 105*5084Sjohnlev movl 4(%esp), %ecx 106*5084Sjohnlev movl %eax, (%ecx) 107*5084Sjohnlev movl %edx, %eax 108*5084Sjohnlev ret 109*5084Sjohnlev SET_SIZE(get_cpuid_edx) 110*5084Sjohnlev 111*5084Sjohnlev /* 112*5084Sjohnlev * void outb(int port, uint8_t value) 113*5084Sjohnlev */ 114*5084Sjohnlev ENTRY_NP(outb) 115*5084Sjohnlev movl 4(%esp), %edx 116*5084Sjohnlev movl 8(%esp), %eax 117*5084Sjohnlev outb (%dx) 118*5084Sjohnlev ret 119*5084Sjohnlev SET_SIZE(outb) 120*5084Sjohnlev 121*5084Sjohnlev /* 122*5084Sjohnlev * uint8_t inb(int port) 123*5084Sjohnlev */ 124*5084Sjohnlev ENTRY_NP(inb) 125*5084Sjohnlev movl 4(%esp), %edx 126*5084Sjohnlev inb (%dx) 127*5084Sjohnlev andl $0xff, %eax 128*5084Sjohnlev ret 129*5084Sjohnlev SET_SIZE(inb) 130*5084Sjohnlev 131*5084Sjohnlev#endif /* __i386 */ 132*5084Sjohnlev 133*5084Sjohnlev#endif /* __lint */ 134