From 787deb4ae4964e9f0650f3f098add11d5192a5f4 Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Tue, 17 Oct 2000 22:58:51 +0000 Subject: [PATCH] Fixes so we don't use any of the standard include paths --- src/cpu/p5/cpuid.c | 2 +- src/include/cpu/p5/io.h | 2 +- src/include/pci.h | 49 +++++----------------- src/include/string.h | 13 ++++++ src/include/subr.h | 2 +- src/lib/linuxpci.c | 12 +++--- src/lib/newpci.c | 4 +- src/lib/subr.c | 3 +- src/lib/vsprintf.c | 4 +- src/southbridge/via/vt82c686/southbridge.c | 2 +- 10 files changed, 40 insertions(+), 53 deletions(-) create mode 100644 src/include/string.h diff --git a/src/cpu/p5/cpuid.c b/src/cpu/p5/cpuid.c index 32ddaa584f..031336c197 100644 --- a/src/cpu/p5/cpuid.c +++ b/src/cpu/p5/cpuid.c @@ -3,7 +3,7 @@ #include #include #ifdef i586 -#include +#include #endif #ifdef i586 diff --git a/src/include/cpu/p5/io.h b/src/include/cpu/p5/io.h index 58705c024c..50e6ad3b15 100644 --- a/src/include/cpu/p5/io.h +++ b/src/include/cpu/p5/io.h @@ -97,7 +97,7 @@ __OUTS(b) __OUTS(w) __OUTS(l) -#ifdef __KERNEL__ +#ifdef NONONONONO #include #include diff --git a/src/include/pci.h b/src/include/pci.h index 5751aa3179..e243200bff 100644 --- a/src/include/pci.h +++ b/src/include/pci.h @@ -224,7 +224,7 @@ extern void printf(char *format, ...); #define PCI_FUNC(devfn) ((devfn) & 0x07) -#include +#include /* * There is one pci_dev structure for each slot-number/function-number @@ -314,23 +314,23 @@ void pcibios_fixup(void); void pcibios_fixup_bus(struct pci_bus *); char *pcibios_setup (char *str); int pcibios_read_config_byte (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned char *val); + unsigned char where, u8 *val); int pcibios_read_config_word (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned short *val); + unsigned char where, u16 *val); int pcibios_read_config_dword (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned int *val); + unsigned char where, u32 *val); int pcibios_write_config_byte (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned char val); + unsigned char where, u8 val); int pcibios_write_config_word (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned short val); + unsigned char where, u16 val); int pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned int val); + unsigned char where, u32 val); int pcibios_debugwrite_config_byte (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned char val); + unsigned char where, u8 val); int pcibios_debugwrite_config_word (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned short val); + unsigned char where, u16 val); int pcibios_debugwrite_config_dword (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned int val); + unsigned char where, u32 val); /* Don't use these in new code, use pci_find_... instead */ @@ -376,35 +376,6 @@ void pci_enable(void); void intel_conf_writeb(unsigned long port, unsigned char value); unsigned char intel_conf_readb(unsigned long port); -#ifndef CONFIG_PCI -/* If the system does not have PCI, clearly these return errors. Define - these as simple inline functions to avoid hair in drivers. */ -extern inline int pcibios_present(void) { return 0; } - -#define _PCI_NOP(o,s,t) \ - extern inline int pcibios_##o##_config_##s## (u8 bus, u8 dfn, u8 where, t val) \ - { return PCIBIOS_FUNC_NOT_SUPPORTED; } \ - extern inline int pci_##o##_config_##s## (struct pci_dev *dev, u8 where, t val) \ - { return PCIBIOS_FUNC_NOT_SUPPORTED; } -#define _PCI_NOP_ALL(o,x) _PCI_NOP(o,byte,u8 x) \ - _PCI_NOP(o,word,u16 x) \ - _PCI_NOP(o,dword,u32 x) -_PCI_NOP_ALL(read, *) -_PCI_NOP_ALL(write,) - -extern inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, struct pci_dev *from) -{ return NULL; } - -extern inline struct pci_dev *pci_find_class(unsigned int class, struct pci_dev *from) -{ return NULL; } - -extern inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) -{ return NULL; } - -extern inline void pci_set_master(struct pci_dev *dev) -{ return; } - -#endif /* !CONFIG_PCI */ #define kmalloc(x, y) malloc(x) void *malloc(unsigned int); diff --git a/src/include/string.h b/src/include/string.h new file mode 100644 index 0000000000..a8542665c6 --- /dev/null +++ b/src/include/string.h @@ -0,0 +1,13 @@ +// yes, linux has fancy ones. We don't care. This stuff gets used +// hardly at all. And the pain of including those files is just too high. + +//extern inline void strcpy(char *dst, char *src) {while (*src) *dst++ = *src++;} + +//extern inline int strlen(char *src) { int i = 0; while (*src++) i++; return i;} +extern inline int strnlen(const char *src, int max) { + int i = 0; + while ((*src++) && (i < max)) + i++; + return i; +} + diff --git a/src/include/subr.h b/src/include/subr.h index 8295d0eb4f..3019259dee 100644 --- a/src/include/subr.h +++ b/src/include/subr.h @@ -35,7 +35,7 @@ void intel_set_mtrr(unsigned long rambase, unsigned long ramsizeK); #ifdef NEWPCI /* IRQ routing stuff */ -#include +#include #include #define PIRQ_SIGNATURE (('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24)) diff --git a/src/lib/linuxpci.c b/src/lib/linuxpci.c index 44026f4083..7ca4ce71f9 100644 --- a/src/lib/linuxpci.c +++ b/src/lib/linuxpci.c @@ -13,9 +13,11 @@ * linux source tree, so keep your mods to a minimum, please * RGM */ -#include +#include #include #include +#include +#include extern void intel_post(unsigned char value); #define DEBUG @@ -241,7 +243,7 @@ unsigned int pci_scan_bus(struct pci_bus *bus) continue; } - if ((dev = kmalloc(sizeof(*dev), GFP_ATOMIC)) == NULL) { + if ((dev = kmalloc(sizeof(*dev), GFP_ATOMIC)) == 0) { printk("PCI: out of memory.\n"); continue; } @@ -335,7 +337,7 @@ unsigned int pci_scan_bus(struct pci_bus *bus) for (dev = bus->devices; dev; dev = dev->sibling) /* If it's a bridge, scan the bus behind it. */ if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { - unsigned int buses; + u32 buses; unsigned int devfn = dev->devfn; unsigned short cr; #define NOTUSED @@ -368,7 +370,7 @@ unsigned int pci_scan_bus(struct pci_bus *bus) } #endif /* Insert it into the tree of buses. */ - if ((child = kmalloc(sizeof(*child), GFP_ATOMIC)) == NULL) { + if ((child = kmalloc(sizeof(*child), GFP_ATOMIC)) == 0) { printk("PCI: out of memory for bridge.\n"); continue; } @@ -468,7 +470,7 @@ struct pci_bus *pci_scan_peer_bridge(int bus) struct pci_bus *b; b = &pci_root; - while ((b != NULL) && (bus != 0)) { + while ((b != 0) && (bus != 0)) { if (b->number == bus) return (b); b = b->next; diff --git a/src/lib/newpci.c b/src/lib/newpci.c index da15a1704a..5de86d2783 100644 --- a/src/lib/newpci.c +++ b/src/lib/newpci.c @@ -11,9 +11,9 @@ * the wisdom of Tom's recommendations ... */ /* single-pass allocation appears to be the way to go. */ -#include +#include #undef __KERNEL__ -#include +#include #include #ifdef EMULATE diff --git a/src/lib/subr.c b/src/lib/subr.c index 7511579f07..ecc178b846 100644 --- a/src/lib/subr.c +++ b/src/lib/subr.c @@ -12,8 +12,9 @@ static char rcsid[] = "$Id$"; #include #include -#include +#include #include +#include #ifdef SERIAL_CONSOLE #include diff --git a/src/lib/vsprintf.c b/src/lib/vsprintf.c index f939bc249f..8f61013fd4 100644 --- a/src/lib/vsprintf.c +++ b/src/lib/vsprintf.c @@ -11,8 +11,8 @@ #include -#include -#include +#include +#include /* haha, don't need ctype.c */ #define isdigit(c) ((c) >= '0' && (c) <= '9') diff --git a/src/southbridge/via/vt82c686/southbridge.c b/src/southbridge/via/vt82c686/southbridge.c index 85cd3300d5..1ffc29f7f3 100644 --- a/src/southbridge/via/vt82c686/southbridge.c +++ b/src/southbridge/via/vt82c686/southbridge.c @@ -1,4 +1,4 @@ -#include +#include #include #include