📄 iomv.c
字号:
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2000 Silicon Graphics, Inc. * Copyright (C) 2000 by Jack Steiner (steiner@sgi.com) * Copyright (C) 2000 Kanoj Sarcar (kanoj@sgi.com) */#include <asm/io.h>#include <linux/pci.h>static inline void *sn1_io_addr(unsigned long port){ if (!IS_RUNNING_ON_SIMULATOR()) { return( (void *) (port | __IA64_UNCACHED_OFFSET)); } else { unsigned long io_base; unsigned long addr; /* * word align port, but need more than 10 bits * for accessing registers in bedrock local block * (so we don't do port&0xfff) */ if (port >= 0x1f0 && port <= 0x1f7 || port == 0x3f6 || port == 0x3f7) { io_base = __IA64_UNCACHED_OFFSET | 0x00000FFFFC000000; addr = io_base | ((port >> 2) << 12) | (port & 0xfff); } else { addr = __ia64_get_io_port_base() | ((port >> 2) << 2); } return(void *) addr; }}unsigned intsn1_inb (unsigned long port){ volatile unsigned char *addr = sn1_io_addr(port); unsigned char ret; ret = *addr; __ia64_mf_a(); return ret;}unsigned intsn1_inw (unsigned long port){ volatile unsigned short *addr = sn1_io_addr(port); unsigned short ret; ret = *addr; __ia64_mf_a(); return ret;}unsigned intsn1_inl (unsigned long port){ volatile unsigned int *addr = sn1_io_addr(port); unsigned int ret; ret = *addr; __ia64_mf_a(); return ret;}voidsn1_outb (unsigned char val, unsigned long port){ volatile unsigned char *addr = sn1_io_addr(port); *addr = val; __ia64_mf_a();}voidsn1_outw (unsigned short val, unsigned long port){ volatile unsigned short *addr = sn1_io_addr(port); *addr = val; __ia64_mf_a();}voidsn1_outl (unsigned int val, unsigned long port){ volatile unsigned int *addr = sn1_io_addr(port); *addr = val; __ia64_mf_a();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -