summaryrefslogtreecommitdiff
path: root/gpxe/src/arch/i386/include/gpxe
diff options
context:
space:
mode:
Diffstat (limited to 'gpxe/src/arch/i386/include/gpxe')
-rw-r--r--gpxe/src/arch/i386/include/gpxe/abft.h37
-rw-r--r--gpxe/src/arch/i386/include/gpxe/bios_nap.h18
-rw-r--r--gpxe/src/arch/i386/include/gpxe/bios_smbios.h18
-rw-r--r--gpxe/src/arch/i386/include/gpxe/bios_timer.h44
-rw-r--r--gpxe/src/arch/i386/include/gpxe/ibft.h302
-rw-r--r--gpxe/src/arch/i386/include/gpxe/memtop_umalloc.h18
-rw-r--r--gpxe/src/arch/i386/include/gpxe/rdtsc_timer.h39
-rw-r--r--gpxe/src/arch/i386/include/gpxe/sbft.h125
-rw-r--r--gpxe/src/arch/i386/include/gpxe/timer2.h14
-rw-r--r--gpxe/src/arch/i386/include/gpxe/x86_io.h153
10 files changed, 0 insertions, 768 deletions
diff --git a/gpxe/src/arch/i386/include/gpxe/abft.h b/gpxe/src/arch/i386/include/gpxe/abft.h
deleted file mode 100644
index 9065e61a..00000000
--- a/gpxe/src/arch/i386/include/gpxe/abft.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _GPXE_ABFT_H
-#define _GPXE_ABFT_H
-
-/** @file
- *
- * AoE boot firmware table
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <gpxe/acpi.h>
-#include <gpxe/if_ether.h>
-
-/** AoE boot firmware table signature */
-#define ABFT_SIG "aBFT"
-
-/**
- * AoE Boot Firmware Table (aBFT)
- */
-struct abft_table {
- /** ACPI header */
- struct acpi_description_header acpi;
- /** AoE shelf */
- uint16_t shelf;
- /** AoE slot */
- uint8_t slot;
- /** Reserved */
- uint8_t reserved_a;
- /** MAC address */
- uint8_t mac[ETH_ALEN];
-} __attribute__ (( packed ));
-
-extern void abft_fill_data ( struct aoe_session *aoe );
-
-#endif /* _GPXE_ABFT_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/bios_nap.h b/gpxe/src/arch/i386/include/gpxe/bios_nap.h
deleted file mode 100644
index c32429b9..00000000
--- a/gpxe/src/arch/i386/include/gpxe/bios_nap.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _GPXE_BIOS_NAP_H
-#define _GPXE_BIOS_NAP_H
-
-/** @file
- *
- * BIOS CPU sleeping
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef NAP_PCBIOS
-#define NAP_PREFIX_pcbios
-#else
-#define NAP_PREFIX_pcbios __pcbios_
-#endif
-
-#endif /* _GPXE_BIOS_NAP_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/bios_smbios.h b/gpxe/src/arch/i386/include/gpxe/bios_smbios.h
deleted file mode 100644
index 83726b11..00000000
--- a/gpxe/src/arch/i386/include/gpxe/bios_smbios.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _GPXE_BIOS_SMBIOS_H
-#define _GPXE_BIOS_SMBIOS_H
-
-/** @file
- *
- * Standard PC-BIOS SMBIOS interface
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef SMBIOS_PCBIOS
-#define SMBIOS_PREFIX_pcbios
-#else
-#define SMBIOS_PREFIX_pcbios __pcbios_
-#endif
-
-#endif /* _GPXE_BIOS_SMBIOS_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/bios_timer.h b/gpxe/src/arch/i386/include/gpxe/bios_timer.h
deleted file mode 100644
index ed9df522..00000000
--- a/gpxe/src/arch/i386/include/gpxe/bios_timer.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _GPXE_BIOS_TIMER_H
-#define _GPXE_BIOS_TIMER_H
-
-/** @file
- *
- * BIOS timer
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef TIMER_PCBIOS
-#define TIMER_PREFIX_pcbios
-#else
-#define TIMER_PREFIX_pcbios __pcbios_
-#endif
-
-#include <gpxe/timer2.h>
-
-/**
- * Delay for a fixed number of microseconds
- *
- * @v usecs Number of microseconds for which to delay
- */
-static inline __always_inline void
-TIMER_INLINE ( pcbios, udelay ) ( unsigned long usecs ) {
- /* BIOS timer is not high-resolution enough for udelay(), so
- * we use timer2
- */
- timer2_udelay ( usecs );
-}
-
-/**
- * Get number of ticks per second
- *
- * @ret ticks_per_sec Number of ticks per second
- */
-static inline __always_inline unsigned long
-TIMER_INLINE ( pcbios, ticks_per_sec ) ( void ) {
- /* BIOS timer ticks over at 18.2 ticks per second */
- return 18;
-}
-
-#endif /* _GPXE_BIOS_TIMER_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/ibft.h b/gpxe/src/arch/i386/include/gpxe/ibft.h
deleted file mode 100644
index c41e2e40..00000000
--- a/gpxe/src/arch/i386/include/gpxe/ibft.h
+++ /dev/null
@@ -1,302 +0,0 @@
-#ifndef _GPXE_IBFT_H
-#define _GPXE_IBFT_H
-
-/*
- * Copyright Fen Systems Ltd. 2007. Portions of this code are derived
- * from IBM Corporation Sample Programs. Copyright IBM Corporation
- * 2004, 2007. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-FILE_LICENCE ( BSD2 );
-
-/** @file
- *
- * iSCSI boot firmware table
- *
- * The information in this file is derived from the document "iSCSI
- * Boot Firmware Table (iBFT)" as published by IBM at
- *
- * ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf
- *
- */
-
-#include <stdint.h>
-#include <gpxe/acpi.h>
-#include <gpxe/in.h>
-
-/** iSCSI Boot Firmware Table signature */
-#define IBFT_SIG "iBFT"
-
-/** An offset from the start of the iBFT */
-typedef uint16_t ibft_off_t;
-
-/** Length of a string within the iBFT (excluding terminating NUL) */
-typedef uint16_t ibft_size_t;
-
-/** A string within the iBFT */
-struct ibft_string {
- /** Length of string */
- ibft_size_t length;
- /** Offset to string */
- ibft_off_t offset;
-} __attribute__ (( packed ));
-
-/** An IP address within the iBFT */
-struct ibft_ipaddr {
- /** Reserved; must be zero */
- uint16_t zeroes[5];
- /** Must be 0xffff if IPv4 address is present, otherwise zero */
- uint16_t ones;
- /** The IPv4 address, or zero if not present */
- struct in_addr in;
-} __attribute__ (( packed ));
-
-/**
- * iBFT structure header
- *
- * This structure is common to several sections within the iBFT.
- */
-struct ibft_header {
- /** Structure ID
- *
- * This is an IBFT_STRUCTURE_ID_XXX constant
- */
- uint8_t structure_id;
- /** Version (always 1) */
- uint8_t version;
- /** Length, including this header */
- uint16_t length;
- /** Index
- *
- * This is the number of the NIC or Target, when applicable.
- */
- uint8_t index;
- /** Flags */
- uint8_t flags;
-} __attribute__ (( packed ));
-
-/**
- * iBFT Control structure
- *
- */
-struct ibft_control {
- /** Common header */
- struct ibft_header header;
- /** Extensions */
- uint16_t extensions;
- /** Offset to Initiator structure */
- ibft_off_t initiator;
- /** Offset to NIC structure for NIC 0 */
- ibft_off_t nic_0;
- /** Offset to Target structure for target 0 */
- ibft_off_t target_0;
- /** Offset to NIC structure for NIC 1 */
- ibft_off_t nic_1;
- /** Offset to Target structure for target 1 */
- ibft_off_t target_1;
-} __attribute__ (( packed ));
-
-/** Structure ID for Control section */
-#define IBFT_STRUCTURE_ID_CONTROL 0x01
-
-/** Attempt login only to specified target
- *
- * If this flag is not set, all targets will be logged in to.
- */
-#define IBFT_FL_CONTROL_SINGLE_LOGIN_ONLY 0x01
-
-/**
- * iBFT Initiator structure
- *
- */
-struct ibft_initiator {
- /** Common header */
- struct ibft_header header;
- /** iSNS server */
- struct ibft_ipaddr isns_server;
- /** SLP server */
- struct ibft_ipaddr slp_server;
- /** Primary and secondary Radius servers */
- struct ibft_ipaddr radius[2];
- /** Initiator name */
- struct ibft_string initiator_name;
-} __attribute__ (( packed ));
-
-/** Structure ID for Initiator section */
-#define IBFT_STRUCTURE_ID_INITIATOR 0x02
-
-/** Initiator block valid */
-#define IBFT_FL_INITIATOR_BLOCK_VALID 0x01
-
-/** Initiator firmware boot selected */
-#define IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED 0x02
-
-/**
- * iBFT NIC structure
- *
- */
-struct ibft_nic {
- /** Common header */
- struct ibft_header header;
- /** IP address */
- struct ibft_ipaddr ip_address;
- /** Subnet mask
- *
- * This is the length of the subnet mask in bits (e.g. /24).
- */
- uint8_t subnet_mask_prefix;
- /** Origin */
- uint8_t origin;
- /** Default gateway */
- struct ibft_ipaddr gateway;
- /** Primary and secondary DNS servers */
- struct ibft_ipaddr dns[2];
- /** DHCP server */
- struct ibft_ipaddr dhcp;
- /** VLAN tag */
- uint16_t vlan;
- /** MAC address */
- uint8_t mac_address[6];
- /** PCI bus:dev:fn */
- uint16_t pci_bus_dev_func;
- /** Hostname */
- struct ibft_string hostname;
-} __attribute__ (( packed ));
-
-/** Structure ID for NIC section */
-#define IBFT_STRUCTURE_ID_NIC 0x03
-
-/** NIC block valid */
-#define IBFT_FL_NIC_BLOCK_VALID 0x01
-
-/** NIC firmware boot selected */
-#define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED 0x02
-
-/** NIC global / link local */
-#define IBFT_FL_NIC_GLOBAL 0x04
-
-/**
- * iBFT Target structure
- *
- */
-struct ibft_target {
- /** Common header */
- struct ibft_header header;
- /** IP address */
- struct ibft_ipaddr ip_address;
- /** TCP port */
- uint16_t socket;
- /** Boot LUN */
- uint64_t boot_lun;
- /** CHAP type
- *
- * This is an IBFT_CHAP_XXX constant.
- */
- uint8_t chap_type;
- /** NIC association */
- uint8_t nic_association;
- /** Target name */
- struct ibft_string target_name;
- /** CHAP name */
- struct ibft_string chap_name;
- /** CHAP secret */
- struct ibft_string chap_secret;
- /** Reverse CHAP name */
- struct ibft_string reverse_chap_name;
- /** Reverse CHAP secret */
- struct ibft_string reverse_chap_secret;
-} __attribute__ (( packed ));
-
-/** Structure ID for Target section */
-#define IBFT_STRUCTURE_ID_TARGET 0x04
-
-/** Target block valid */
-#define IBFT_FL_TARGET_BLOCK_VALID 0x01
-
-/** Target firmware boot selected */
-#define IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED 0x02
-
-/** Target use Radius CHAP */
-#define IBFT_FL_TARGET_USE_CHAP 0x04
-
-/** Target use Radius rCHAP */
-#define IBFT_FL_TARGET_USE_RCHAP 0x08
-
-/* Values for chap_type */
-#define IBFT_CHAP_NONE 0 /**< No CHAP authentication */
-#define IBFT_CHAP_ONE_WAY 1 /**< One-way CHAP */
-#define IBFT_CHAP_MUTUAL 2 /**< Mutual CHAP */
-
-/**
- * iSCSI Boot Firmware Table (iBFT)
- */
-struct ibft_table {
- /** ACPI header */
- struct acpi_description_header acpi;
- /** Reserved */
- uint8_t reserved[12];
- /** Control structure */
- struct ibft_control control;
-} __attribute__ (( packed ));
-
-/**
- * iSCSI string block descriptor
- *
- * This is an internal structure that we use to keep track of the
- * allocation of string data.
- */
-struct ibft_string_block {
- /** The iBFT containing these strings */
- struct ibft_table *table;
- /** Offset of first free byte within iBFT */
- unsigned int offset;
-};
-
-/** Amount of space reserved for strings in a gPXE iBFT */
-#define IBFT_STRINGS_SIZE 384
-
-/**
- * An iBFT created by gPXE
- *
- */
-struct gpxe_ibft {
- /** The fixed section */
- struct ibft_table table;
- /** The Initiator section */
- struct ibft_initiator initiator __attribute__ (( aligned ( 16 ) ));
- /** The NIC section */
- struct ibft_nic nic __attribute__ (( aligned ( 16 ) ));
- /** The Target section */
- struct ibft_target target __attribute__ (( aligned ( 16 ) ));
- /** Strings block */
- char strings[IBFT_STRINGS_SIZE];
-} __attribute__ (( packed, aligned ( 16 ) ));
-
-struct net_device;
-struct iscsi_session;
-
-extern int ibft_fill_data ( struct net_device *netdev,
- struct iscsi_session *iscsi );
-
-#endif /* _GPXE_IBFT_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/memtop_umalloc.h b/gpxe/src/arch/i386/include/gpxe/memtop_umalloc.h
deleted file mode 100644
index eaf7025b..00000000
--- a/gpxe/src/arch/i386/include/gpxe/memtop_umalloc.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _GPXE_MEMTOP_UMALLOC_H
-#define _GPXE_MEMTOP_UMALLOC_H
-
-/** @file
- *
- * External memory allocation
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef UMALLOC_MEMTOP
-#define UMALLOC_PREFIX_memtop
-#else
-#define UMALLOC_PREFIX_memtop __memtop_
-#endif
-
-#endif /* _GPXE_MEMTOP_UMALLOC_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/rdtsc_timer.h b/gpxe/src/arch/i386/include/gpxe/rdtsc_timer.h
deleted file mode 100644
index 67ba22f0..00000000
--- a/gpxe/src/arch/i386/include/gpxe/rdtsc_timer.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef _GPXE_RDTSC_TIMER_H
-#define _GPXE_RDTSC_TIMER_H
-
-/** @file
- *
- * RDTSC timer
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef TIMER_RDTSC
-#define TIMER_PREFIX_rdtsc
-#else
-#define TIMER_PREFIX_rdtsc __rdtsc_
-#endif
-
-/**
- * RDTSC values can easily overflow an unsigned long. We discard the
- * low-order bits in order to obtain sensibly-scaled values.
- */
-#define TSC_SHIFT 8
-
-/**
- * Get current system time in ticks
- *
- * @ret ticks Current time, in ticks
- */
-static inline __always_inline unsigned long
-TIMER_INLINE ( rdtsc, currticks ) ( void ) {
- unsigned long ticks;
-
- __asm__ __volatile__ ( "rdtsc\n\t"
- "shrdl %1, %%edx, %%eax\n\t"
- : "=a" ( ticks ) : "i" ( TSC_SHIFT ) : "edx" );
- return ticks;
-}
-
-#endif /* _GPXE_RDTSC_TIMER_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/sbft.h b/gpxe/src/arch/i386/include/gpxe/sbft.h
deleted file mode 100644
index 30038436..00000000
--- a/gpxe/src/arch/i386/include/gpxe/sbft.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef _GPXE_SBFT_H
-#define _GPXE_SBFT_H
-
-/*
- * Copyright (C) 2009 Fen Systems Ltd <mbrown@fensystems.co.uk>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-FILE_LICENCE ( BSD2 );
-
-/** @file
- *
- * SRP boot firmware table
- *
- * The working draft specification for the SRP boot firmware table can
- * be found at
- *
- * http://etherboot.org/wiki/srp/sbft
- *
- */
-
-#include <stdint.h>
-#include <gpxe/acpi.h>
-#include <gpxe/scsi.h>
-#include <gpxe/srp.h>
-#include <gpxe/ib_srp.h>
-
-/** SRP Boot Firmware Table signature */
-#define SBFT_SIG "sBFT"
-
-/** An offset from the start of the sBFT */
-typedef uint16_t sbft_off_t;
-
-/**
- * SRP Boot Firmware Table
- */
-struct sbft_table {
- /** ACPI header */
- struct acpi_description_header acpi;
- /** Offset to SCSI subtable */
- sbft_off_t scsi_offset;
- /** Offset to SRP subtable */
- sbft_off_t srp_offset;
- /** Offset to IB subtable, if present */
- sbft_off_t ib_offset;
- /** Reserved */
- uint8_t reserved[6];
-} __attribute__ (( packed ));
-
-/**
- * sBFT SCSI subtable
- */
-struct sbft_scsi_subtable {
- /** LUN */
- struct scsi_lun lun;
-} __attribute__ (( packed ));
-
-/**
- * sBFT SRP subtable
- */
-struct sbft_srp_subtable {
- /** Initiator and target ports */
- struct srp_port_ids port_ids;
-} __attribute__ (( packed ));
-
-/**
- * sBFT IB subtable
- */
-struct sbft_ib_subtable {
- /** Source GID */
- struct ib_gid sgid;
- /** Destination GID */
- struct ib_gid dgid;
- /** Service ID */
- struct ib_gid_half service_id;
- /** Partition key */
- uint16_t pkey;
- /** Reserved */
- uint8_t reserved[6];
-} __attribute__ (( packed ));
-
-/**
- * An sBFT created by gPXE
- */
-struct gpxe_sbft {
- /** The table header */
- struct sbft_table table;
- /** The SCSI subtable */
- struct sbft_scsi_subtable scsi;
- /** The SRP subtable */
- struct sbft_srp_subtable srp;
- /** The IB subtable */
- struct sbft_ib_subtable ib;
-} __attribute__ (( packed, aligned ( 16 ) ));
-
-struct srp_device;
-
-extern int sbft_fill_data ( struct srp_device *srp );
-
-#endif /* _GPXE_SBFT_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/timer2.h b/gpxe/src/arch/i386/include/gpxe/timer2.h
deleted file mode 100644
index 8f119515..00000000
--- a/gpxe/src/arch/i386/include/gpxe/timer2.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _GPXE_TIMER2_H
-#define _GPXE_TIMER2_H
-
-/** @file
- *
- * Timer chip control
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-extern void timer2_udelay ( unsigned long usecs );
-
-#endif /* _GPXE_TIMER2_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/x86_io.h b/gpxe/src/arch/i386/include/gpxe/x86_io.h
deleted file mode 100644
index beb5b22a..00000000
--- a/gpxe/src/arch/i386/include/gpxe/x86_io.h
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef _GPXE_X86_IO_H
-#define _GPXE_X86_IO_H
-
-/** @file
- *
- * gPXE I/O API for x86
- *
- * i386 uses direct pointer dereferences for accesses to memory-mapped
- * I/O space, and the inX/outX instructions for accesses to
- * port-mapped I/O space.
- *
- * 64-bit atomic accesses (readq() and writeq()) use MMX instructions,
- * and will crash original Pentium and earlier CPUs. Fortunately, no
- * hardware that requires atomic 64-bit accesses will physically fit
- * into a machine with such an old CPU anyway.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef IOAPI_X86
-#define IOAPI_PREFIX_x86
-#else
-#define IOAPI_PREFIX_x86 __x86_
-#endif
-
-/*
- * Memory space mappings
- *
- */
-
-/*
- * Physical<->Bus and Bus<->I/O address mappings
- *
- */
-
-static inline __always_inline unsigned long
-IOAPI_INLINE ( x86, phys_to_bus ) ( unsigned long phys_addr ) {
- return phys_addr;
-}
-
-static inline __always_inline unsigned long
-IOAPI_INLINE ( x86, bus_to_phys ) ( unsigned long bus_addr ) {
- return bus_addr;
-}
-
-static inline __always_inline void *
-IOAPI_INLINE ( x86, ioremap ) ( unsigned long bus_addr, size_t len __unused ) {
- return phys_to_virt ( bus_addr );
-}
-
-static inline __always_inline void
-IOAPI_INLINE ( x86, iounmap ) ( volatile const void *io_addr __unused ) {
- /* Nothing to do */
-}
-
-static inline __always_inline unsigned long
-IOAPI_INLINE ( x86, io_to_bus ) ( volatile const void *io_addr ) {
- return virt_to_phys ( io_addr );
-}
-
-/*
- * MMIO reads and writes up to 32 bits
- *
- */
-
-#define X86_READX( _api_func, _type ) \
-static inline __always_inline _type \
-IOAPI_INLINE ( x86, _api_func ) ( volatile _type *io_addr ) { \
- return *io_addr; \
-}
-X86_READX ( readb, uint8_t );
-X86_READX ( readw, uint16_t );
-X86_READX ( readl, uint32_t );
-
-#define X86_WRITEX( _api_func, _type ) \
-static inline __always_inline void \
-IOAPI_INLINE ( x86, _api_func ) ( _type data, \
- volatile _type *io_addr ) { \
- *io_addr = data; \
-}
-X86_WRITEX ( writeb, uint8_t );
-X86_WRITEX ( writew, uint16_t );
-X86_WRITEX ( writel, uint32_t );
-
-/*
- * PIO reads and writes up to 32 bits
- *
- */
-
-#define X86_INX( _insn_suffix, _type, _reg_prefix ) \
-static inline __always_inline _type \
-IOAPI_INLINE ( x86, in ## _insn_suffix ) ( volatile _type *io_addr ) { \
- _type data; \
- __asm__ __volatile__ ( "in" #_insn_suffix " %w1, %" _reg_prefix "0" \
- : "=a" ( data ) : "Nd" ( io_addr ) ); \
- return data; \
-} \
-static inline __always_inline void \
-IOAPI_INLINE ( x86, ins ## _insn_suffix ) ( volatile _type *io_addr, \
- _type *data, \
- unsigned int count ) { \
- unsigned int discard_D; \
- __asm__ __volatile__ ( "rep ins" #_insn_suffix \
- : "=D" ( discard_D ) \
- : "d" ( io_addr ), "c" ( count ), \
- "0" ( data ) ); \
-}
-X86_INX ( b, uint8_t, "b" );
-X86_INX ( w, uint16_t, "w" );
-X86_INX ( l, uint32_t, "k" );
-
-#define X86_OUTX( _insn_suffix, _type, _reg_prefix ) \
-static inline __always_inline void \
-IOAPI_INLINE ( x86, out ## _insn_suffix ) ( _type data, \
- volatile _type *io_addr ) { \
- __asm__ __volatile__ ( "out" #_insn_suffix " %" _reg_prefix "0, %w1" \
- : : "a" ( data ), "Nd" ( io_addr ) ); \
-} \
-static inline __always_inline void \
-IOAPI_INLINE ( x86, outs ## _insn_suffix ) ( volatile _type *io_addr, \
- const _type *data, \
- unsigned int count ) { \
- unsigned int discard_S; \
- __asm__ __volatile__ ( "rep outs" #_insn_suffix \
- : "=S" ( discard_S ) \
- : "d" ( io_addr ), "c" ( count ), \
- "0" ( data ) ); \
-}
-X86_OUTX ( b, uint8_t, "b" );
-X86_OUTX ( w, uint16_t, "w" );
-X86_OUTX ( l, uint32_t, "k" );
-
-/*
- * Slow down I/O
- *
- */
-
-static inline __always_inline void
-IOAPI_INLINE ( x86, iodelay ) ( void ) {
- __asm__ __volatile__ ( "outb %al, $0x80" );
-}
-
-/*
- * Memory barrier
- *
- */
-
-static inline __always_inline void
-IOAPI_INLINE ( x86, mb ) ( void ) {
- __asm__ __volatile__ ( "lock; addl $0, 0(%%esp)" : : : "memory" );
-}
-
-#endif /* _GPXE_X86_IO_H */