From 824d6ffa7f3d52ce165419356bfe28eaaf36a81b Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 24 Apr 2006 15:42:49 +0000 Subject: [PATCH] Header rearrangement. I want to get to the point where any header in include/ reflects a standard user-level header (e.g. a POSIX header), while everything that's specific to gPXE lives in include/gpxe/. Headers that reflect a Linux header (e.g. if_ether.h) should also be in include/gpxe/, with the same name as the Linux header and, preferably, the same names used for the definitions. --- src/arch/i386/core/pci_io.c | 2 +- src/arch/i386/drivers/net/undi.c | 2 +- src/arch/i386/include/relocate.h | 2 +- src/arch/i386/prefix/select_pci.c | 2 +- src/core/btext.c | 2 +- src/core/nic.c | 9 +++++---- src/drivers/bus/pci.c | 2 +- src/drivers/net/3c595.c | 2 +- src/drivers/net/3c90x.c | 2 +- src/drivers/net/amd8111e.c | 2 +- src/drivers/net/davicom.c | 2 +- src/drivers/net/dmfe.c | 2 +- src/drivers/net/e1000.c | 2 +- src/drivers/net/eepro100.c | 2 +- src/drivers/net/epic100.c | 2 +- src/drivers/net/etherfabric.c | 2 +- src/drivers/net/forcedeth.c | 2 +- src/drivers/net/mlx_ipoib/ib_mt23108.c | 2 +- src/drivers/net/mlx_ipoib/ib_mt25218.c | 2 +- src/drivers/net/mlx_ipoib/mt23108.c | 2 +- src/drivers/net/mlx_ipoib/mt25218.c | 2 +- src/drivers/net/mtd80x.c | 2 +- src/drivers/net/natsemi.c | 2 +- src/drivers/net/ns83820.c | 2 +- src/drivers/net/ns8390.c | 2 +- src/drivers/net/pcnet32.c | 2 +- src/drivers/net/prism2.c | 2 +- src/drivers/net/prism2_pci.c | 2 +- src/drivers/net/prism2_plx.c | 2 +- src/drivers/net/r8169.c | 2 +- src/drivers/net/rtl8139.c | 2 +- src/drivers/net/sis900.c | 2 +- src/drivers/net/skel.c | 2 +- src/drivers/net/sundance.c | 2 +- src/drivers/net/tg3.c | 2 +- src/drivers/net/tlan.c | 2 +- src/drivers/net/tulip.c | 2 +- src/drivers/net/via-rhine.c | 2 +- src/drivers/net/via-velocity.c | 2 +- src/drivers/net/w89c840.c | 2 +- src/include/background.h | 2 +- src/include/console.h | 2 +- src/include/dev.h | 4 ++-- src/include/errno.h | 3 ++- src/include/gpxe/hello.h | 4 ++-- src/include/gpxe/if_arp.h | 6 +++--- src/include/gpxe/if_ether.h | 6 +++--- src/include/gpxe/in.h | 13 ++++++++----- src/include/gpxe/ip.h | 6 +++--- src/include/gpxe/iscsi.h | 6 +++--- src/include/{ => gpxe}/pci.h | 21 ++++++++++++++------- src/include/{ => gpxe}/pci_ids.h | 5 +++++ src/include/gpxe/scsi.h | 6 +++--- src/include/{ => gpxe}/tables.h | 10 ++++++---- src/include/gpxe/tcp.h | 6 +++--- src/include/image.h | 2 +- src/include/init.h | 2 +- src/include/proto.h | 2 +- src/include/resolv.h | 2 +- src/proto/nmb.c | 2 +- 60 files changed, 108 insertions(+), 89 deletions(-) rename src/include/{ => gpxe}/pci.h (97%) rename src/include/{ => gpxe}/pci_ids.h (99%) rename src/include/{ => gpxe}/tables.h (98%) diff --git a/src/arch/i386/core/pci_io.c b/src/arch/i386/core/pci_io.c index 28d9cbdd..cfb31ad9 100644 --- a/src/arch/i386/core/pci_io.c +++ b/src/arch/i386/core/pci_io.c @@ -12,7 +12,7 @@ */ #include "etherboot.h" #include "init.h" -#include "pci.h" +#include #include "pci_io.h" #ifdef KEEP_IT_REAL #include "realmode.h" diff --git a/src/arch/i386/drivers/net/undi.c b/src/arch/i386/drivers/net/undi.c index 38edf303..f0956e92 100644 --- a/src/arch/i386/drivers/net/undi.c +++ b/src/arch/i386/drivers/net/undi.c @@ -33,7 +33,7 @@ $Id$ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include /* UNDI and PXE defines. Includes pxe.h. */ #include "undi.h" /* 8259 PIC defines */ diff --git a/src/arch/i386/include/relocate.h b/src/arch/i386/include/relocate.h index 5e482bd6..5e87c693 100644 --- a/src/arch/i386/include/relocate.h +++ b/src/arch/i386/include/relocate.h @@ -4,7 +4,7 @@ /* relocate() is conceptually impossible with KEEP_IT_REAL */ #ifndef KEEP_IT_REAL -#include "tables.h" +#include /* An entry in the post-relocation function table */ struct post_reloc_fn { diff --git a/src/arch/i386/prefix/select_pci.c b/src/arch/i386/prefix/select_pci.c index e143b992..691b461c 100644 --- a/src/arch/i386/prefix/select_pci.c +++ b/src/arch/i386/prefix/select_pci.c @@ -1,5 +1,5 @@ #include "dev.h" -#include "pci.h" +#include #include "registers.h" /* diff --git a/src/core/btext.c b/src/core/btext.c index fc1d4e1b..da6c029b 100644 --- a/src/core/btext.c +++ b/src/core/btext.c @@ -10,7 +10,7 @@ #include "etherboot.h" #include "console.h" #include "init.h" -#include "pci.h" +#include #ifdef CONFIG_FILO #include diff --git a/src/core/nic.c b/src/core/nic.c index 04d48a11..64e87f61 100644 --- a/src/core/nic.c +++ b/src/core/nic.c @@ -457,7 +457,7 @@ int ip_transmit(int len, const void *buf) ip = (struct iphdr *)buf; destip = ip->dest.s_addr; - if (destip == IP_BROADCAST) { + if (destip == INADDR_BROADCAST) { eth_transmit(broadcast, ETH_P_IP, len, buf); } else if ((destip & htonl(MULTICAST_MASK)) == htonl(MULTICAST_NETWORK)) { unsigned char multicast[6]; @@ -765,7 +765,7 @@ static int bootp(void) memset ( arptable, 0, sizeof(arptable) ); memcpy ( arptable[ARP_CLIENT].node, my_hwaddr, ETH_ALEN ); - udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, + udp_transmit(INADDR_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, sizeof(struct bootpip_t), &ip); remaining_time = rfc2131_sleep_interval(BOOTP_TIMEOUT, retry++); stop_time = currticks() + remaining_time; @@ -804,8 +804,9 @@ static int bootp(void) for (reqretry = 0; reqretry < MAX_BOOTP_RETRIES; ) { unsigned long timeout; - udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER, - sizeof(struct bootpip_t), &ip); + udp_transmit(INADDR_BROADCAST, BOOTP_CLIENT, + BOOTP_SERVER, sizeof(struct bootpip_t), + &ip); dhcp_reply=0; timeout = rfc2131_sleep_interval(TIMEOUT, reqretry++); if (!await_reply(await_bootp, 0, NULL, timeout)) diff --git a/src/drivers/bus/pci.c b/src/drivers/bus/pci.c index 02286b7c..6352e56b 100644 --- a/src/drivers/bus/pci.c +++ b/src/drivers/bus/pci.c @@ -2,7 +2,7 @@ #include "string.h" #include "console.h" #include "nic.h" -#include "pci.h" +#include /* * pci_io.c may know how many buses we have, in which case it can diff --git a/src/drivers/net/3c595.c b/src/drivers/net/3c595.c index ab10bc9d..b6f531d1 100644 --- a/src/drivers/net/3c595.c +++ b/src/drivers/net/3c595.c @@ -27,7 +27,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "3c595.h" #include "timer.h" diff --git a/src/drivers/net/3c90x.c b/src/drivers/net/3c90x.c index c544381c..54dcc40d 100644 --- a/src/drivers/net/3c90x.c +++ b/src/drivers/net/3c90x.c @@ -39,7 +39,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "timer.h" static struct nic_operations a3c90x_operations; diff --git a/src/drivers/net/amd8111e.c b/src/drivers/net/amd8111e.c index 611cbc85..e3b93dc5 100644 --- a/src/drivers/net/amd8111e.c +++ b/src/drivers/net/amd8111e.c @@ -31,7 +31,7 @@ #include "etherboot.h" #include "nic.h" #include "mii.h" -#include "pci.h" +#include #include "timer.h" #include "string.h" #include "stdint.h" diff --git a/src/drivers/net/davicom.c b/src/drivers/net/davicom.c index d087e29e..0f1a78cc 100644 --- a/src/drivers/net/davicom.c +++ b/src/drivers/net/davicom.c @@ -43,7 +43,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #undef DAVICOM_DEBUG #undef DAVICOM_DEBUG_WHERE diff --git a/src/drivers/net/dmfe.c b/src/drivers/net/dmfe.c index e1ff44ec..4cfb69bd 100644 --- a/src/drivers/net/dmfe.c +++ b/src/drivers/net/dmfe.c @@ -41,7 +41,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include #include "timer.h" /* #define EDEBUG 1 */ diff --git a/src/drivers/net/e1000.c b/src/drivers/net/e1000.c index 2eb6b333..a13a7271 100644 --- a/src/drivers/net/e1000.c +++ b/src/drivers/net/e1000.c @@ -52,7 +52,7 @@ Drivers are port from Intel's Linux driver e1000-4.3.15 /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include #include "timer.h" typedef unsigned char *dma_addr_t; diff --git a/src/drivers/net/eepro100.c b/src/drivers/net/eepro100.c index d97b1b18..27576a61 100644 --- a/src/drivers/net/eepro100.c +++ b/src/drivers/net/eepro100.c @@ -105,7 +105,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "timer.h" static int ioaddr; diff --git a/src/drivers/net/epic100.c b/src/drivers/net/epic100.c index 574f094b..babcf6b3 100644 --- a/src/drivers/net/epic100.c +++ b/src/drivers/net/epic100.c @@ -5,7 +5,7 @@ #define LINUX_OUT_MACROS #include "etherboot.h" -#include "pci.h" +#include #include "nic.h" #include "timer.h" #include "console.h" diff --git a/src/drivers/net/etherfabric.c b/src/drivers/net/etherfabric.c index bd64cf5e..05239d68 100644 --- a/src/drivers/net/etherfabric.c +++ b/src/drivers/net/etherfabric.c @@ -18,7 +18,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "timer.h" #define dma_addr_t unsigned long #include "etherfabric.h" diff --git a/src/drivers/net/forcedeth.c b/src/drivers/net/forcedeth.c index 63773836..08ddbcd9 100644 --- a/src/drivers/net/forcedeth.c +++ b/src/drivers/net/forcedeth.c @@ -48,7 +48,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include /* Include timer support functions */ #include "timer.h" #include "mii.h" diff --git a/src/drivers/net/mlx_ipoib/ib_mt23108.c b/src/drivers/net/mlx_ipoib/ib_mt23108.c index 0291f46c..ca3abb10 100644 --- a/src/drivers/net/mlx_ipoib/ib_mt23108.c +++ b/src/drivers/net/mlx_ipoib/ib_mt23108.c @@ -21,7 +21,7 @@ #include "mt23108.h" #include "ib_driver.h" -#include "pci.h" +#include struct device_buffers_st { union recv_wqe_u mads_qp_rcv_queue[NUM_MADS_RCV_WQES] diff --git a/src/drivers/net/mlx_ipoib/ib_mt25218.c b/src/drivers/net/mlx_ipoib/ib_mt25218.c index 11b25d49..f16577f1 100644 --- a/src/drivers/net/mlx_ipoib/ib_mt25218.c +++ b/src/drivers/net/mlx_ipoib/ib_mt25218.c @@ -21,7 +21,7 @@ #include "mt25218.h" #include "ib_driver.h" -#include "pci.h" +#include #define MOD_INC(counter, max_count) (counter) = ((counter)+1) & ((max_count) - 1) diff --git a/src/drivers/net/mlx_ipoib/mt23108.c b/src/drivers/net/mlx_ipoib/mt23108.c index 157995d7..06d63f39 100644 --- a/src/drivers/net/mlx_ipoib/mt23108.c +++ b/src/drivers/net/mlx_ipoib/mt23108.c @@ -15,7 +15,7 @@ Skeleton NIC driver for Etherboot /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include /* to get the ISA support functions, if this is an ISA NIC */ #include "isa.h" diff --git a/src/drivers/net/mlx_ipoib/mt25218.c b/src/drivers/net/mlx_ipoib/mt25218.c index 7866bf60..38b32dc5 100644 --- a/src/drivers/net/mlx_ipoib/mt25218.c +++ b/src/drivers/net/mlx_ipoib/mt25218.c @@ -15,7 +15,7 @@ Skeleton NIC driver for Etherboot /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include /* to get the ISA support functions, if this is an ISA NIC */ #include "isa.h" diff --git a/src/drivers/net/mtd80x.c b/src/drivers/net/mtd80x.c index c7754a94..21db5640 100644 --- a/src/drivers/net/mtd80x.c +++ b/src/drivers/net/mtd80x.c @@ -28,7 +28,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include /* Condensed operations for readability. */ #define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) diff --git a/src/drivers/net/natsemi.c b/src/drivers/net/natsemi.c index e8f6d81c..951195f1 100644 --- a/src/drivers/net/natsemi.c +++ b/src/drivers/net/natsemi.c @@ -55,7 +55,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include /* defines */ diff --git a/src/drivers/net/ns83820.c b/src/drivers/net/ns83820.c index df9eec5a..30bf0c1c 100755 --- a/src/drivers/net/ns83820.c +++ b/src/drivers/net/ns83820.c @@ -40,7 +40,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include #if ARCH == ia64 /* Support 64-bit addressing */ #define USE_64BIT_ADDR diff --git a/src/drivers/net/ns8390.c b/src/drivers/net/ns8390.c index 6a950114..134e52ab 100644 --- a/src/drivers/net/ns8390.c +++ b/src/drivers/net/ns8390.c @@ -33,7 +33,7 @@ SMC8416 PIO support added by Andrew Bettison (andrewb@zip.com.au) on 4/3/02 #include "nic.h" #include "ns8390.h" #ifdef INCLUDE_NS8390 -#include "pci.h" +#include #else #include "isa.h" #endif diff --git a/src/drivers/net/pcnet32.c b/src/drivers/net/pcnet32.c index 569912ee..74fea5a9 100644 --- a/src/drivers/net/pcnet32.c +++ b/src/drivers/net/pcnet32.c @@ -44,7 +44,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include /* Include the time functions */ #include "timer.h" #include "mii.h" diff --git a/src/drivers/net/prism2.c b/src/drivers/net/prism2.c index 64cce88e..7ad390ff 100644 --- a/src/drivers/net/prism2.c +++ b/src/drivers/net/prism2.c @@ -18,7 +18,7 @@ $Id$ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include /* * Hard-coded SSID diff --git a/src/drivers/net/prism2_pci.c b/src/drivers/net/prism2_pci.c index 19ab74a0..f0dd9f12 100644 --- a/src/drivers/net/prism2_pci.c +++ b/src/drivers/net/prism2_pci.c @@ -14,7 +14,7 @@ $Id$ * your option) any later version. */ -#include "pci.h" +#include #include "nic.h" #define WLAN_HOSTIF WLAN_PCI diff --git a/src/drivers/net/prism2_plx.c b/src/drivers/net/prism2_plx.c index bf6fb626..64432c87 100644 --- a/src/drivers/net/prism2_plx.c +++ b/src/drivers/net/prism2_plx.c @@ -14,7 +14,7 @@ $Id$ * your option) any later version. */ -#include "pci.h" +#include #include "nic.h" #define WLAN_HOSTIF WLAN_PLX diff --git a/src/drivers/net/r8169.c b/src/drivers/net/r8169.c index af2ea06b..c11b8271 100644 --- a/src/drivers/net/r8169.c +++ b/src/drivers/net/r8169.c @@ -49,7 +49,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include #include "timer.h" #define drv_version "v1.6" diff --git a/src/drivers/net/rtl8139.c b/src/drivers/net/rtl8139.c index 10ca1365..9a155048 100644 --- a/src/drivers/net/rtl8139.c +++ b/src/drivers/net/rtl8139.c @@ -64,7 +64,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "timer.h" #define RTL_TIMEOUT (1*TICKS_PER_SEC) diff --git a/src/drivers/net/sis900.c b/src/drivers/net/sis900.c index c2cb94e8..1a79b1d4 100644 --- a/src/drivers/net/sis900.c +++ b/src/drivers/net/sis900.c @@ -45,7 +45,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "timer.h" #include "sis900.h" diff --git a/src/drivers/net/skel.c b/src/drivers/net/skel.c index 5f5fd0ba..e05239b6 100644 --- a/src/drivers/net/skel.c +++ b/src/drivers/net/skel.c @@ -15,7 +15,7 @@ Skeleton NIC driver for Etherboot /* to get the interface to the body of the program */ #include "nic.h" /* Drag in support for whichever bus(es) we want for this NIC */ -#include "pci.h" +#include #include "isa.h" #include "eisa.h" #include "isapnp.h" diff --git a/src/drivers/net/sundance.c b/src/drivers/net/sundance.c index 701f922a..9c660b9b 100644 --- a/src/drivers/net/sundance.c +++ b/src/drivers/net/sundance.c @@ -45,7 +45,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include #include "timer.h" #include "mii.h" diff --git a/src/drivers/net/tg3.c b/src/drivers/net/tg3.c index ace2dfec..cad3bdff 100644 --- a/src/drivers/net/tg3.c +++ b/src/drivers/net/tg3.c @@ -14,7 +14,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "timer.h" #include "string.h" #include "tg3.h" diff --git a/src/drivers/net/tlan.c b/src/drivers/net/tlan.c index 3c773b6a..25d66d82 100644 --- a/src/drivers/net/tlan.c +++ b/src/drivers/net/tlan.c @@ -43,7 +43,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include #include "timer.h" #include "tlan.h" diff --git a/src/drivers/net/tulip.c b/src/drivers/net/tulip.c index 864e32af..7ac02d7b 100644 --- a/src/drivers/net/tulip.c +++ b/src/drivers/net/tulip.c @@ -108,7 +108,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include /* User settable parameters */ diff --git a/src/drivers/net/via-rhine.c b/src/drivers/net/via-rhine.c index 15e5ca9b..e95d9323 100644 --- a/src/drivers/net/via-rhine.c +++ b/src/drivers/net/via-rhine.c @@ -48,7 +48,7 @@ static const char *version = "rhine.c v1.0.2 2004-10-29\n"; #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "timer.h" /* define all ioaddr */ diff --git a/src/drivers/net/via-velocity.c b/src/drivers/net/via-velocity.c index 82751905..c6a15e26 100644 --- a/src/drivers/net/via-velocity.c +++ b/src/drivers/net/via-velocity.c @@ -43,7 +43,7 @@ /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include "pci.h" +#include #include "via-velocity.h" diff --git a/src/drivers/net/w89c840.c b/src/drivers/net/w89c840.c index c3f03f9f..8d8a6ded 100644 --- a/src/drivers/net/w89c840.c +++ b/src/drivers/net/w89c840.c @@ -79,7 +79,7 @@ #include "etherboot.h" #include "nic.h" -#include "pci.h" +#include #include "timer.h" static const char *w89c840_version = "driver Version 0.94 - December 12, 2003"; diff --git a/src/include/background.h b/src/include/background.h index 24cb3201..40706cd7 100644 --- a/src/include/background.h +++ b/src/include/background.h @@ -17,7 +17,7 @@ * */ -#include "tables.h" +#include #include "ip.h" /** A background protocol */ diff --git a/src/include/console.h b/src/include/console.h index 9e13293a..32d28219 100644 --- a/src/include/console.h +++ b/src/include/console.h @@ -3,7 +3,7 @@ #include "stdint.h" #include "vsprintf.h" -#include "tables.h" +#include /** @file * diff --git a/src/include/dev.h b/src/include/dev.h index fa549deb..535181aa 100644 --- a/src/include/dev.h +++ b/src/include/dev.h @@ -5,7 +5,7 @@ #include "string.h" #include "buffer.h" #include "dhcp.h" /* for dhcp_dev_id */ -#include "tables.h" +#include #include /* @@ -202,7 +202,7 @@ struct device_driver { #define DRIVER(_name,_type_driver,_bus_driver,_bus_info, \ _probe,_disable) \ - static struct device_driver device_ ## _bus_info __device_driver = { \ + struct device_driver device_ ## _bus_info __device_driver = { \ .name = _name, \ .type_driver = &_type_driver, \ .bus_driver = &_bus_driver, \ diff --git a/src/include/errno.h b/src/include/errno.h index f96231be..d6ddcc56 100644 --- a/src/include/errno.h +++ b/src/include/errno.h @@ -125,10 +125,11 @@ #define ENOENT 0xd4 #define EAFNOSUPPORT 0xd5 #define EAGAIN 0xd6 +#define EIO 0xd7 /* Data structures and declarations */ -#include "tables.h" +#include extern int errno; diff --git a/src/include/gpxe/hello.h b/src/include/gpxe/hello.h index 23ee336f..de8127bf 100644 --- a/src/include/gpxe/hello.h +++ b/src/include/gpxe/hello.h @@ -1,5 +1,5 @@ -#ifndef _HELLO_H -#define _HELLO_H +#ifndef _GPXE_HELLO_H +#define _GPXE_HELLO_H /** @file * diff --git a/src/include/gpxe/if_arp.h b/src/include/gpxe/if_arp.h index 31e993de..5b250337 100644 --- a/src/include/gpxe/if_arp.h +++ b/src/include/gpxe/if_arp.h @@ -1,5 +1,5 @@ -#ifndef _IF_ARP_H -#define _IF_ARP_H +#ifndef _GPXE_IF_ARP_H +#define _GPXE_IF_ARP_H /** @file * @@ -97,4 +97,4 @@ static inline void * arp_target_pa ( struct arphdr *arphdr ) { return ( arp_target_ha ( arphdr ) + arphdr->ar_hln ); } -#endif /* _IF_ARP_H */ +#endif /* _GPXE_IF_ARP_H */ diff --git a/src/include/gpxe/if_ether.h b/src/include/gpxe/if_ether.h index f199220f..4d35bdf4 100644 --- a/src/include/gpxe/if_ether.h +++ b/src/include/gpxe/if_ether.h @@ -1,5 +1,5 @@ -#ifndef _IF_ETHER_H -#define _IF_ETHER_H +#ifndef _GPXE_IF_ETHER_H +#define _GPXE_IF_ETHER_H #include @@ -29,4 +29,4 @@ struct ethhdr { uint16_t h_protocol; } __attribute__ ((packed)); -#endif /* _IF_ETHER_H */ +#endif /* _GPXE_IF_ETHER_H */ diff --git a/src/include/gpxe/in.h b/src/include/gpxe/in.h index e1bdde93..08fd76e2 100644 --- a/src/include/gpxe/in.h +++ b/src/include/gpxe/in.h @@ -1,5 +1,5 @@ -#ifndef _IN_H -#define _IN_H +#ifndef _GPXE_IN_H +#define _GPXE_IN_H #include @@ -8,8 +8,11 @@ #define IP_TCP 6 #define IP_UDP 17 -/* Same after going through htonl */ -#define IP_BROADCAST 0xFFFFFFFF +#define INADDR_NONE 0xffffffff + +#define INADDR_BROADCAST 0xffffffff + +#define IN_MULTICAST(addr) ( ( (addr) & 0xf0000000 ) == 0xe0000000 ) struct in_addr { uint32_t s_addr; @@ -27,4 +30,4 @@ struct sockaddr_in { extern int inet_aton ( const char *cp, struct in_addr *inp ); extern char * inet_ntoa ( struct in_addr in ); -#endif /* _IN_H */ +#endif /* _GPXE_IN_H */ diff --git a/src/include/gpxe/ip.h b/src/include/gpxe/ip.h index 29aae517..94f906b5 100644 --- a/src/include/gpxe/ip.h +++ b/src/include/gpxe/ip.h @@ -1,5 +1,5 @@ -#ifndef _IP_H -#define _IP_H +#ifndef _GPXE_IP_H +#define _GPXE_IP_H /** @file * @@ -17,4 +17,4 @@ extern void set_gateway ( struct in_addr address ); extern void init_tcpip ( void ); extern void run_tcpip ( void ); -#endif /* _IP_H */ +#endif /* _GPXE_IP_H */ diff --git a/src/include/gpxe/iscsi.h b/src/include/gpxe/iscsi.h index 639da5e5..ab7b0a07 100644 --- a/src/include/gpxe/iscsi.h +++ b/src/include/gpxe/iscsi.h @@ -1,5 +1,5 @@ -#ifndef _ISCSI_H -#define _ISCSI_H +#ifndef _GPXE_ISCSI_H +#define _GPXE_ISCSI_H /** @file * @@ -457,4 +457,4 @@ static inline int iscsi_error ( struct iscsi_session *iscsi ) { return ( iscsi->state == ISCSI_STATE_FAILED ); } -#endif /* _ISCSI_H */ +#endif /* _GPXE_ISCSI_H */ diff --git a/src/include/pci.h b/src/include/gpxe/pci.h similarity index 97% rename from src/include/pci.h rename to src/include/gpxe/pci.h index c50b79a8..4322202c 100644 --- a/src/include/pci.h +++ b/src/include/gpxe/pci.h @@ -1,5 +1,5 @@ -#ifndef PCI_H -#define PCI_H +#ifndef _GPXEPCI_H +#define _GPXEPCI_H /* ** Support for NE2000 PCI clones added David Monro June 1997 @@ -21,8 +21,7 @@ * your option) any later version. */ -#include "stdint.h" -#include "nic.h" +#include #include "pci_ids.h" #define PCI_BUS_TYPE 1 @@ -256,7 +255,8 @@ struct pci_device { uint16_t busdevfn; uint8_t revision; uint8_t irq; -} __attribute__ (( packed )); + void *priv; +}; /* * Useful busdevfn calculations @@ -348,7 +348,6 @@ extern unsigned long pci_bar_start ( struct pci_device *pci, unsigned int bar ); extern unsigned long pci_bar_size ( struct pci_device *pci, unsigned int bar ); extern int pci_find_capability ( struct pci_device *pci, int capability ); -extern void pci_fill_nic ( struct nic *nic, struct pci_device *pci ); /* * PCI bus global definition @@ -356,4 +355,12 @@ extern void pci_fill_nic ( struct nic *nic, struct pci_device *pci ); */ extern struct bus_driver pci_driver; -#endif /* PCI_H */ +static inline void pci_set_drvdata ( struct pci_device *pci, void *priv ) { + pci->priv = priv; +} + +static inline void * pci_get_drvdata ( struct pci_device *pci ) { + return pci->priv; +} + +#endif /* _GPXE_PCI_H */ diff --git a/src/include/pci_ids.h b/src/include/gpxe/pci_ids.h similarity index 99% rename from src/include/pci_ids.h rename to src/include/gpxe/pci_ids.h index a853d4dc..075ff96b 100644 --- a/src/include/pci_ids.h +++ b/src/include/gpxe/pci_ids.h @@ -1,3 +1,6 @@ +#ifndef _GPXE_PCI_IDS_H +#define _GPXE_PCI_IDS_H + /* * PCI Class, Vendor and Device IDs * @@ -341,3 +344,5 @@ #define PCI_SUBVENDOR_ID_EXSYS 0xd84d #define PCI_VENDOR_ID_TIGERJET 0xe159 #define PCI_VENDOR_ID_ARK 0xedd8 + +#endif /* _GPXE_PCI_IDS_H */ diff --git a/src/include/gpxe/scsi.h b/src/include/gpxe/scsi.h index 05f9010c..be71bab3 100644 --- a/src/include/gpxe/scsi.h +++ b/src/include/gpxe/scsi.h @@ -1,5 +1,5 @@ -#ifndef _SCSI_H -#define _SCSI_H +#ifndef _GPXE_SCSI_H +#define _GPXE_SCSI_H #include @@ -31,4 +31,4 @@ union scsi_cdb { char bytes[16]; }; -#endif /* _SCSI_H */ +#endif /* _GPXE_SCSI_H */ diff --git a/src/include/tables.h b/src/include/gpxe/tables.h similarity index 98% rename from src/include/tables.h rename to src/include/gpxe/tables.h index c3e05e55..a565eba7 100644 --- a/src/include/tables.h +++ b/src/include/gpxe/tables.h @@ -1,5 +1,5 @@ -#ifndef TABLES_H -#define TABLES_H +#ifndef _GPXE_TABLES_H +#define _GPXE_TABLES_H /** @page ifdef_harmful #ifdef considered harmful * @@ -164,7 +164,9 @@ * */ -#include "compiler.h" /* for doxygen */ +#ifdef DOXYGEN +#define __attribute__(x) +#endif #define __table_str(x) #x #define __table_section(table,idx) \ @@ -224,4 +226,4 @@ #define __table_end(table) \ __attribute__ (( unused, __table_section_end(table) )) -#endif /* TABLES_H */ +#endif /* _GPXE_TABLES_H */ diff --git a/src/include/gpxe/tcp.h b/src/include/gpxe/tcp.h index bcb15365..0aa209b7 100644 --- a/src/include/gpxe/tcp.h +++ b/src/include/gpxe/tcp.h @@ -1,5 +1,5 @@ -#ifndef _TCP_H -#define _TCP_H +#ifndef _GPXE_TCP_H +#define _GPXE_TCP_H /** @file * @@ -99,4 +99,4 @@ extern void tcp_send ( struct tcp_connection *conn, const void *data, size_t len ); extern void tcp_close ( struct tcp_connection *conn ); -#endif /* _TCP_H */ +#endif /* _GPXE_TCP_H */ diff --git a/src/include/image.h b/src/include/image.h index 0aff17c0..3483fe09 100644 --- a/src/include/image.h +++ b/src/include/image.h @@ -3,7 +3,7 @@ #include "stdint.h" #include "io.h" -#include "tables.h" +#include #include "dev.h" struct image { diff --git a/src/include/init.h b/src/include/init.h index 0b341b8d..71311bfb 100644 --- a/src/include/init.h +++ b/src/include/init.h @@ -2,7 +2,7 @@ #define INIT_H #include "stddef.h" /* for NULL */ -#include "tables.h" +#include /* * In order to avoid having objects dragged in just because main() diff --git a/src/include/proto.h b/src/include/proto.h index 886d76e3..89b7c173 100644 --- a/src/include/proto.h +++ b/src/include/proto.h @@ -1,7 +1,7 @@ #ifndef PROTO_H #define PROTO_H -#include "tables.h" +#include #include "buffer.h" #include diff --git a/src/include/resolv.h b/src/include/resolv.h index 1c74081e..e97fd1e5 100644 --- a/src/include/resolv.h +++ b/src/include/resolv.h @@ -2,7 +2,7 @@ #define RESOLV_H #include -#include "tables.h" +#include struct resolver { const char *name; diff --git a/src/proto/nmb.c b/src/proto/nmb.c index d44c0685..ee805b17 100644 --- a/src/proto/nmb.c +++ b/src/proto/nmb.c @@ -54,7 +54,7 @@ static int nmb_resolv ( struct in_addr *addr, const char *name ) { DBG ( "NMB resolving %s\n", name ); /* Set up the query data */ - nameserver.sin_addr.s_addr = IP_BROADCAST; + nameserver.sin_addr.s_addr = INADDR_BROADCAST; nameserver.sin_port = NBNS_UDP_PORT; memset ( &query, 0, sizeof ( query ) ); query.dns.id = htons ( 1 );