]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[ioapi] Remove old io.h file and switch all users over to <gpxe/io.h>
authorMichael Brown <mcb30@etherboot.org>
Sat, 11 Oct 2008 23:52:30 +0000 (00:52 +0100)
committerMichael Brown <mcb30@etherboot.org>
Sun, 12 Oct 2008 00:06:27 +0000 (01:06 +0100)
22 files changed:
src/arch/i386/core/i386_timer.c
src/arch/i386/core/relocate.c
src/arch/i386/core/video_subr.c
src/arch/i386/drivers/timer_rdtsc.c
src/arch/i386/firmware/pcbios/gateA20.c
src/arch/i386/include/io.h [deleted file]
src/arch/i386/include/pcidirect.h
src/arch/i386/include/realmode.h
src/core/debug.c
src/core/malloc.c
src/core/pc_kbd.c
src/core/serial.c
src/drivers/bus/eisa.c
src/drivers/bus/isa.c
src/drivers/bus/isapnp.c
src/drivers/bus/mca.c
src/drivers/net/3c509.c
src/drivers/net/e1000/e1000.h
src/drivers/net/e1000/e1000_osdep.h
src/drivers/net/natsemi.c
src/drivers/net/pnic.c
src/drivers/net/rtl8139.c

index 8f90ae05aff942edbd2c92b1274bc4d93b7aa91e..3325bb0b60cf2ec5f4165a6cd5805b444ce81a50 100644 (file)
@@ -14,7 +14,7 @@
 #include <stddef.h>
 #include <bits/timer2.h>
 #include <gpxe/timer.h>
-#include <io.h>
+#include <gpxe/io.h>
 
 /* Timers tick over at this rate */
 #define TIMER2_TICK_RATE       1193180U
index 53e190f588f23c40f49653a8d552a5ed4b89f67d..fd8df087faa90237f85ee6b039a248f59c8392f2 100644 (file)
@@ -1,4 +1,4 @@
-#include <io.h>
+#include <gpxe/io.h>
 #include <registers.h>
 #include <gpxe/memmap.h>
 
index bf82cc618988ff09ee6724d33238cd1c41f250a5..c821cd02c7a289269a86c4d30636828fbb36fad0 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "stddef.h"
 #include "string.h"
-#include "io.h"
+#include <gpxe/io.h>
 #include "console.h"
 #include <gpxe/init.h>
 #include "vga.h"
index 09b7df2f05692093e2619675b849bfd48924bb5d..f4ede558b7b76f51a8b9fe51a6d8bf8b28c9f35e 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <bits/cpu.h>
 #include <bits/timer2.h>
-#include <io.h>
+#include <gpxe/io.h>
 
 
 #define rdtsc(low,high) \
index a14e34162304888261a279739aeb3e54651d8f6f..9113524784a9a57d7c8d0ccef32536217fd93fc4 100644 (file)
@@ -48,9 +48,9 @@ static void empty_8042 ( void ) {
        time = currticks() + TICKS_PER_SEC;     /* max wait of 1 second */
        while ( ( inb ( K_CMD ) & ( K_IBUF_FUL | K_OBUF_FUL ) ) &&
                currticks() < time ) {
-               SLOW_DOWN_IO;
-               ( void ) inb ( K_RDWR );
-               SLOW_DOWN_IO;
+               iodelay();
+               ( void ) inb_p ( K_RDWR );
+               iodelay();
        }
 }
 
@@ -77,7 +77,7 @@ static int gateA20_is_set ( int retries ) {
                /* Avoid false negatives */
                test_pattern++;
 
-               SLOW_DOWN_IO;
+               iodelay();
 
                /* Always retry at least once, to avoid false negatives */
        } while ( retries-- >= 0 );
@@ -145,9 +145,9 @@ void gateA20_set ( void ) {
                        scp_a = inb ( SCP_A );
                        scp_a &= ~0x01; /* Avoid triggering a reset */
                        scp_a |= 0x02; /* Enable A20 */
-                       SLOW_DOWN_IO;
+                       iodelay();
                        outb ( scp_a, SCP_A );
-                       SLOW_DOWN_IO;
+                       iodelay();
                        if ( gateA20_is_set ( A20_SCPA_RETRIES ) ) {
                                DBG ( "Enabled gate A20 using "
                                      "Fast Gate A20\n" );
diff --git a/src/arch/i386/include/io.h b/src/arch/i386/include/io.h
deleted file mode 100644 (file)
index c26fdf7..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-#ifndef        ETHERBOOT_IO_H
-#define ETHERBOOT_IO_H
-
-#include <stdint.h>
-#include "virtaddr.h"
-
-/* virt_to_bus converts an addresss inside of etherboot [_start, _end]
- * into a memory access cards can use.
- */
-#define virt_to_bus virt_to_phys
-
-
-/* bus_to_virt reverses virt_to_bus, the address must be output
- * from virt_to_bus to be valid.  This function does not work on
- * all bus addresses.
- */
-#define bus_to_virt phys_to_virt
-
-/* ioremap converts a random 32bit bus address into something
- * etherboot can access.
- */
-static inline void *ioremap(unsigned long bus_addr, unsigned long length __unused)
-{
-       return bus_to_virt(bus_addr);
-}
-
-/* iounmap cleans up anything ioremap had to setup */
-static inline void iounmap(void *virt_addr __unused)
-{
-       return;
-}
-
-/*
- * This file contains the definitions for the x86 IO instructions
- * inb/inw/inl/outb/outw/outl and the "string versions" of the same
- * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
- * versions of the single-IO instructions (inb_p/inw_p/..).
- *
- * This file is not meant to be obfuscating: it's just complicated
- * to (a) handle it all in a way that makes gcc able to optimize it
- * as well as possible and (b) trying to avoid writing the same thing
- * over and over again with slight variations and possibly making a
- * mistake somewhere.
- */
-
-/*
- * Thanks to James van Artsdalen for a better timing-fix than
- * the two short jumps: using outb's to a nonexistent port seems
- * to guarantee better timings even on fast machines.
- *
- * On the other hand, I'd like to be sure of a non-existent port:
- * I feel a bit unsafe about using 0x80 (should be safe, though)
- *
- *             Linus
- */
-
-#ifdef SLOW_IO_BY_JUMPING
-#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:")
-#else
-#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80")
-#endif
-
-#ifdef REALLY_SLOW_IO
-#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
-#else
-#define SLOW_DOWN_IO __SLOW_DOWN_IO
-#endif
-
-/*
- * readX/writeX() are used to access memory mapped devices. On some
- * architectures the memory mapped IO stuff needs to be accessed
- * differently. On the x86 architecture, we just read/write the
- * memory location directly.
- */
-static inline __attribute__ (( always_inline )) unsigned long
-_readb ( volatile uint8_t *addr ) {
-       unsigned long data = *addr;
-       DBGIO ( "[%08lx] => %02lx\n", virt_to_phys ( addr ), data );
-       return data;
-}
-static inline __attribute__ (( always_inline )) unsigned long
-_readw ( volatile uint16_t *addr ) {
-       unsigned long data = *addr;
-       DBGIO ( "[%08lx] => %04lx\n", virt_to_phys ( addr ), data );
-       return data;
-}
-static inline __attribute__ (( always_inline )) unsigned long
-_readl ( volatile uint32_t *addr ) {
-       unsigned long data = *addr;
-       DBGIO ( "[%08lx] => %08lx\n", virt_to_phys ( addr ), data );
-       return data;
-}
-#define readb( addr ) _readb ( ( volatile uint8_t * ) (addr) )
-#define readw( addr ) _readw ( ( volatile uint16_t * ) (addr) )
-#define readl( addr ) _readl ( ( volatile uint32_t * ) (addr) )
-
-static inline __attribute__ (( always_inline )) void
-_writeb ( unsigned long data, volatile uint8_t *addr ) {
-       DBGIO ( "[%08lx] <= %02lx\n", virt_to_phys ( addr ), data );
-       *addr = data;
-}
-static inline __attribute__ (( always_inline )) void
-_writew ( unsigned long data, volatile uint16_t *addr ) {
-       DBGIO ( "[%08lx] <= %04lx\n", virt_to_phys ( addr ), data );
-       *addr = data;
-}
-static inline __attribute__ (( always_inline )) void
-_writel ( unsigned long data, volatile uint32_t *addr ) {
-       DBGIO ( "[%08lx] <= %08lx\n", virt_to_phys ( addr ), data );
-       *addr = data;
-}
-#define writeb( b, addr ) _writeb ( (b), ( volatile uint8_t * ) (addr) )
-#define writew( b, addr ) _writew ( (b), ( volatile uint16_t * ) (addr) )
-#define writel( b, addr ) _writel ( (b), ( volatile uint32_t * ) (addr) )
-
-#define memcpy_fromio(a,b,c)   memcpy((a),(void *)(b),(c))
-#define memcpy_toio(a,b,c)     memcpy((void *)(a),(b),(c))
-
-/*
- * Force strict CPU ordering.
- * And yes, this is required on UP too when we're talking
- * to devices.
- *
- * For now, "wmb()" doesn't actually do anything, as all
- * Intel CPU's follow what Intel calls a *Processor Order*,
- * in which all writes are seen in the program order even
- * outside the CPU.
- *
- * I expect future Intel CPU's to have a weaker ordering,
- * but I'd also expect them to finally get their act together
- * and add some real memory barriers if so.
- *
- * Some non intel clones support out of order store. wmb() ceases to be a
- * nop for these.
- */
-#define mb()   __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
-#define rmb()  mb()
-#define wmb()  mb();
-
-
-/*
- * Talk about misusing macros..
- */
-
-#define __OUT1(s,x) \
-extern void __out##s(unsigned x value, unsigned short port); \
-extern inline void __out##s(unsigned x value, unsigned short port) {
-
-#define __OUT2(s,s1,s2) \
-__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
-
-#define __OUT(s,s1,x) \
-__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \
-__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \
-__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \
-__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }
-
-#define __IN1(s,x) \
-extern unsigned x __in##s(unsigned short port); \
-extern inline unsigned x __in##s(unsigned short port) { unsigned x _v;
-
-#define __IN2(s,s1,s2) \
-__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
-
-#define __IN(s,s1,x,i...) \
-__IN1(s,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \
-__IN1(s##c,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \
-__IN1(s##_p,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \
-__IN1(s##c_p,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; }
-
-#define __INS(s) \
-extern void ins##s(unsigned short port, void * addr, unsigned long count); \
-extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \
-{ __asm__ __volatile__ ("cld ; rep ; ins" #s \
-: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
-
-#define __OUTS(s) \
-extern void outs##s(unsigned short port, const void * addr, unsigned long  count); \
-extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
-{ __asm__ __volatile__ ("cld ; rep ; outs" #s \
-: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
-
-__IN(b,"", char)
-__IN(w,"",short)
-__IN(l,"", long)
-
-__OUT(b,"b",char)
-__OUT(w,"w",short)
-__OUT(l,,int)
-
-__INS(b)
-__INS(w)
-__INS(l)
-
-__OUTS(b)
-__OUTS(w)
-__OUTS(l)
-
-/*
- * Note that due to the way __builtin_constant_p() works, you
- *  - can't use it inside a inline function (it will never be true)
- *  - you don't have to worry about side effects within the __builtin..
- */
-#define outb(val,port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __outbc((val),(port)) : \
-       __outb((val),(port)))
-
-#define inb(port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __inbc(port) : \
-       __inb(port))
-
-#define outb_p(val,port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __outbc_p((val),(port)) : \
-       __outb_p((val),(port)))
-
-#define inb_p(port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __inbc_p(port) : \
-       __inb_p(port))
-
-#define outw(val,port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __outwc((val),(port)) : \
-       __outw((val),(port)))
-
-#define inw(port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __inwc(port) : \
-       __inw(port))
-
-#define outw_p(val,port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __outwc_p((val),(port)) : \
-       __outw_p((val),(port)))
-
-#define inw_p(port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __inwc_p(port) : \
-       __inw_p(port))
-
-#define outl(val,port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __outlc((val),(port)) : \
-       __outl((val),(port)))
-
-#define inl(port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __inlc(port) : \
-       __inl(port))
-
-#define outl_p(val,port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __outlc_p((val),(port)) : \
-       __outl_p((val),(port)))
-
-#define inl_p(port) \
-((__builtin_constant_p((port)) && (port) < 256) ? \
-       __inlc_p(port) : \
-       __inl_p(port))
-
-#endif /* ETHERBOOT_IO_H */
index 4e2e9d122a69ea1cb5e794b0946bf343d11f5f48..c333424df51a5b7864a09e36b477b777b719f4d9 100644 (file)
@@ -2,7 +2,7 @@
 #define _PCIDIRECT_H
 
 #include <stdint.h>
-#include <io.h>
+#include <gpxe/io.h>
 
 /** @file
  *
index 5d3ddf50958d5d9a479a12488d702740d4bc9a7c..ea4192ed9b9880fdf027a529654cd4c968cc82f5 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "stdint.h"
 #include "registers.h"
-#include "io.h"
+#include <gpxe/io.h>
 
 /*
  * Data structures and type definitions
index 098304204ee49cf8bdeb3efc95f6c4506c99f188..3079cd4c7af5e7e2952844b7dd07a3b1ba486c9f 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdarg.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <console.h>
 
 void pause ( void ) {
index 2d892f42d8fddc10fba601901c8f18ac5b515e96..db7f1bedf6a58f98a295f2ec34dd4c6e23c5565d 100644 (file)
@@ -20,7 +20,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <strings.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <gpxe/list.h>
 #include <gpxe/init.h>
 #include <gpxe/malloc.h>
index d43357feb92f635c94e9a0c9738e26e9128bb9f8..799c8beb75f9eb551cc86dbcb557d3248d8f4b54 100644 (file)
@@ -10,7 +10,7 @@
  *             yhlu@tyan.com
  */
 
-#include "io.h"
+#include <gpxe/io.h>
 #include "console.h"
 
 static char key_map[][128] = {
index 97640f9317427a1e85dced2ad29c117ccce455f7..5b3be39c346b4139f7587f796234c4bcdf936cf5 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "stddef.h"
 #include <gpxe/init.h>
-#include "io.h"
+#include <gpxe/io.h>
 #include <unistd.h>
 #include <gpxe/serial.h>
 #include "config/serial.h"
index ee03df3af16790b45f0240cc42d0c2247d46406f..d9e4235977ba906fa8fead0528e107f47d698dfb 100644 (file)
@@ -3,7 +3,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <unistd.h>
 #include <gpxe/eisa.h>
 
index a4105fd00d75b2304c3e5c119e5f8c2e29a30707..4147a9bc2c3d2fe8974cfc0843c853a46a651c4b 100644 (file)
@@ -3,7 +3,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <gpxe/isa.h>
 
 /*
index f4968eb1363a8f9dccfdd9f71891d4d5ef9c52c8..0915a92b7f9b1c549df236584bd8ed419befe325 100644 (file)
@@ -60,7 +60,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <unistd.h>
 #include <gpxe/isapnp.h>
 
index eb7b7e3951b090ae069f141b0984b1a9b31453f7..e92338134421a5a965600804054bc7980c46cf56 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <gpxe/mca.h>
 
 static struct mca_driver mca_drivers[0]
index 8a15aff29412565a0a8f50b0ee0d4d56370dd918..ecfdec557dd5d2cf690bb134a67091d91deedee6 100644 (file)
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <unistd.h>
 #include <gpxe/device.h>
 #include <gpxe/isa.h>
index 4ae414513aedad95df9c71b68809ed4fe376490d..e0664e38cb0c08f0b11f27f24d57ba22ff8313d4 100644 (file)
@@ -34,7 +34,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <errno.h>
 #include <byteswap.h>
 #include <gpxe/pci.h>
index eb57fb54d12ce536070137b5bdbe750cf0c14495..c2d9eb9ccf140986078389ca552cf6a023011097 100644 (file)
@@ -37,7 +37,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <errno.h>
 #include <unistd.h>
 #include <byteswap.h>
index 028b905cea4996994a3aef3b54510272a68494f5..bfe1452baffad8baeb4e0fa3ee09b960480fe04d 100644 (file)
@@ -61,7 +61,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <errno.h>
 #include <byteswap.h>
 #include <unistd.h>
index c7f08670d43c51a264418eb6e73f1051225fc73f..3a4af967f29f28f8a779004d150aeaaf6bfb3bba 100644 (file)
@@ -14,7 +14,7 @@ Bochs Pseudo NIC driver for Etherboot
 
 #include <stdint.h>
 #include <stdio.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <errno.h>
 #include <gpxe/pci.h>
 #include <gpxe/if_ether.h>
index 509047a931dcc8eb61e2e143d033f8f0ce77de9d..ff7de5c67fcac8150fdbc48075efbe16e8f5c886 100644 (file)
@@ -69,7 +69,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <io.h>
+#include <gpxe/io.h>
 #include <errno.h>
 #include <unistd.h>
 #include <byteswap.h>