From f7092040fd4aba081aad75116c2b9594149d5c66 Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Fri, 13 Jun 2003 22:07:53 +0000 Subject: More FB2 stuff git-svn-id: svn://svn.coreboot.org/coreboot/trunk@877 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/arch/ppc/include/arch/io.h | 73 +++++++++++++++++++------------------ src/arch/ppc/include/arch/pciconf.h | 9 +++++ 2 files changed, 46 insertions(+), 36 deletions(-) create mode 100644 src/arch/ppc/include/arch/pciconf.h (limited to 'src/arch/ppc/include') diff --git a/src/arch/ppc/include/arch/io.h b/src/arch/ppc/include/arch/io.h index f51f14089e..bc68239a83 100644 --- a/src/arch/ppc/include/arch/io.h +++ b/src/arch/ppc/include/arch/io.h @@ -3,7 +3,8 @@ */ #ifndef _PPC_IO_H #define _PPC_IO_H -#include + +#include #define SIO_CONFIG_RA 0x398 #define SIO_CONFIG_RD 0x399 @@ -21,12 +22,12 @@ #define _IO_BASE 0xfe000000 -#define readb(addr) in_8((volatile u8 *)(addr)) -#define writeb(b,addr) out_8((volatile u8 *)(addr), (b)) -#define readw(addr) in_le16((volatile u16 *)(addr)) -#define readl(addr) in_le32((volatile u32 *)(addr)) -#define writew(b,addr) out_le16((volatile u16 *)(addr),(b)) -#define writel(b,addr) out_le32((volatile u32 *)(addr),(b)) +#define readb(addr) in_8((volatile uint8_t *)(addr)) +#define writeb(b,addr) out_8((volatile uint8_t *)(addr), (b)) +#define readw(addr) in_le16((volatile uint16_t *)(addr)) +#define readl(addr) in_le32((volatile uint32_t *)(addr)) +#define writew(b,addr) out_le16((volatile uint16_t *)(addr),(b)) +#define writel(b,addr) out_le32((volatile uint32_t *)(addr),(b)) #define __raw_readb(addr) (*(volatile unsigned char *)(addr)) @@ -42,19 +43,19 @@ * are arrays of bytes, and byte-swapping is not appropriate in * that case. - paulus */ -#define insb(port, buf, ns) _insb((u8 *)((port)+_IO_BASE), (buf), (ns)) -#define outsb(port, buf, ns) _outsb((u8 *)((port)+_IO_BASE), (buf), (ns)) -#define insw(port, buf, ns) _insw_ns((u16 *)((port)+_IO_BASE), (buf), (ns)) -#define outsw(port, buf, ns) _outsw_ns((u16 *)((port)+_IO_BASE), (buf), (ns)) -#define insl(port, buf, nl) _insl_ns((u32 *)((port)+_IO_BASE), (buf), (nl)) -#define outsl(port, buf, nl) _outsl_ns((u32 *)((port)+_IO_BASE), (buf), (nl)) - -#define inb(port) in_8((u8 *)((port)+_IO_BASE)) -#define outb(val, port) out_8((u8 *)((port)+_IO_BASE), (val)) -#define inw(port) in_le16((u16 *)((port)+_IO_BASE)) -#define outw(val, port) out_le16((u16 *)((port)+_IO_BASE), (val)) -#define inl(port) in_le32((u32 *)((port)+_IO_BASE)) -#define outl(val, port) out_le32((u32 *)((port)+_IO_BASE), (val)) +#define insb(port, buf, ns) _insb((uint8_t *)((port)+_IO_BASE), (buf), (ns)) +#define outsb(port, buf, ns) _outsb((uint8_t *)((port)+_IO_BASE), (buf), (ns)) +#define insw(port, buf, ns) _insw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns)) +#define outsw(port, buf, ns) _outsw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns)) +#define insl(port, buf, nl) _insl_ns((uint32_t *)((port)+_IO_BASE), (buf), (nl)) +#define outsl(port, buf, nl) _outsl_ns((uint32_t *)((port)+_IO_BASE), (buf), (nl)) + +#define inb(port) in_8((uint8_t *)((port)+_IO_BASE)) +#define outb(val, port) out_8((uint8_t *)((port)+_IO_BASE), (val)) +#define inw(port) in_le16((uint16_t *)((port)+_IO_BASE)) +#define outw(val, port) out_le16((uint16_t *)((port)+_IO_BASE), (val)) +#define inl(port) in_le32((uint32_t *)((port)+_IO_BASE)) +#define outl(val, port) out_le32((uint32_t *)((port)+_IO_BASE), (val)) #define inb_p(port) inb((port)) #define outb_p(val, port) outb((val), (port)) @@ -63,26 +64,26 @@ #define inl_p(port) inl((port)) #define outl_p(val, port) outl((val), (port)) -extern void _insb(volatile u8 *port, void *buf, int ns); -extern void _outsb(volatile u8 *port, const void *buf, int ns); -extern void _insw(volatile u16 *port, void *buf, int ns); -extern void _outsw(volatile u16 *port, const void *buf, int ns); -extern void _insl(volatile u32 *port, void *buf, int nl); -extern void _outsl(volatile u32 *port, const void *buf, int nl); -extern void _insw_ns(volatile u16 *port, void *buf, int ns); -extern void _outsw_ns(volatile u16 *port, const void *buf, int ns); -extern void _insl_ns(volatile u32 *port, void *buf, int nl); -extern void _outsl_ns(volatile u32 *port, const void *buf, int nl); +extern void _insb(volatile uint8_t *port, void *buf, int ns); +extern void _outsb(volatile uint8_t *port, const void *buf, int ns); +extern void _insw(volatile uint16_t *port, void *buf, int ns); +extern void _outsw(volatile uint16_t *port, const void *buf, int ns); +extern void _insl(volatile uint32_t *port, void *buf, int nl); +extern void _outsl(volatile uint32_t *port, const void *buf, int nl); +extern void _insw_ns(volatile uint16_t *port, void *buf, int ns); +extern void _outsw_ns(volatile uint16_t *port, const void *buf, int ns); +extern void _insl_ns(volatile uint32_t *port, void *buf, int nl); +extern void _outsl_ns(volatile uint32_t *port, const void *buf, int nl); /* * The *_ns versions below don't do byte-swapping. * Neither do the standard versions now, these are just here * for older code. */ -#define insw_ns(port, buf, ns) _insw_ns((u16 *)((port)+_IO_BASE), (buf), (ns)) -#define outsw_ns(port, buf, ns) _outsw_ns((u16 *)((port)+_IO_BASE), (buf), (ns)) -#define insl_ns(port, buf, nl) _insl_ns((u32 *)((port)+_IO_BASE), (buf), (nl)) -#define outsl_ns(port, buf, nl) _outsl_ns((u32 *)((port)+_IO_BASE), (buf), (nl)) +#define insw_ns(port, buf, ns) _insw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns)) +#define outsw_ns(port, buf, ns) _outsw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns)) +#define insl_ns(port, buf, nl) _insl_ns((uint32_t *)((port)+_IO_BASE), (buf), (nl)) +#define outsl_ns(port, buf, nl) _outsl_ns((uint32_t *)((port)+_IO_BASE), (buf), (nl)) #define IO_SPACE_LIMIT ~0 @@ -180,9 +181,9 @@ extern inline void out_be32(volatile unsigned *addr, int val) __asm__ __volatile__("stw%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); } -extern inline void _insw_ns(volatile u16 *port, void *buf, int ns) +extern inline void _insw_ns(volatile uint16_t *port, void *buf, int ns) { - u16 * b = (u16 *)buf; + uint16_t * b = (uint16_t *)buf; while (ns > 0) { *b++ = readw(port); diff --git a/src/arch/ppc/include/arch/pciconf.h b/src/arch/ppc/include/arch/pciconf.h new file mode 100644 index 0000000000..8695ee2294 --- /dev/null +++ b/src/arch/ppc/include/arch/pciconf.h @@ -0,0 +1,9 @@ +#ifndef PCI_CONF_REG_INDEX + +// These are defined in the PCI spec, and hence are theoretically +// inclusive of ANYTHING that uses a PCI bus. +#define PCI_CONF_REG_INDEX 0xcf8 +#define PCI_CONF_REG_DATA 0xcfc +#define CONFIG_ADDR(bus,devfn,where) (((bus) << 16) | ((devfn) << 8) | (where)) + +#endif -- cgit v1.2.3