2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2000-2002 Silicon Graphics, Inc. All rights reserved.
11 #include <asm/sn/simulator.h>
12 #include <asm/delay.h>
13 #include <asm/sn/pda.h>
16 * sn_io_addr - convert an in/out port to an i/o address
17 * @port: port to convert
19 * Legacy in/out instructions are converted to ld/st instructions
20 * on IA64. This routine will convert a port number into a valid
21 * SN i/o address. Used by sn_in*() and sn_out*().
24 sn_io_addr(unsigned long port)
26 if (!IS_RUNNING_ON_SIMULATOR()) {
27 return( (void *) (port | __IA64_UNCACHED_OFFSET));
29 unsigned long io_base;
33 * word align port, but need more than 10 bits
34 * for accessing registers in bedrock local block
35 * (so we don't do port&0xfff)
37 if ((port >= 0x1f0 && port <= 0x1f7) ||
38 port == 0x3f6 || port == 0x3f7) {
39 io_base = __IA64_UNCACHED_OFFSET | 0x00000FFFFC000000;
40 addr = io_base | ((port >> 2) << 12) | (port & 0xfff);
42 addr = __ia64_get_io_port_base() | ((port >> 2) << 2);
49 * sn1_mmiob - I/O space memory barrier
51 * Acts as a memory mapped I/O barrier for platforms that queue writes to
52 * I/O space. This ensures that subsequent writes to I/O space arrive after
53 * all previous writes. For most ia64 platforms, this is a simple
54 * 'mf.a' instruction. For other platforms, mmiob() may have to read
55 * a chipset register to ensure ordering.
57 * On SN1, we wait for the PIO_WRITE_STATUS Bedrock register to clear.
62 (volatile unsigned long) (*pda.bedrock_rev_id);
63 while (!(volatile unsigned long) (*pda.pio_write_status_addr))