Commit 551800ff authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.davemloft.net:/disk1/BK/net-2.6

into kernel.bkbits.net:/home/davem/net-2.6
parents 7e5000e4 533a071f
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -190,10 +191,6 @@ ...@@ -190,10 +191,6 @@
#define FALSE 0 #define FALSE 0
#endif #endif
#define DEBUG 0
/* /*
* Things needed by tty driver * Things needed by tty driver
*/ */
...@@ -763,9 +760,7 @@ static void siccuart_change_speed(struct SICC_info *info, struct termios *old_te ...@@ -763,9 +760,7 @@ static void siccuart_change_speed(struct SICC_info *info, struct termios *old_te
cflag = info->tty->termios->c_cflag; cflag = info->tty->termios->c_cflag;
#ifdef DEBUG pr_debug("siccuart_set_cflag(0x%x) called\n", cflag);
printk("siccuart_set_cflag(0x%x) called\n", cflag);
#endif
/* byte size and parity */ /* byte size and parity */
switch (cflag & CSIZE) { switch (cflag & CSIZE) {
case CS7: lcr_h = _LCR_PE_DISABLE | _LCR_DB_7_BITS | _LCR_SB_1_BIT; bits = 9; break; case CS7: lcr_h = _LCR_PE_DISABLE | _LCR_DB_7_BITS | _LCR_SB_1_BIT; bits = 9; break;
...@@ -1027,9 +1022,7 @@ static void siccuart_flush_buffer(struct tty_struct *tty) ...@@ -1027,9 +1022,7 @@ static void siccuart_flush_buffer(struct tty_struct *tty)
struct SICC_info *info = tty->driver_data; struct SICC_info *info = tty->driver_data;
unsigned long flags; unsigned long flags;
#ifdef DEBUG pr_debug("siccuart_flush_buffer(%d) called\n", tty->index);
printk("siccuart_flush_buffer(%d) called\n", tty->index);
#endif
save_flags(flags); cli(); save_flags(flags); cli();
info->xmit.head = info->xmit.tail = 0; info->xmit.head = info->xmit.tail = 0;
restore_flags(flags); restore_flags(flags);
...@@ -1433,9 +1426,7 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp) ...@@ -1433,9 +1426,7 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp)
state = info->state; state = info->state;
#ifdef DEBUG //pr_debug("siccuart_close() called\n");
//printk("siccuart_close() called\n");
#endif
save_flags(flags); cli(); save_flags(flags); cli();
...@@ -1544,11 +1535,9 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -1544,11 +1535,9 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout)
timeout = 2 * info->timeout; timeout = 2 * info->timeout;
expire = jiffies + timeout; expire = jiffies + timeout;
#ifdef DEBUG pr_debug("siccuart_wait_until_sent(%d), jiff=%lu, expire=%lu char_time=%lu...\n",
printk("siccuart_wait_until_sent(%d), jiff=%lu, expire=%lu char_time=%lu...\n",
tty->index, jiffies, tty->index, jiffies,
expire, char_time); expire, char_time);
#endif
while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) { while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(char_time); schedule_timeout(char_time);
...@@ -1831,9 +1820,8 @@ static int siccuart_console_read(struct console *co, const char *s, u_int count) ...@@ -1831,9 +1820,8 @@ static int siccuart_console_read(struct console *co, const char *s, u_int count)
unsigned int status; unsigned int status;
char *w; char *w;
int c; int c;
#ifdef DEBUG
printk("siccuart_console_read() called\n"); pr_debug("siccuart_console_read() called\n");
#endif
c = 0; c = 0;
w = s; w = s;
......
...@@ -609,7 +609,7 @@ config PPC_OF ...@@ -609,7 +609,7 @@ config PPC_OF
config PPC_GEN550 config PPC_GEN550
bool bool
depends on SANDPOINT || MCPN765 || SPRUCE || PPLUS || PCORE depends on SANDPOINT || MCPN765 || SPRUCE || PPLUS || PCORE || PRPMC750 || K2
default y default y
config FORCE config FORCE
......
...@@ -4,23 +4,39 @@ ...@@ -4,23 +4,39 @@
CONFIG_MMU=y CONFIG_MMU=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_HAVE_DEC_LOCK=y CONFIG_HAVE_DEC_LOCK=y
CONFIG_PPC=y
CONFIG_PPC32=y
CONFIG_GENERIC_NVRAM=y
# #
# Code maturity level options # Code maturity level options
# #
CONFIG_EXPERIMENTAL=y CONFIG_EXPERIMENTAL=y
CONFIG_CLEAN_COMPILE=y
CONFIG_STANDALONE=y
CONFIG_BROKEN_ON_SMP=y
# #
# General setup # General setup
# #
CONFIG_SWAP=y CONFIG_SWAP=y
CONFIG_SYSVIPC=y CONFIG_SYSVIPC=y
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_SYSCTL=y CONFIG_SYSCTL=y
# CONFIG_AUDIT is not set
CONFIG_LOG_BUF_SHIFT=14 CONFIG_LOG_BUF_SHIFT=14
# CONFIG_EMBEDDED is not set # CONFIG_HOTPLUG is not set
# CONFIG_IKCONFIG is not set
CONFIG_EMBEDDED=y
CONFIG_KALLSYMS=y
CONFIG_FUTEX=y CONFIG_FUTEX=y
CONFIG_EPOLL=y CONFIG_EPOLL=y
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
# #
# Loadable module support # Loadable module support
...@@ -33,24 +49,25 @@ CONFIG_OBSOLETE_MODPARM=y ...@@ -33,24 +49,25 @@ CONFIG_OBSOLETE_MODPARM=y
CONFIG_KMOD=y CONFIG_KMOD=y
# #
# Platform support # Processor
# #
CONFIG_PPC=y
CONFIG_PPC32=y
CONFIG_6xx=y CONFIG_6xx=y
# CONFIG_40x is not set # CONFIG_40x is not set
# CONFIG_44x is not set
# CONFIG_POWER3 is not set # CONFIG_POWER3 is not set
# CONFIG_POWER4 is not set
# CONFIG_8xx is not set # CONFIG_8xx is not set
# CONFIG_ALTIVEC is not set
# CONFIG_TAU is not set
# CONFIG_CPU_FREQ is not set
CONFIG_PPC_STD_MMU=y
# #
# IBM 4xx options # Platform options
# #
# CONFIG_8260 is not set
CONFIG_GENERIC_ISA_DMA=y
CONFIG_PPC_STD_MMU=y
# CONFIG_PPC_MULTIPLATFORM is not set # CONFIG_PPC_MULTIPLATFORM is not set
# CONFIG_APUS is not set # CONFIG_APUS is not set
# CONFIG_WILLOW_2 is not set # CONFIG_WILLOW is not set
# CONFIG_PCORE is not set # CONFIG_PCORE is not set
# CONFIG_POWERPMC250 is not set # CONFIG_POWERPMC250 is not set
# CONFIG_EV64260 is not set # CONFIG_EV64260 is not set
...@@ -66,34 +83,29 @@ CONFIG_PPC_STD_MMU=y ...@@ -66,34 +83,29 @@ CONFIG_PPC_STD_MMU=y
CONFIG_K2=y CONFIG_K2=y
# CONFIG_PAL4 is not set # CONFIG_PAL4 is not set
# CONFIG_GEMINI is not set # CONFIG_GEMINI is not set
# CONFIG_EST8260 is not set
# CONFIG_SBS8260 is not set
# CONFIG_RPX6 is not set
# CONFIG_TQM8260 is not set
CONFIG_PPC_GEN550=y
# CONFIG_CPC710_DATA_GATHERING is not set # CONFIG_CPC710_DATA_GATHERING is not set
# CONFIG_SMP is not set # CONFIG_SMP is not set
# CONFIG_PREEMPT is not set # CONFIG_PREEMPT is not set
# CONFIG_ALTIVEC is not set # CONFIG_HIGHMEM is not set
# CONFIG_TAU is not set CONFIG_KERNEL_ELF=y
# CONFIG_CPU_FREQ is not set CONFIG_BINFMT_ELF=y
# CONFIG_BINFMT_MISC is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="ip=on"
# #
# General setup # Bus options
# #
# CONFIG_HIGHMEM is not set CONFIG_GENERIC_ISA_DMA=y
CONFIG_PCI=y CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS=y
CONFIG_KCORE_ELF=y
CONFIG_BINFMT_ELF=y
CONFIG_KERNEL_ELF=y
# CONFIG_BINFMT_MISC is not set
# CONFIG_PCI_LEGACY_PROC is not set # CONFIG_PCI_LEGACY_PROC is not set
# CONFIG_PCI_NAMES is not set # CONFIG_PCI_NAMES is not set
# CONFIG_HOTPLUG is not set
#
# Parallel port support
#
# CONFIG_PARPORT is not set
# CONFIG_PPC601_SYNC_FIX is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="ip=on"
# #
# Advanced setup # Advanced setup
...@@ -109,15 +121,27 @@ CONFIG_KERNEL_START=0xc0000000 ...@@ -109,15 +121,27 @@ CONFIG_KERNEL_START=0xc0000000
CONFIG_TASK_SIZE=0x80000000 CONFIG_TASK_SIZE=0x80000000
CONFIG_BOOT_LOAD=0x00800000 CONFIG_BOOT_LOAD=0x00800000
#
# Device Drivers
#
#
# Generic Driver Options
#
# #
# Memory Technology Devices (MTD) # Memory Technology Devices (MTD)
# #
# CONFIG_MTD is not set # CONFIG_MTD is not set
#
# Parallel port support
#
# CONFIG_PARPORT is not set
# #
# Plug and Play support # Plug and Play support
# #
# CONFIG_PNP is not set
# #
# Block devices # Block devices
...@@ -128,53 +152,89 @@ CONFIG_BOOT_LOAD=0x00800000 ...@@ -128,53 +152,89 @@ CONFIG_BOOT_LOAD=0x00800000
# CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_DAC960 is not set
# CONFIG_BLK_DEV_UMEM is not set # CONFIG_BLK_DEV_UMEM is not set
CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
# CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_NBD is not set
# CONFIG_BLK_DEV_CARMEL is not set
CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_INITRD=y CONFIG_BLK_DEV_INITRD=y
# CONFIG_LBD is not set
# #
# Multi-device support (RAID and LVM) # ATA/ATAPI/MFM/RLL support
#
# CONFIG_MD is not set
#
# ATA/IDE/MFM/RLL support
# #
CONFIG_IDE=y CONFIG_IDE=y
#
# IDE, ATA and ATAPI Block devices
#
CONFIG_BLK_DEV_IDE=y CONFIG_BLK_DEV_IDE=y
# #
# Please see Documentation/ide.txt for help/info on IDE drives # Please see Documentation/ide.txt for help/info on IDE drives
# #
# CONFIG_BLK_DEV_HD is not set
CONFIG_BLK_DEV_IDEDISK=y CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_IDEDISK_MULTI_MODE is not set # CONFIG_IDEDISK_MULTI_MODE is not set
# CONFIG_IDEDISK_STROKE is not set # CONFIG_IDEDISK_STROKE is not set
# CONFIG_BLK_DEV_IDECD is not set # CONFIG_BLK_DEV_IDECD is not set
# CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_IDE_TASK_IOCTL is not set # CONFIG_IDE_TASK_IOCTL is not set
# CONFIG_IDE_TASKFILE_IO is not set
# #
# IDE chipset support/bugfixes # IDE chipset support/bugfixes
# #
# CONFIG_BLK_DEV_IDEPCI is not set # CONFIG_IDE_GENERIC is not set
CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_IDEPCI_SHARE_IRQ is not set
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_BLK_DEV_GENERIC is not set
# CONFIG_BLK_DEV_OPTI621 is not set
# CONFIG_BLK_DEV_SL82C105 is not set
CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
CONFIG_BLK_DEV_ADMA=y
# CONFIG_BLK_DEV_AEC62XX is not set
CONFIG_BLK_DEV_ALI15X3=y
# CONFIG_WDC_ALI15X3 is not set
# CONFIG_BLK_DEV_AMD74XX is not set
# CONFIG_BLK_DEV_CMD64X is not set
# CONFIG_BLK_DEV_TRIFLEX is not set
# CONFIG_BLK_DEV_CY82C693 is not set
# CONFIG_BLK_DEV_CS5520 is not set
# CONFIG_BLK_DEV_CS5530 is not set
# CONFIG_BLK_DEV_HPT34X is not set
# CONFIG_BLK_DEV_HPT366 is not set
# CONFIG_BLK_DEV_SC1200 is not set
# CONFIG_BLK_DEV_PIIX is not set
# CONFIG_BLK_DEV_NS87415 is not set
# CONFIG_BLK_DEV_PDC202XX_OLD is not set
# CONFIG_BLK_DEV_PDC202XX_NEW is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIIMAGE is not set
# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_IVB is not set
# CONFIG_IDEDMA_AUTO is not set
# CONFIG_BLK_DEV_HD is not set
# #
# SCSI support # SCSI device support
# #
# CONFIG_SCSI is not set # CONFIG_SCSI is not set
#
# Multi-device support (RAID and LVM)
#
# CONFIG_MD is not set
# #
# Fusion MPT device support # Fusion MPT device support
# #
# CONFIG_FUSION is not set
# #
# IEEE 1394 (FireWire) support (EXPERIMENTAL) # IEEE 1394 (FireWire) support
# #
# CONFIG_IEEE1394 is not set # CONFIG_IEEE1394 is not set
...@@ -183,6 +243,10 @@ CONFIG_BLK_DEV_IDEDISK=y ...@@ -183,6 +243,10 @@ CONFIG_BLK_DEV_IDEDISK=y
# #
# CONFIG_I2O is not set # CONFIG_I2O is not set
#
# Macintosh device drivers
#
# #
# Networking support # Networking support
# #
...@@ -194,8 +258,6 @@ CONFIG_NET=y ...@@ -194,8 +258,6 @@ CONFIG_NET=y
CONFIG_PACKET=y CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set # CONFIG_PACKET_MMAP is not set
# CONFIG_NETLINK_DEV is not set # CONFIG_NETLINK_DEV is not set
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_DEBUG is not set
CONFIG_UNIX=y CONFIG_UNIX=y
# CONFIG_NET_KEY is not set # CONFIG_NET_KEY is not set
CONFIG_INET=y CONFIG_INET=y
...@@ -208,12 +270,19 @@ CONFIG_IP_PNP_DHCP=y ...@@ -208,12 +270,19 @@ CONFIG_IP_PNP_DHCP=y
# CONFIG_NET_IPIP is not set # CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set # CONFIG_NET_IPGRE is not set
# CONFIG_ARPD is not set # CONFIG_ARPD is not set
# CONFIG_INET_ECN is not set
# CONFIG_SYN_COOKIES is not set # CONFIG_SYN_COOKIES is not set
# CONFIG_INET_AH is not set # CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set # CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set # CONFIG_INET_IPCOMP is not set
#
# IP: Virtual Server Configuration
#
# CONFIG_IP_VS is not set
# CONFIG_IPV6 is not set
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_DEBUG is not set
# #
# IP: Netfilter Configuration # IP: Netfilter Configuration
# #
...@@ -225,11 +294,13 @@ CONFIG_IP_NF_FTP=m ...@@ -225,11 +294,13 @@ CONFIG_IP_NF_FTP=m
# CONFIG_IP_NF_QUEUE is not set # CONFIG_IP_NF_QUEUE is not set
CONFIG_IP_NF_IPTABLES=m CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_MATCH_LIMIT=m CONFIG_IP_NF_MATCH_LIMIT=m
# CONFIG_IP_NF_MATCH_IPRANGE is not set
CONFIG_IP_NF_MATCH_MAC=m CONFIG_IP_NF_MATCH_MAC=m
CONFIG_IP_NF_MATCH_PKTTYPE=m CONFIG_IP_NF_MATCH_PKTTYPE=m
CONFIG_IP_NF_MATCH_MARK=m CONFIG_IP_NF_MATCH_MARK=m
CONFIG_IP_NF_MATCH_MULTIPORT=m CONFIG_IP_NF_MATCH_MULTIPORT=m
CONFIG_IP_NF_MATCH_TOS=m CONFIG_IP_NF_MATCH_TOS=m
# CONFIG_IP_NF_MATCH_RECENT is not set
CONFIG_IP_NF_MATCH_ECN=m CONFIG_IP_NF_MATCH_ECN=m
CONFIG_IP_NF_MATCH_DSCP=m CONFIG_IP_NF_MATCH_DSCP=m
CONFIG_IP_NF_MATCH_AH_ESP=m CONFIG_IP_NF_MATCH_AH_ESP=m
...@@ -239,15 +310,15 @@ CONFIG_IP_NF_MATCH_TCPMSS=m ...@@ -239,15 +310,15 @@ CONFIG_IP_NF_MATCH_TCPMSS=m
CONFIG_IP_NF_MATCH_HELPER=m CONFIG_IP_NF_MATCH_HELPER=m
CONFIG_IP_NF_MATCH_STATE=m CONFIG_IP_NF_MATCH_STATE=m
CONFIG_IP_NF_MATCH_CONNTRACK=m CONFIG_IP_NF_MATCH_CONNTRACK=m
CONFIG_IP_NF_MATCH_UNCLEAN=m
CONFIG_IP_NF_MATCH_OWNER=m CONFIG_IP_NF_MATCH_OWNER=m
CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_TARGET_MIRROR=m
CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_REDIRECT=m
# CONFIG_IP_NF_TARGET_NETMAP is not set
# CONFIG_IP_NF_TARGET_SAME is not set
# CONFIG_IP_NF_NAT_LOCAL is not set # CONFIG_IP_NF_NAT_LOCAL is not set
# CONFIG_IP_NF_NAT_SNMP_BASIC is not set # CONFIG_IP_NF_NAT_SNMP_BASIC is not set
CONFIG_IP_NF_NAT_FTP=m CONFIG_IP_NF_NAT_FTP=m
...@@ -257,21 +328,22 @@ CONFIG_IP_NF_TARGET_ULOG=m ...@@ -257,21 +328,22 @@ CONFIG_IP_NF_TARGET_ULOG=m
CONFIG_IP_NF_TARGET_TCPMSS=m CONFIG_IP_NF_TARGET_TCPMSS=m
CONFIG_IP_NF_ARPTABLES=m CONFIG_IP_NF_ARPTABLES=m
CONFIG_IP_NF_ARPFILTER=m CONFIG_IP_NF_ARPFILTER=m
# CONFIG_IP_NF_ARP_MANGLE is not set
CONFIG_IP_NF_COMPAT_IPCHAINS=m CONFIG_IP_NF_COMPAT_IPCHAINS=m
# CONFIG_IP_NF_COMPAT_IPFWADM is not set # CONFIG_IP_NF_COMPAT_IPFWADM is not set
# CONFIG_IPV6 is not set # CONFIG_IP_NF_RAW is not set
# CONFIG_XFRM_USER is not set
# #
# SCTP Configuration (EXPERIMENTAL) # SCTP Configuration (EXPERIMENTAL)
# #
CONFIG_IPV6_SCTP__=y
# CONFIG_IP_SCTP is not set # CONFIG_IP_SCTP is not set
# CONFIG_ATM is not set # CONFIG_ATM is not set
# CONFIG_BRIDGE is not set
# CONFIG_VLAN_8021Q is not set # CONFIG_VLAN_8021Q is not set
# CONFIG_LLC is not set
# CONFIG_DECNET is not set # CONFIG_DECNET is not set
# CONFIG_BRIDGE is not set # CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set # CONFIG_X25 is not set
# CONFIG_LAPB is not set # CONFIG_LAPB is not set
# CONFIG_NET_DIVERT is not set # CONFIG_NET_DIVERT is not set
...@@ -289,17 +361,21 @@ CONFIG_IPV6_SCTP__=y ...@@ -289,17 +361,21 @@ CONFIG_IPV6_SCTP__=y
# Network testing # Network testing
# #
# CONFIG_NET_PKTGEN is not set # CONFIG_NET_PKTGEN is not set
# CONFIG_NETPOLL is not set
# CONFIG_NET_POLL_CONTROLLER is not set
# CONFIG_HAMRADIO is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
CONFIG_NETDEVICES=y CONFIG_NETDEVICES=y
# CONFIG_DUMMY is not set
# CONFIG_BONDING is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# #
# ARCnet devices # ARCnet devices
# #
# CONFIG_ARCNET is not set # CONFIG_ARCNET is not set
# CONFIG_DUMMY is not set
# CONFIG_BONDING is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_ETHERTAP is not set
# #
# Ethernet (10 or 100Mbit) # Ethernet (10 or 100Mbit)
...@@ -321,6 +397,7 @@ CONFIG_NET_PCI=y ...@@ -321,6 +397,7 @@ CONFIG_NET_PCI=y
# CONFIG_AMD8111_ETH is not set # CONFIG_AMD8111_ETH is not set
# CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_B44 is not set # CONFIG_B44 is not set
# CONFIG_FORCEDETH is not set
# CONFIG_DGRS is not set # CONFIG_DGRS is not set
CONFIG_EEPRO100=y CONFIG_EEPRO100=y
# CONFIG_EEPRO100_PIO is not set # CONFIG_EEPRO100_PIO is not set
...@@ -353,51 +430,39 @@ CONFIG_EEPRO100=y ...@@ -353,51 +430,39 @@ CONFIG_EEPRO100=y
# Ethernet (10000 Mbit) # Ethernet (10000 Mbit)
# #
# CONFIG_IXGB is not set # CONFIG_IXGB is not set
# CONFIG_FDDI is not set # CONFIG_S2IO is not set
# CONFIG_HIPPI is not set
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
# #
# Wireless LAN (non-hamradio) # Token Ring devices
# #
# CONFIG_NET_RADIO is not set # CONFIG_TR is not set
# #
# Token Ring devices (depends on LLC=y) # Wireless LAN (non-hamradio)
# #
# CONFIG_RCPCI is not set # CONFIG_NET_RADIO is not set
# CONFIG_SHAPER is not set
# #
# Wan interfaces # Wan interfaces
# #
# CONFIG_WAN is not set # CONFIG_WAN is not set
# CONFIG_FDDI is not set
# # CONFIG_HIPPI is not set
# Amateur Radio support # CONFIG_PPP is not set
# # CONFIG_SLIP is not set
# CONFIG_HAMRADIO is not set # CONFIG_RCPCI is not set
# CONFIG_SHAPER is not set
# # CONFIG_NETCONSOLE is not set
# IrDA (infrared) support
#
# CONFIG_IRDA is not set
# #
# ISDN subsystem # ISDN subsystem
# #
# CONFIG_ISDN_BOOL is not set # CONFIG_ISDN is not set
# #
# Graphics support # Telephony Support
# #
# CONFIG_FB is not set # CONFIG_PHONE is not set
#
# Old CD-ROM drivers (not SCSI, not IDE)
#
# CONFIG_CD_NO_IDESCSI is not set
# #
# Input device support # Input device support
...@@ -414,18 +479,16 @@ CONFIG_EEPRO100=y ...@@ -414,18 +479,16 @@ CONFIG_EEPRO100=y
# CONFIG_GAMEPORT is not set # CONFIG_GAMEPORT is not set
CONFIG_SOUND_GAMEPORT=y CONFIG_SOUND_GAMEPORT=y
# CONFIG_SERIO is not set # CONFIG_SERIO is not set
# CONFIG_SERIO_I8042 is not set
# #
# Input Device Drivers # Input Device Drivers
# #
#
# Macintosh device drivers
#
# #
# Character devices # Character devices
# #
# CONFIG_VT is not set
# CONFIG_SERIAL_NONSTANDARD is not set # CONFIG_SERIAL_NONSTANDARD is not set
# #
...@@ -433,6 +496,7 @@ CONFIG_SOUND_GAMEPORT=y ...@@ -433,6 +496,7 @@ CONFIG_SOUND_GAMEPORT=y
# #
CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=2
# CONFIG_SERIAL_8250_EXTENDED is not set # CONFIG_SERIAL_8250_EXTENDED is not set
# #
...@@ -441,26 +505,8 @@ CONFIG_SERIAL_8250_CONSOLE=y ...@@ -441,26 +505,8 @@ CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=256 CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
#
# I2C support
#
# CONFIG_I2C is not set
#
# I2C Hardware Sensors Mainboard support
#
#
# I2C Hardware Sensors Chip support
#
# CONFIG_I2C_SENSOR is not set
#
# Mice
#
# CONFIG_BUSMOUSE is not set
# CONFIG_QIC02_TAPE is not set # CONFIG_QIC02_TAPE is not set
# #
...@@ -486,7 +532,15 @@ CONFIG_GEN_RTC=y ...@@ -486,7 +532,15 @@ CONFIG_GEN_RTC=y
# CONFIG_AGP is not set # CONFIG_AGP is not set
# CONFIG_DRM is not set # CONFIG_DRM is not set
# CONFIG_RAW_DRIVER is not set # CONFIG_RAW_DRIVER is not set
# CONFIG_HANGCHECK_TIMER is not set
#
# I2C support
#
# CONFIG_I2C is not set
#
# Misc devices
#
# #
# Multimedia devices # Multimedia devices
...@@ -498,6 +552,26 @@ CONFIG_GEN_RTC=y ...@@ -498,6 +552,26 @@ CONFIG_GEN_RTC=y
# #
# CONFIG_DVB is not set # CONFIG_DVB is not set
#
# Graphics support
#
# CONFIG_FB is not set
#
# Sound
#
# CONFIG_SOUND is not set
#
# USB support
#
# CONFIG_USB is not set
#
# USB Gadget Support
#
# CONFIG_USB_GADGET is not set
# #
# File systems # File systems
# #
...@@ -530,10 +604,12 @@ CONFIG_EXT2_FS=y ...@@ -530,10 +604,12 @@ CONFIG_EXT2_FS=y
# Pseudo filesystems # Pseudo filesystems
# #
CONFIG_PROC_FS=y CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_SYSFS=y
# CONFIG_DEVFS_FS is not set # CONFIG_DEVFS_FS is not set
CONFIG_DEVPTS_FS=y
# CONFIG_DEVPTS_FS_XATTR is not set # CONFIG_DEVPTS_FS_XATTR is not set
CONFIG_TMPFS=y CONFIG_TMPFS=y
# CONFIG_HUGETLB_PAGE is not set
CONFIG_RAMFS=y CONFIG_RAMFS=y
# #
...@@ -542,6 +618,7 @@ CONFIG_RAMFS=y ...@@ -542,6 +618,7 @@ CONFIG_RAMFS=y
# CONFIG_ADFS_FS is not set # CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set # CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set # CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set # CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set # CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set # CONFIG_EFS_FS is not set
...@@ -558,12 +635,13 @@ CONFIG_RAMFS=y ...@@ -558,12 +635,13 @@ CONFIG_RAMFS=y
CONFIG_NFS_FS=y CONFIG_NFS_FS=y
# CONFIG_NFS_V3 is not set # CONFIG_NFS_V3 is not set
# CONFIG_NFS_V4 is not set # CONFIG_NFS_V4 is not set
# CONFIG_NFS_DIRECTIO is not set
# CONFIG_NFSD is not set # CONFIG_NFSD is not set
CONFIG_ROOT_NFS=y CONFIG_ROOT_NFS=y
CONFIG_LOCKD=y CONFIG_LOCKD=y
# CONFIG_EXPORTFS is not set # CONFIG_EXPORTFS is not set
CONFIG_SUNRPC=y CONFIG_SUNRPC=y
# CONFIG_SUNRPC_GSS is not set # CONFIG_RPCSEC_GSS_KRB5 is not set
# CONFIG_SMB_FS is not set # CONFIG_SMB_FS is not set
# CONFIG_CIFS is not set # CONFIG_CIFS is not set
# CONFIG_NCP_FS is not set # CONFIG_NCP_FS is not set
...@@ -578,20 +656,9 @@ CONFIG_SUNRPC=y ...@@ -578,20 +656,9 @@ CONFIG_SUNRPC=y
CONFIG_MSDOS_PARTITION=y CONFIG_MSDOS_PARTITION=y
# #
# Sound # Native Language Support
# #
# CONFIG_SOUND is not set # CONFIG_NLS is not set
#
# USB support
#
# CONFIG_USB is not set
# CONFIG_USB_GADGET is not set
#
# Bluetooth support
#
# CONFIG_BT is not set
# #
# Library routines # Library routines
...@@ -602,7 +669,7 @@ CONFIG_MSDOS_PARTITION=y ...@@ -602,7 +669,7 @@ CONFIG_MSDOS_PARTITION=y
# Kernel hacking # Kernel hacking
# #
# CONFIG_DEBUG_KERNEL is not set # CONFIG_DEBUG_KERNEL is not set
# CONFIG_KALLSYMS is not set # CONFIG_SERIAL_TEXT_DEBUG is not set
# #
# Security options # Security options
......
...@@ -4,23 +4,39 @@ ...@@ -4,23 +4,39 @@
CONFIG_MMU=y CONFIG_MMU=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_HAVE_DEC_LOCK=y CONFIG_HAVE_DEC_LOCK=y
CONFIG_PPC=y
CONFIG_PPC32=y
CONFIG_GENERIC_NVRAM=y
# #
# Code maturity level options # Code maturity level options
# #
CONFIG_EXPERIMENTAL=y CONFIG_EXPERIMENTAL=y
CONFIG_CLEAN_COMPILE=y
CONFIG_STANDALONE=y
CONFIG_BROKEN_ON_SMP=y
# #
# General setup # General setup
# #
CONFIG_SWAP=y CONFIG_SWAP=y
CONFIG_SYSVIPC=y CONFIG_SYSVIPC=y
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_SYSCTL=y CONFIG_SYSCTL=y
# CONFIG_AUDIT is not set
CONFIG_LOG_BUF_SHIFT=14 CONFIG_LOG_BUF_SHIFT=14
# CONFIG_HOTPLUG is not set
# CONFIG_IKCONFIG is not set
CONFIG_EMBEDDED=y CONFIG_EMBEDDED=y
# CONFIG_KALLSYMS is not set
CONFIG_FUTEX=y CONFIG_FUTEX=y
# CONFIG_EPOLL is not set # CONFIG_EPOLL is not set
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
# #
# Loadable module support # Loadable module support
...@@ -33,24 +49,25 @@ CONFIG_OBSOLETE_MODPARM=y ...@@ -33,24 +49,25 @@ CONFIG_OBSOLETE_MODPARM=y
CONFIG_KMOD=y CONFIG_KMOD=y
# #
# Platform support # Processor
# #
CONFIG_PPC=y
CONFIG_PPC32=y
CONFIG_6xx=y CONFIG_6xx=y
# CONFIG_40x is not set # CONFIG_40x is not set
# CONFIG_44x is not set
# CONFIG_POWER3 is not set # CONFIG_POWER3 is not set
# CONFIG_POWER4 is not set
# CONFIG_8xx is not set # CONFIG_8xx is not set
# CONFIG_ALTIVEC is not set
# CONFIG_TAU is not set
# CONFIG_CPU_FREQ is not set
CONFIG_PPC_STD_MMU=y
# #
# IBM 4xx options # Platform options
# #
# CONFIG_8260 is not set
CONFIG_GENERIC_ISA_DMA=y
CONFIG_PPC_STD_MMU=y
# CONFIG_PPC_MULTIPLATFORM is not set # CONFIG_PPC_MULTIPLATFORM is not set
# CONFIG_APUS is not set # CONFIG_APUS is not set
# CONFIG_WILLOW_2 is not set # CONFIG_WILLOW is not set
# CONFIG_PCORE is not set # CONFIG_PCORE is not set
# CONFIG_POWERPMC250 is not set # CONFIG_POWERPMC250 is not set
# CONFIG_EV64260 is not set # CONFIG_EV64260 is not set
...@@ -66,33 +83,28 @@ CONFIG_PRPMC750=y ...@@ -66,33 +83,28 @@ CONFIG_PRPMC750=y
# CONFIG_K2 is not set # CONFIG_K2 is not set
# CONFIG_PAL4 is not set # CONFIG_PAL4 is not set
# CONFIG_GEMINI is not set # CONFIG_GEMINI is not set
# CONFIG_EST8260 is not set
# CONFIG_SBS8260 is not set
# CONFIG_RPX6 is not set
# CONFIG_TQM8260 is not set
CONFIG_PPC_GEN550=y
# CONFIG_SMP is not set # CONFIG_SMP is not set
# CONFIG_PREEMPT is not set # CONFIG_PREEMPT is not set
# CONFIG_ALTIVEC is not set # CONFIG_HIGHMEM is not set
# CONFIG_TAU is not set CONFIG_KERNEL_ELF=y
# CONFIG_CPU_FREQ is not set CONFIG_BINFMT_ELF=y
# CONFIG_BINFMT_MISC is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="ip=on"
# #
# General setup # Bus options
# #
# CONFIG_HIGHMEM is not set CONFIG_GENERIC_ISA_DMA=y
CONFIG_PCI=y CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS=y
CONFIG_KCORE_ELF=y
CONFIG_BINFMT_ELF=y
CONFIG_KERNEL_ELF=y
# CONFIG_BINFMT_MISC is not set
# CONFIG_PCI_LEGACY_PROC is not set # CONFIG_PCI_LEGACY_PROC is not set
# CONFIG_PCI_NAMES is not set # CONFIG_PCI_NAMES is not set
# CONFIG_HOTPLUG is not set
#
# Parallel port support
#
# CONFIG_PARPORT is not set
# CONFIG_PPC601_SYNC_FIX is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="ip=on"
# #
# Advanced setup # Advanced setup
...@@ -108,15 +120,27 @@ CONFIG_KERNEL_START=0xc0000000 ...@@ -108,15 +120,27 @@ CONFIG_KERNEL_START=0xc0000000
CONFIG_TASK_SIZE=0x80000000 CONFIG_TASK_SIZE=0x80000000
CONFIG_BOOT_LOAD=0x00800000 CONFIG_BOOT_LOAD=0x00800000
#
# Device Drivers
#
#
# Generic Driver Options
#
# #
# Memory Technology Devices (MTD) # Memory Technology Devices (MTD)
# #
# CONFIG_MTD is not set # CONFIG_MTD is not set
#
# Parallel port support
#
# CONFIG_PARPORT is not set
# #
# Plug and Play support # Plug and Play support
# #
# CONFIG_PNP is not set
# #
# Block devices # Block devices
...@@ -128,31 +152,34 @@ CONFIG_BOOT_LOAD=0x00800000 ...@@ -128,31 +152,34 @@ CONFIG_BOOT_LOAD=0x00800000
# CONFIG_BLK_DEV_UMEM is not set # CONFIG_BLK_DEV_UMEM is not set
# CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_LOOP is not set
# CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_NBD is not set
# CONFIG_BLK_DEV_CARMEL is not set
CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_INITRD=y CONFIG_BLK_DEV_INITRD=y
# CONFIG_LBD is not set
# #
# Multi-device support (RAID and LVM) # ATA/ATAPI/MFM/RLL support
# #
# CONFIG_MD is not set # CONFIG_IDE is not set
# #
# ATA/IDE/MFM/RLL support # SCSI device support
# #
# CONFIG_IDE is not set # CONFIG_SCSI is not set
# #
# SCSI support # Multi-device support (RAID and LVM)
# #
# CONFIG_SCSI is not set # CONFIG_MD is not set
# #
# Fusion MPT device support # Fusion MPT device support
# #
# CONFIG_FUSION is not set
# #
# IEEE 1394 (FireWire) support (EXPERIMENTAL) # IEEE 1394 (FireWire) support
# #
# CONFIG_IEEE1394 is not set # CONFIG_IEEE1394 is not set
...@@ -161,6 +188,10 @@ CONFIG_BLK_DEV_INITRD=y ...@@ -161,6 +188,10 @@ CONFIG_BLK_DEV_INITRD=y
# #
# CONFIG_I2O is not set # CONFIG_I2O is not set
#
# Macintosh device drivers
#
# #
# Networking support # Networking support
# #
...@@ -172,8 +203,6 @@ CONFIG_NET=y ...@@ -172,8 +203,6 @@ CONFIG_NET=y
CONFIG_PACKET=y CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set # CONFIG_PACKET_MMAP is not set
# CONFIG_NETLINK_DEV is not set # CONFIG_NETLINK_DEV is not set
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_DEBUG is not set
CONFIG_UNIX=y CONFIG_UNIX=y
# CONFIG_NET_KEY is not set # CONFIG_NET_KEY is not set
CONFIG_INET=y CONFIG_INET=y
...@@ -187,71 +216,24 @@ CONFIG_IP_PNP_DHCP=y ...@@ -187,71 +216,24 @@ CONFIG_IP_PNP_DHCP=y
# CONFIG_NET_IPGRE is not set # CONFIG_NET_IPGRE is not set
# CONFIG_IP_MROUTE is not set # CONFIG_IP_MROUTE is not set
# CONFIG_ARPD is not set # CONFIG_ARPD is not set
# CONFIG_INET_ECN is not set
# CONFIG_SYN_COOKIES is not set # CONFIG_SYN_COOKIES is not set
# CONFIG_INET_AH is not set # CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set # CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set # CONFIG_INET_IPCOMP is not set
#
# IP: Netfilter Configuration
#
CONFIG_IP_NF_CONNTRACK=m
CONFIG_IP_NF_FTP=m
CONFIG_IP_NF_IRC=m
# CONFIG_IP_NF_TFTP is not set
# CONFIG_IP_NF_AMANDA is not set
# CONFIG_IP_NF_QUEUE is not set
CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_MATCH_LIMIT=m
CONFIG_IP_NF_MATCH_MAC=m
CONFIG_IP_NF_MATCH_PKTTYPE=m
CONFIG_IP_NF_MATCH_MARK=m
CONFIG_IP_NF_MATCH_MULTIPORT=m
CONFIG_IP_NF_MATCH_TOS=m
CONFIG_IP_NF_MATCH_ECN=m
CONFIG_IP_NF_MATCH_DSCP=m
CONFIG_IP_NF_MATCH_AH_ESP=m
CONFIG_IP_NF_MATCH_LENGTH=m
CONFIG_IP_NF_MATCH_TTL=m
CONFIG_IP_NF_MATCH_TCPMSS=m
CONFIG_IP_NF_MATCH_HELPER=m
CONFIG_IP_NF_MATCH_STATE=m
CONFIG_IP_NF_MATCH_CONNTRACK=m
CONFIG_IP_NF_MATCH_UNCLEAN=m
CONFIG_IP_NF_MATCH_OWNER=m
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_TARGET_MIRROR=m
CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_TARGET_REDIRECT=m
# CONFIG_IP_NF_NAT_LOCAL is not set
# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
CONFIG_IP_NF_NAT_IRC=m
CONFIG_IP_NF_NAT_FTP=m
# CONFIG_IP_NF_MANGLE is not set
# CONFIG_IP_NF_TARGET_LOG is not set
CONFIG_IP_NF_TARGET_ULOG=m
CONFIG_IP_NF_TARGET_TCPMSS=m
CONFIG_IP_NF_ARPTABLES=m
CONFIG_IP_NF_ARPFILTER=m
CONFIG_IP_NF_COMPAT_IPCHAINS=m
# CONFIG_IP_NF_COMPAT_IPFWADM is not set
# CONFIG_IPV6 is not set # CONFIG_IPV6 is not set
# CONFIG_XFRM_USER is not set # CONFIG_NETFILTER is not set
# #
# SCTP Configuration (EXPERIMENTAL) # SCTP Configuration (EXPERIMENTAL)
# #
CONFIG_IPV6_SCTP__=y
# CONFIG_IP_SCTP is not set # CONFIG_IP_SCTP is not set
# CONFIG_ATM is not set # CONFIG_ATM is not set
# CONFIG_BRIDGE is not set
# CONFIG_VLAN_8021Q is not set # CONFIG_VLAN_8021Q is not set
# CONFIG_LLC is not set
# CONFIG_DECNET is not set # CONFIG_DECNET is not set
# CONFIG_BRIDGE is not set # CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set # CONFIG_X25 is not set
# CONFIG_LAPB is not set # CONFIG_LAPB is not set
# CONFIG_NET_DIVERT is not set # CONFIG_NET_DIVERT is not set
...@@ -269,17 +251,21 @@ CONFIG_IPV6_SCTP__=y ...@@ -269,17 +251,21 @@ CONFIG_IPV6_SCTP__=y
# Network testing # Network testing
# #
# CONFIG_NET_PKTGEN is not set # CONFIG_NET_PKTGEN is not set
# CONFIG_NETPOLL is not set
# CONFIG_NET_POLL_CONTROLLER is not set
# CONFIG_HAMRADIO is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
CONFIG_NETDEVICES=y CONFIG_NETDEVICES=y
# CONFIG_DUMMY is not set
# CONFIG_BONDING is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# #
# ARCnet devices # ARCnet devices
# #
# CONFIG_ARCNET is not set # CONFIG_ARCNET is not set
# CONFIG_DUMMY is not set
# CONFIG_BONDING is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_ETHERTAP is not set
# #
# Ethernet (10 or 100Mbit) # Ethernet (10 or 100Mbit)
...@@ -294,13 +280,22 @@ CONFIG_MII=y ...@@ -294,13 +280,22 @@ CONFIG_MII=y
# #
# Tulip family network device support # Tulip family network device support
# #
# CONFIG_NET_TULIP is not set CONFIG_NET_TULIP=y
# CONFIG_DE2104X is not set
CONFIG_TULIP=y
# CONFIG_TULIP_MWI is not set
CONFIG_TULIP_MMIO=y
# CONFIG_TULIP_NAPI is not set
# CONFIG_DE4X5 is not set
# CONFIG_WINBOND_840 is not set
# CONFIG_DM9102 is not set
# CONFIG_HP100 is not set # CONFIG_HP100 is not set
CONFIG_NET_PCI=y CONFIG_NET_PCI=y
# CONFIG_PCNET32 is not set # CONFIG_PCNET32 is not set
# CONFIG_AMD8111_ETH is not set # CONFIG_AMD8111_ETH is not set
# CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_B44 is not set # CONFIG_B44 is not set
# CONFIG_FORCEDETH is not set
# CONFIG_DGRS is not set # CONFIG_DGRS is not set
CONFIG_EEPRO100=y CONFIG_EEPRO100=y
# CONFIG_EEPRO100_PIO is not set # CONFIG_EEPRO100_PIO is not set
...@@ -333,60 +328,53 @@ CONFIG_EEPRO100=y ...@@ -333,60 +328,53 @@ CONFIG_EEPRO100=y
# Ethernet (10000 Mbit) # Ethernet (10000 Mbit)
# #
# CONFIG_IXGB is not set # CONFIG_IXGB is not set
# CONFIG_FDDI is not set # CONFIG_S2IO is not set
# CONFIG_HIPPI is not set
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
# #
# Wireless LAN (non-hamradio) # Token Ring devices
# #
# CONFIG_NET_RADIO is not set # CONFIG_TR is not set
# #
# Token Ring devices (depends on LLC=y) # Wireless LAN (non-hamradio)
# #
# CONFIG_RCPCI is not set # CONFIG_NET_RADIO is not set
# CONFIG_SHAPER is not set
# #
# Wan interfaces # Wan interfaces
# #
# CONFIG_WAN is not set # CONFIG_WAN is not set
# CONFIG_FDDI is not set
# # CONFIG_HIPPI is not set
# Amateur Radio support # CONFIG_PPP is not set
# # CONFIG_SLIP is not set
# CONFIG_HAMRADIO is not set # CONFIG_RCPCI is not set
# CONFIG_SHAPER is not set
# # CONFIG_NETCONSOLE is not set
# IrDA (infrared) support
#
# CONFIG_IRDA is not set
# #
# ISDN subsystem # ISDN subsystem
# #
# CONFIG_ISDN_BOOL is not set # CONFIG_ISDN is not set
#
# Graphics support
#
# CONFIG_FB is not set
# #
# Old CD-ROM drivers (not SCSI, not IDE) # Telephony Support
# #
# CONFIG_CD_NO_IDESCSI is not set # CONFIG_PHONE is not set
# #
# Input device support # Input device support
# #
# CONFIG_INPUT is not set CONFIG_INPUT=y
# #
# Userland interfaces # Userland interfaces
# #
# CONFIG_INPUT_MOUSEDEV is not set
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_TSDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_INPUT_EVBUG is not set
# #
# Input I/O drivers # Input I/O drivers
...@@ -394,18 +382,21 @@ CONFIG_EEPRO100=y ...@@ -394,18 +382,21 @@ CONFIG_EEPRO100=y
# CONFIG_GAMEPORT is not set # CONFIG_GAMEPORT is not set
CONFIG_SOUND_GAMEPORT=y CONFIG_SOUND_GAMEPORT=y
# CONFIG_SERIO is not set # CONFIG_SERIO is not set
# CONFIG_SERIO_I8042 is not set
# #
# Input Device Drivers # Input Device Drivers
# #
# CONFIG_INPUT_KEYBOARD is not set
# # CONFIG_INPUT_MOUSE is not set
# Macintosh device drivers # CONFIG_INPUT_JOYSTICK is not set
# # CONFIG_INPUT_TOUCHSCREEN is not set
# CONFIG_INPUT_MISC is not set
# #
# Character devices # Character devices
# #
# CONFIG_VT is not set
# CONFIG_SERIAL_NONSTANDARD is not set # CONFIG_SERIAL_NONSTANDARD is not set
# #
...@@ -413,6 +404,7 @@ CONFIG_SOUND_GAMEPORT=y ...@@ -413,6 +404,7 @@ CONFIG_SOUND_GAMEPORT=y
# #
CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set # CONFIG_SERIAL_8250_EXTENDED is not set
# #
...@@ -421,26 +413,8 @@ CONFIG_SERIAL_8250_CONSOLE=y ...@@ -421,26 +413,8 @@ CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=256 CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
#
# I2C support
#
# CONFIG_I2C is not set
#
# I2C Hardware Sensors Mainboard support
#
#
# I2C Hardware Sensors Chip support
#
# CONFIG_I2C_SENSOR is not set
#
# Mice
#
CONFIG_BUSMOUSE=y
# CONFIG_QIC02_TAPE is not set # CONFIG_QIC02_TAPE is not set
# #
...@@ -466,7 +440,15 @@ CONFIG_GEN_RTC=y ...@@ -466,7 +440,15 @@ CONFIG_GEN_RTC=y
# CONFIG_AGP is not set # CONFIG_AGP is not set
# CONFIG_DRM is not set # CONFIG_DRM is not set
# CONFIG_RAW_DRIVER is not set # CONFIG_RAW_DRIVER is not set
# CONFIG_HANGCHECK_TIMER is not set
#
# I2C support
#
# CONFIG_I2C is not set
#
# Misc devices
#
# #
# Multimedia devices # Multimedia devices
...@@ -478,6 +460,26 @@ CONFIG_GEN_RTC=y ...@@ -478,6 +460,26 @@ CONFIG_GEN_RTC=y
# #
# CONFIG_DVB is not set # CONFIG_DVB is not set
#
# Graphics support
#
# CONFIG_FB is not set
#
# Sound
#
# CONFIG_SOUND is not set
#
# USB support
#
# CONFIG_USB is not set
#
# USB Gadget Support
#
# CONFIG_USB_GADGET is not set
# #
# File systems # File systems
# #
...@@ -515,10 +517,12 @@ CONFIG_FS_MBCACHE=y ...@@ -515,10 +517,12 @@ CONFIG_FS_MBCACHE=y
# Pseudo filesystems # Pseudo filesystems
# #
CONFIG_PROC_FS=y CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_SYSFS=y
# CONFIG_DEVFS_FS is not set # CONFIG_DEVFS_FS is not set
CONFIG_DEVPTS_FS=y
# CONFIG_DEVPTS_FS_XATTR is not set # CONFIG_DEVPTS_FS_XATTR is not set
CONFIG_TMPFS=y CONFIG_TMPFS=y
# CONFIG_HUGETLB_PAGE is not set
CONFIG_RAMFS=y CONFIG_RAMFS=y
# #
...@@ -527,6 +531,7 @@ CONFIG_RAMFS=y ...@@ -527,6 +531,7 @@ CONFIG_RAMFS=y
# CONFIG_ADFS_FS is not set # CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set # CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set # CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set # CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set # CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set # CONFIG_EFS_FS is not set
...@@ -543,12 +548,13 @@ CONFIG_RAMFS=y ...@@ -543,12 +548,13 @@ CONFIG_RAMFS=y
CONFIG_NFS_FS=y CONFIG_NFS_FS=y
# CONFIG_NFS_V3 is not set # CONFIG_NFS_V3 is not set
# CONFIG_NFS_V4 is not set # CONFIG_NFS_V4 is not set
# CONFIG_NFS_DIRECTIO is not set
# CONFIG_NFSD is not set # CONFIG_NFSD is not set
CONFIG_ROOT_NFS=y CONFIG_ROOT_NFS=y
CONFIG_LOCKD=y CONFIG_LOCKD=y
# CONFIG_EXPORTFS is not set # CONFIG_EXPORTFS is not set
CONFIG_SUNRPC=y CONFIG_SUNRPC=y
# CONFIG_SUNRPC_GSS is not set # CONFIG_RPCSEC_GSS_KRB5 is not set
# CONFIG_SMB_FS is not set # CONFIG_SMB_FS is not set
# CONFIG_CIFS is not set # CONFIG_CIFS is not set
# CONFIG_NCP_FS is not set # CONFIG_NCP_FS is not set
...@@ -563,31 +569,20 @@ CONFIG_SUNRPC=y ...@@ -563,31 +569,20 @@ CONFIG_SUNRPC=y
CONFIG_MSDOS_PARTITION=y CONFIG_MSDOS_PARTITION=y
# #
# Sound # Native Language Support
#
# CONFIG_SOUND is not set
#
# USB support
#
# CONFIG_USB is not set
# CONFIG_USB_GADGET is not set
#
# Bluetooth support
# #
# CONFIG_BT is not set # CONFIG_NLS is not set
# #
# Library routines # Library routines
# #
# CONFIG_CRC32 is not set CONFIG_CRC32=y
# #
# Kernel hacking # Kernel hacking
# #
# CONFIG_DEBUG_KERNEL is not set # CONFIG_DEBUG_KERNEL is not set
# CONFIG_KALLSYMS is not set # CONFIG_SERIAL_TEXT_DEBUG is not set
# #
# Security options # Security options
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#define DEBUG_SIG 0 #undef DEBUG_SIG
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
......
...@@ -33,7 +33,7 @@ obj-$(CONFIG_EST8260) += est8260_setup.o ...@@ -33,7 +33,7 @@ obj-$(CONFIG_EST8260) += est8260_setup.o
obj-$(CONFIG_TQM8260) += tqm8260_setup.o obj-$(CONFIG_TQM8260) += tqm8260_setup.o
obj-$(CONFIG_EV64260) += ev64260_setup.o obj-$(CONFIG_EV64260) += ev64260_setup.o
obj-$(CONFIG_GEMINI) += gemini_pci.o gemini_setup.o gemini_prom.o obj-$(CONFIG_GEMINI) += gemini_pci.o gemini_setup.o gemini_prom.o
obj-$(CONFIG_K2) += k2_setup.o k2_pci.o obj-$(CONFIG_K2) += k2.o
obj-$(CONFIG_LOPEC) += lopec_setup.o lopec_pci.o obj-$(CONFIG_LOPEC) += lopec_setup.o lopec_pci.o
obj-$(CONFIG_MCPN765) += mcpn765.o obj-$(CONFIG_MCPN765) += mcpn765.o
obj-$(CONFIG_MENF1) += menf1_setup.o menf1_pci.o obj-$(CONFIG_MENF1) += menf1_setup.o menf1_pci.o
...@@ -42,7 +42,7 @@ obj-$(CONFIG_PAL4) += pal4_setup.o pal4_pci.o ...@@ -42,7 +42,7 @@ obj-$(CONFIG_PAL4) += pal4_setup.o pal4_pci.o
obj-$(CONFIG_PCORE) += pcore.o obj-$(CONFIG_PCORE) += pcore.o
obj-$(CONFIG_POWERPMC250) += powerpmc250.o obj-$(CONFIG_POWERPMC250) += powerpmc250.o
obj-$(CONFIG_PPLUS) += pplus.o obj-$(CONFIG_PPLUS) += pplus.o
obj-$(CONFIG_PRPMC750) += prpmc750_setup.o prpmc750_pci.o obj-$(CONFIG_PRPMC750) += prpmc750.o
obj-$(CONFIG_PRPMC800) += prpmc800_setup.o prpmc800_pci.o obj-$(CONFIG_PRPMC800) += prpmc800_setup.o prpmc800_pci.o
obj-$(CONFIG_SANDPOINT) += sandpoint.o obj-$(CONFIG_SANDPOINT) += sandpoint.o
obj-$(CONFIG_SPRUCE) += spruce.o obj-$(CONFIG_SPRUCE) += spruce.o
......
...@@ -407,6 +407,9 @@ void __init chrp_init_IRQ(void) ...@@ -407,6 +407,9 @@ void __init chrp_init_IRQ(void)
OpenPIC_NumInitSenses = NR_IRQS - NUM_8259_INTERRUPTS; OpenPIC_NumInitSenses = NR_IRQS - NUM_8259_INTERRUPTS;
openpic_init(NUM_8259_INTERRUPTS); openpic_init(NUM_8259_INTERRUPTS);
/* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
i8259_irq);
for (i = 0; i < NUM_8259_INTERRUPTS; i++) for (i = 0; i < NUM_8259_INTERRUPTS; i++)
irq_desc[i].handler = &i8259_pic; irq_desc[i].handler = &i8259_pic;
......
/* /*
* arch/ppc/platforms/k2_pci.c * arch/ppc/platforms/k2.c
* *
* PCI support for SBS K2 * Board setup routines for SBS K2
* *
* Author: Matt Porter <mporter@mvista.com> * Author: Matt Porter <mporter@mvista.com>
* *
* 2001 (c) MontaVista, Software, Inc. This file is licensed under * Updated by: Randy Vinson <rvinson@mvista.com.
*
* 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program * the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express * is licensed "as is" without any warranty of any kind, whether express
* or implied. * or implied.
*/ */
#include <linux/config.h>
#include <linux/stddef.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/errno.h>
#include <linux/reboot.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/slab.h> #include <linux/kdev_t.h>
#include <linux/types.h>
#include <asm/byteorder.h> #include <linux/major.h>
#include <linux/initrd.h>
#include <linux/console.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/irq.h>
#include <linux/seq_file.h>
#include <linux/root_dev.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/dma.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/pci-bridge.h> #include <asm/time.h>
#include <asm/i8259.h>
#include <asm/todc.h>
#include <asm/bootinfo.h>
#include <syslib/cpc710.h> #include <syslib/cpc710.h>
#include "k2.h" #include "k2.h"
#undef DEBUG extern unsigned long loops_per_jiffy;
#ifdef DEBUG extern void gen550_progress(char *, unsigned short);
#define DBG(x...) printk(x)
#else static unsigned int cpu_7xx[16] = {
#define DBG(x...) 0, 15, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
#endif /* DEBUG */ };
static unsigned int cpu_6xx[16] = {
0, 0, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 0, 12, 7, 0
};
static inline int __init static inline int __init
k2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) k2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
...@@ -41,8 +63,7 @@ k2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) ...@@ -41,8 +63,7 @@ k2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
* Check our hose index. If we are zero then we are on the * Check our hose index. If we are zero then we are on the
* local PCI hose, otherwise we are on the cPCI hose. * local PCI hose, otherwise we are on the cPCI hose.
*/ */
if (!hose->index) if (!hose->index) {
{
static char pci_irq_table[][4] = static char pci_irq_table[][4] =
/* /*
* PCI IDSEL/INTPIN->INTLINE * PCI IDSEL/INTPIN->INTLINE
...@@ -67,9 +88,7 @@ k2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) ...@@ -67,9 +88,7 @@ k2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
}; };
const long min_idsel = 3, max_idsel = 17, irqs_per_slot = 4; const long min_idsel = 3, max_idsel = 17, irqs_per_slot = 4;
return PCI_IRQ_TABLE_LOOKUP; return PCI_IRQ_TABLE_LOOKUP;
} } else {
else
{
static char pci_irq_table[][4] = static char pci_irq_table[][4] =
/* /*
* PCI IDSEL/INTPIN->INTLINE * PCI IDSEL/INTPIN->INTLINE
...@@ -98,16 +117,15 @@ void k2_pcibios_fixup(void) ...@@ -98,16 +117,15 @@ void k2_pcibios_fixup(void)
* Enable DMA support on hdc * Enable DMA support on hdc
*/ */
ide_dev = pci_find_device(PCI_VENDOR_ID_AL, ide_dev = pci_find_device(PCI_VENDOR_ID_AL,
PCI_DEVICE_ID_AL_M5229, PCI_DEVICE_ID_AL_M5229, NULL);
NULL);
if (ide_dev) { if (ide_dev) {
unsigned long ide_dma_base; unsigned long ide_dma_base;
ide_dma_base = pci_resource_start(ide_dev, 4); ide_dma_base = pci_resource_start(ide_dev, 4);
outb(0x00, ide_dma_base+0x2); outb(0x00, ide_dma_base + 0x2);
outb(0x20, ide_dma_base+0xa); outb(0x20, ide_dma_base + 0xa);
} }
#endif #endif
} }
...@@ -117,11 +135,9 @@ void k2_pcibios_fixup_resources(struct pci_dev *dev) ...@@ -117,11 +135,9 @@ void k2_pcibios_fixup_resources(struct pci_dev *dev)
int i; int i;
if ((dev->vendor == PCI_VENDOR_ID_IBM) && if ((dev->vendor == PCI_VENDOR_ID_IBM) &&
(dev->device == PCI_DEVICE_ID_IBM_CPC710_PCI64)) (dev->device == PCI_DEVICE_ID_IBM_CPC710_PCI64)) {
{ pr_debug("Fixup CPC710 resources\n");
DBG("Fixup CPC710 resources\n"); for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
for (i=0; i<DEVICE_COUNT_RESOURCE; i++)
{
dev->resource[i].start = 0; dev->resource[i].start = 0;
dev->resource[i].end = 0; dev->resource[i].end = 0;
} }
...@@ -141,37 +157,37 @@ void k2_setup_hoses(void) ...@@ -141,37 +157,37 @@ void k2_setup_hoses(void)
__raw_writel(0x808000e0, PGCHP); /* Set FPHB mode */ __raw_writel(0x808000e0, PGCHP); /* Set FPHB mode */
/* PCI32 mappings */ /* PCI32 mappings */
__raw_writel(0x00000000, K2_PCI32_BAR+PIBAR); /* PCI I/O base */ __raw_writel(0x00000000, K2_PCI32_BAR + PIBAR); /* PCI I/O base */
__raw_writel(0x00000000, K2_PCI32_BAR+PMBAR); /* PCI Mem base */ __raw_writel(0x00000000, K2_PCI32_BAR + PMBAR); /* PCI Mem base */
__raw_writel(0xf0000000, K2_PCI32_BAR+MSIZE); /* 256MB */ __raw_writel(0xf0000000, K2_PCI32_BAR + MSIZE); /* 256MB */
__raw_writel(0xfff00000, K2_PCI32_BAR+IOSIZE); /* 1MB */ __raw_writel(0xfff00000, K2_PCI32_BAR + IOSIZE); /* 1MB */
__raw_writel(0xc0000000, K2_PCI32_BAR+SMBAR); /* Base@0xc0000000 */ __raw_writel(0xc0000000, K2_PCI32_BAR + SMBAR); /* Base@0xc0000000 */
__raw_writel(0x80000000, K2_PCI32_BAR+SIBAR); /* Base@0x80000000 */ __raw_writel(0x80000000, K2_PCI32_BAR + SIBAR); /* Base@0x80000000 */
__raw_writel(0x000000c0, K2_PCI32_BAR+PSSIZE); /* 1GB space */ __raw_writel(0x000000c0, K2_PCI32_BAR + PSSIZE); /* 1GB space */
__raw_writel(0x000000c0, K2_PCI32_BAR+PPSIZE); /* 1GB space */ __raw_writel(0x000000c0, K2_PCI32_BAR + PPSIZE); /* 1GB space */
__raw_writel(0x00000000, K2_PCI32_BAR+BARPS); /* Base@0x00000000 */ __raw_writel(0x00000000, K2_PCI32_BAR + BARPS); /* Base@0x00000000 */
__raw_writel(0x00000000, K2_PCI32_BAR+BARPP); /* Base@0x00000000 */ __raw_writel(0x00000000, K2_PCI32_BAR + BARPP); /* Base@0x00000000 */
__raw_writel(0x00000080, K2_PCI32_BAR+PSBAR); /* Base@0x80 */ __raw_writel(0x00000080, K2_PCI32_BAR + PSBAR); /* Base@0x80 */
__raw_writel(0x00000000, K2_PCI32_BAR+PPBAR); __raw_writel(0x00000000, K2_PCI32_BAR + PPBAR);
__raw_writel(0xc0000000, K2_PCI32_BAR+BPMDLK); __raw_writel(0xc0000000, K2_PCI32_BAR + BPMDLK);
__raw_writel(0xd0000000, K2_PCI32_BAR+TPMDLK); __raw_writel(0xd0000000, K2_PCI32_BAR + TPMDLK);
__raw_writel(0x80000000, K2_PCI32_BAR+BIODLK); __raw_writel(0x80000000, K2_PCI32_BAR + BIODLK);
__raw_writel(0x80100000, K2_PCI32_BAR+TIODLK); __raw_writel(0x80100000, K2_PCI32_BAR + TIODLK);
__raw_writel(0xe0008000, K2_PCI32_BAR+DLKCTRL); __raw_writel(0xe0008000, K2_PCI32_BAR + DLKCTRL);
__raw_writel(0xffffffff, K2_PCI32_BAR+DLKDEV); __raw_writel(0xffffffff, K2_PCI32_BAR + DLKDEV);
/* PCI64 mappings */ /* PCI64 mappings */
__raw_writel(0x00100000, K2_PCI64_BAR+PIBAR); /* PCI I/O base */ __raw_writel(0x00100000, K2_PCI64_BAR + PIBAR); /* PCI I/O base */
__raw_writel(0x10000000, K2_PCI64_BAR+PMBAR); /* PCI Mem base */ __raw_writel(0x10000000, K2_PCI64_BAR + PMBAR); /* PCI Mem base */
__raw_writel(0xf0000000, K2_PCI64_BAR+MSIZE); /* 256MB */ __raw_writel(0xf0000000, K2_PCI64_BAR + MSIZE); /* 256MB */
__raw_writel(0xfff00000, K2_PCI64_BAR+IOSIZE); /* 1MB */ __raw_writel(0xfff00000, K2_PCI64_BAR + IOSIZE); /* 1MB */
__raw_writel(0xd0000000, K2_PCI64_BAR+SMBAR); /* Base@0xd0000000 */ __raw_writel(0xd0000000, K2_PCI64_BAR + SMBAR); /* Base@0xd0000000 */
__raw_writel(0x80100000, K2_PCI64_BAR+SIBAR); /* Base@0x80100000 */ __raw_writel(0x80100000, K2_PCI64_BAR + SIBAR); /* Base@0x80100000 */
__raw_writel(0x000000c0, K2_PCI64_BAR+PSSIZE); /* 1GB space */ __raw_writel(0x000000c0, K2_PCI64_BAR + PSSIZE); /* 1GB space */
__raw_writel(0x000000c0, K2_PCI64_BAR+PPSIZE); /* 1GB space */ __raw_writel(0x000000c0, K2_PCI64_BAR + PPSIZE); /* 1GB space */
__raw_writel(0x00000000, K2_PCI64_BAR+BARPS); /* Base@0x00000000 */ __raw_writel(0x00000000, K2_PCI64_BAR + BARPS); /* Base@0x00000000 */
__raw_writel(0x00000000, K2_PCI64_BAR+BARPP); /* Base@0x00000000 */ __raw_writel(0x00000000, K2_PCI64_BAR + BARPP); /* Base@0x00000000 */
/* Setup PCI32 hose */ /* Setup PCI32 hose */
hose_a = pcibios_alloc_controller(); hose_a = pcibios_alloc_controller();
...@@ -183,16 +199,14 @@ void k2_setup_hoses(void) ...@@ -183,16 +199,14 @@ void k2_setup_hoses(void)
hose_a->pci_mem_offset = K2_PCI32_MEM_BASE; hose_a->pci_mem_offset = K2_PCI32_MEM_BASE;
pci_init_resource(&hose_a->io_resource, pci_init_resource(&hose_a->io_resource,
K2_PCI32_LOWER_IO, K2_PCI32_LOWER_IO,
K2_PCI32_UPPER_IO, K2_PCI32_UPPER_IO,
IORESOURCE_IO, IORESOURCE_IO, "PCI32 host bridge");
"PCI32 host bridge");
pci_init_resource(&hose_a->mem_resources[0], pci_init_resource(&hose_a->mem_resources[0],
K2_PCI32_LOWER_MEM + K2_PCI32_MEM_BASE, K2_PCI32_LOWER_MEM + K2_PCI32_MEM_BASE,
K2_PCI32_UPPER_MEM + K2_PCI32_MEM_BASE, K2_PCI32_UPPER_MEM + K2_PCI32_MEM_BASE,
IORESOURCE_MEM, IORESOURCE_MEM, "PCI32 host bridge");
"PCI32 host bridge");
hose_a->io_space.start = K2_PCI32_LOWER_IO; hose_a->io_space.start = K2_PCI32_LOWER_IO;
hose_a->io_space.end = K2_PCI32_UPPER_IO; hose_a->io_space.end = K2_PCI32_UPPER_IO;
...@@ -204,89 +218,67 @@ void k2_setup_hoses(void) ...@@ -204,89 +218,67 @@ void k2_setup_hoses(void)
/* Initialize PCI32 bus registers */ /* Initialize PCI32 bus registers */
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(0, 0), PCI_DEVFN(0, 0),
CPC710_BUS_NUMBER, CPC710_BUS_NUMBER, hose_a->first_busno);
hose_a->first_busno);
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(0, 0), PCI_DEVFN(0, 0),
CPC710_SUB_BUS_NUMBER, CPC710_SUB_BUS_NUMBER, hose_a->last_busno);
hose_a->last_busno);
/* Enable PCI interrupt polling */ /* Enable PCI interrupt polling */
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(8, 0), PCI_DEVFN(8, 0), 0x45, 0x80);
0x45,
0x80);
/* Route polled PCI interrupts */ /* Route polled PCI interrupts */
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(8, 0), PCI_DEVFN(8, 0), 0x48, 0x58);
0x48,
0x58);
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(8, 0), PCI_DEVFN(8, 0), 0x49, 0x07);
0x49,
0x07);
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(8, 0), PCI_DEVFN(8, 0), 0x4a, 0x31);
0x4a,
0x31);
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(8, 0), PCI_DEVFN(8, 0), 0x4b, 0xb9);
0x4b,
0xb9);
/* route secondary IDE channel interrupt to IRQ 15 */ /* route secondary IDE channel interrupt to IRQ 15 */
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(8, 0), PCI_DEVFN(8, 0), 0x75, 0x0f);
0x75,
0x0f);
/* enable IDE controller IDSEL */ /* enable IDE controller IDSEL */
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(8, 0), PCI_DEVFN(8, 0), 0x58, 0x48);
0x58,
0x48);
/* Enable IDE function */ /* Enable IDE function */
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(17, 0), PCI_DEVFN(17, 0), 0x50, 0x03);
0x50,
0x03);
/* Set M5229 IDE controller to native mode */ /* Set M5229 IDE controller to native mode */
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(17, 0), PCI_DEVFN(17, 0), PCI_CLASS_PROG, 0xdf);
PCI_CLASS_PROG,
0xdf);
hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno); hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno);
/* Write out correct max subordinate bus number for hose A */ /* Write out correct max subordinate bus number for hose A */
early_write_config_byte(hose_a, early_write_config_byte(hose_a,
hose_a->first_busno, hose_a->first_busno,
PCI_DEVFN(0, 0), PCI_DEVFN(0, 0),
CPC710_SUB_BUS_NUMBER, CPC710_SUB_BUS_NUMBER, hose_a->last_busno);
hose_a->last_busno);
/* Only setup PCI64 hose if we are in the system slot */ /* Only setup PCI64 hose if we are in the system slot */
if (!(readb(K2_MISC_REG) & K2_SYS_SLOT_MASK)) if (!(readb(K2_MISC_REG) & K2_SYS_SLOT_MASK)) {
{
/* Setup PCI64 hose */ /* Setup PCI64 hose */
hose_b = pcibios_alloc_controller(); hose_b = pcibios_alloc_controller();
if (!hose_b) if (!hose_b)
...@@ -299,16 +291,14 @@ void k2_setup_hoses(void) ...@@ -299,16 +291,14 @@ void k2_setup_hoses(void)
hose_b->pci_mem_offset = K2_PCI32_MEM_BASE; hose_b->pci_mem_offset = K2_PCI32_MEM_BASE;
pci_init_resource(&hose_b->io_resource, pci_init_resource(&hose_b->io_resource,
K2_PCI64_LOWER_IO, K2_PCI64_LOWER_IO,
K2_PCI64_UPPER_IO, K2_PCI64_UPPER_IO,
IORESOURCE_IO, IORESOURCE_IO, "PCI64 host bridge");
"PCI64 host bridge");
pci_init_resource(&hose_b->mem_resources[0], pci_init_resource(&hose_b->mem_resources[0],
K2_PCI64_LOWER_MEM + K2_PCI32_MEM_BASE, K2_PCI64_LOWER_MEM + K2_PCI32_MEM_BASE,
K2_PCI64_UPPER_MEM + K2_PCI32_MEM_BASE, K2_PCI64_UPPER_MEM + K2_PCI32_MEM_BASE,
IORESOURCE_MEM, IORESOURCE_MEM, "PCI64 host bridge");
"PCI64 host bridge");
hose_b->io_space.start = K2_PCI64_LOWER_IO; hose_b->io_space.start = K2_PCI64_LOWER_IO;
hose_b->io_space.end = K2_PCI64_UPPER_IO; hose_b->io_space.end = K2_PCI64_UPPER_IO;
...@@ -317,38 +307,35 @@ void k2_setup_hoses(void) ...@@ -317,38 +307,35 @@ void k2_setup_hoses(void)
hose_b->io_base_virt = (void *)K2_ISA_IO_BASE; hose_b->io_base_virt = (void *)K2_ISA_IO_BASE;
setup_indirect_pci(hose_b, setup_indirect_pci(hose_b,
K2_PCI64_CONFIG_ADDR, K2_PCI64_CONFIG_ADDR, K2_PCI64_CONFIG_DATA);
K2_PCI64_CONFIG_DATA);
/* Initialize PCI64 bus registers */ /* Initialize PCI64 bus registers */
early_write_config_byte(hose_b, early_write_config_byte(hose_b,
0, 0,
PCI_DEVFN(0, 0), PCI_DEVFN(0, 0),
CPC710_SUB_BUS_NUMBER, CPC710_SUB_BUS_NUMBER, 0xff);
0xff);
early_write_config_byte(hose_b, early_write_config_byte(hose_b,
0, 0,
PCI_DEVFN(0, 0), PCI_DEVFN(0, 0),
CPC710_BUS_NUMBER, CPC710_BUS_NUMBER, hose_b->first_busno);
hose_b->first_busno);
hose_b->last_busno = pciauto_bus_scan(hose_b, hose_b->last_busno = pciauto_bus_scan(hose_b,
hose_b->first_busno); hose_b->first_busno);
/* Write out correct max subordinate bus number for hose B */ /* Write out correct max subordinate bus number for hose B */
early_write_config_byte(hose_b, early_write_config_byte(hose_b,
hose_b->first_busno, hose_b->first_busno,
PCI_DEVFN(0, 0), PCI_DEVFN(0, 0),
CPC710_SUB_BUS_NUMBER, CPC710_SUB_BUS_NUMBER,
hose_b->last_busno); hose_b->last_busno);
/* Configure PCI64 PSBAR */ /* Configure PCI64 PSBAR */
early_write_config_dword(hose_b, early_write_config_dword(hose_b,
hose_b->first_busno, hose_b->first_busno,
PCI_DEVFN(0, 0), PCI_DEVFN(0, 0),
PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_0,
K2_PCI64_SYS_MEM_BASE); K2_PCI64_SYS_MEM_BASE);
} }
/* Configure i8259 level/edge settings */ /* Configure i8259 level/edge settings */
...@@ -369,3 +356,261 @@ void k2_setup_hoses(void) ...@@ -369,3 +356,261 @@ void k2_setup_hoses(void)
ppc_md.pci_swizzle = common_swizzle; ppc_md.pci_swizzle = common_swizzle;
ppc_md.pci_map_irq = k2_map_irq; ppc_md.pci_map_irq = k2_map_irq;
} }
static int k2_get_bus_speed(void)
{
int bus_speed;
unsigned char board_id;
board_id = *(unsigned char *)K2_BOARD_ID_REG;
switch (K2_BUS_SPD(board_id)) {
case 0:
default:
bus_speed = 100000000;
break;
case 1:
bus_speed = 83333333;
break;
case 2:
bus_speed = 75000000;
break;
case 3:
bus_speed = 66666666;
break;
}
return bus_speed;
}
static int k2_get_cpu_speed(void)
{
unsigned long hid1;
int cpu_speed;
hid1 = mfspr(HID1) >> 28;
if ((mfspr(PVR) >> 16) == 8)
hid1 = cpu_7xx[hid1];
else
hid1 = cpu_6xx[hid1];
cpu_speed = k2_get_bus_speed() * hid1 / 2;
return cpu_speed;
}
static void __init k2_calibrate_decr(void)
{
int freq, divisor = 4;
/* determine processor bus speed */
freq = k2_get_bus_speed();
tb_ticks_per_jiffy = freq / HZ / divisor;
tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
}
static int k2_show_cpuinfo(struct seq_file *m)
{
unsigned char k2_geo_bits, k2_system_slot;
seq_printf(m, "vendor\t\t: SBS\n");
seq_printf(m, "machine\t\t: K2\n");
seq_printf(m, "cpu speed\t: %dMhz\n", k2_get_cpu_speed() / 1000000);
seq_printf(m, "bus speed\t: %dMhz\n", k2_get_bus_speed() / 1000000);
seq_printf(m, "memory type\t: SDRAM\n");
k2_geo_bits = readb(K2_MSIZ_GEO_REG) & K2_GEO_ADR_MASK;
k2_system_slot = !(readb(K2_MISC_REG) & K2_SYS_SLOT_MASK);
seq_printf(m, "backplane\t: %s slot board",
k2_system_slot ? "System" : "Non system");
seq_printf(m, "with geographical address %x\n", k2_geo_bits);
return 0;
}
TODC_ALLOC();
static void __init k2_setup_arch(void)
{
unsigned int cpu;
/* Setup TODC access */
TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
ioremap(K2_RTC_BASE_ADDRESS, K2_RTC_SIZE), 8);
/* init to some ~sane value until calibrate_delay() runs */
loops_per_jiffy = 50000000 / HZ;
/* make FLASH transactions higher priority than PCI to avoid deadlock */
__raw_writel(__raw_readl(SIOC1) | 0x80000000, SIOC1);
/* Set hardware to access FLASH page 2 */
__raw_writel(1 << 29, GPOUT);
/* Setup PCI host bridges */
k2_setup_hoses();
#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start)
ROOT_DEV = Root_RAM0;
else
#endif
#ifdef CONFIG_ROOT_NFS
ROOT_DEV = Root_NFS;
#else
ROOT_DEV = Root_HDC1;
#endif
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
/* Identify the system */
printk(KERN_INFO "System Identification: SBS K2 - PowerPC 750 @ "
"%d Mhz\n", k2_get_cpu_speed() / 1000000);
printk(KERN_INFO "Port by MontaVista Software, Inc. "
"(source@mvista.com)\n");
/* Identify the CPU manufacturer */
cpu = PVR_REV(mfspr(PVR));
printk(KERN_INFO "CPU manufacturer: %s [rev=%04x]\n",
(cpu & (1 << 15)) ? "IBM" : "Motorola", cpu);
}
static void k2_restart(char *cmd)
{
local_irq_disable();
/* Flip FLASH back to page 1 to access firmware image */
__raw_writel(0, GPOUT);
/* SRR0 has system reset vector, SRR1 has default MSR value */
/* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
mtspr(SRR0, 0xfff00100);
mtspr(SRR1, 0);
__asm__ __volatile__("rfi\n\t");
/* not reached */
for (;;) ;
}
static void k2_power_off(void)
{
for (;;) ;
}
static void k2_halt(void)
{
k2_restart(NULL);
}
/*
* Set BAT 3 to map PCI32 I/O space.
*/
static __inline__ void k2_set_bat(void)
{
/* wait for all outstanding memory accesses to complete */
mb();
/* setup DBATs */
mtspr(DBAT2U, 0x80001ffe);
mtspr(DBAT2L, 0x8000002a);
mtspr(DBAT3U, 0xf0001ffe);
mtspr(DBAT3L, 0xf000002a);
/* wait for updates */
mb();
}
static unsigned long __init k2_find_end_of_memory(void)
{
unsigned long total;
unsigned char msize = 7; /* Default to 128MB */
msize = K2_MEM_SIZE(readb(K2_MSIZ_GEO_REG));
switch (msize) {
case 2:
/*
* This will break without a lowered
* KERNELBASE or CONFIG_HIGHMEM on.
* It seems non 1GB builds exist yet,
* though.
*/
total = K2_MEM_SIZE_1GB;
break;
case 3:
case 4:
total = K2_MEM_SIZE_512MB;
break;
case 5:
case 6:
total = K2_MEM_SIZE_256MB;
break;
case 7:
total = K2_MEM_SIZE_128MB;
break;
default:
printk
("K2: Invalid memory size detected, defaulting to 128MB\n");
total = K2_MEM_SIZE_128MB;
break;
}
return total;
}
static void __init k2_map_io(void)
{
io_block_mapping(K2_PCI32_IO_BASE,
K2_PCI32_IO_BASE, 0x00200000, _PAGE_IO);
io_block_mapping(0xff000000, 0xff000000, 0x01000000, _PAGE_IO);
}
static void __init k2_init_irq(void)
{
int i;
for (i = 0; i < 16; i++)
irq_desc[i].handler = &i8259_pic;
i8259_init(0);
}
void __init platform_init(unsigned long r3, unsigned long r4,
unsigned long r5, unsigned long r6, unsigned long r7)
{
parse_bootinfo((struct bi_record *)(r3 + KERNELBASE));
k2_set_bat();
isa_io_base = K2_ISA_IO_BASE;
isa_mem_base = K2_ISA_MEM_BASE;
pci_dram_offset = K2_PCI32_SYS_MEM_BASE;
ppc_md.setup_arch = k2_setup_arch;
ppc_md.show_cpuinfo = k2_show_cpuinfo;
ppc_md.init_IRQ = k2_init_irq;
ppc_md.get_irq = i8259_irq;
ppc_md.find_end_of_memory = k2_find_end_of_memory;
ppc_md.setup_io_mappings = k2_map_io;
ppc_md.restart = k2_restart;
ppc_md.power_off = k2_power_off;
ppc_md.halt = k2_halt;
ppc_md.time_init = todc_time_init;
ppc_md.set_rtc_time = todc_set_rtc_time;
ppc_md.get_rtc_time = todc_get_rtc_time;
ppc_md.calibrate_decr = k2_calibrate_decr;
ppc_md.nvram_read_val = todc_direct_read_val;
ppc_md.nvram_write_val = todc_direct_write_val;
#ifdef CONFIG_SERIAL_TEXT_DEBUG
ppc_md.progress = gen550_progress;
#endif
}
/*
* arch/ppc/platforms/k2_setup.c
*
* Board setup routines for SBS K2
*
* Author: Matt Porter <mporter@mvista.com>
*
* 2001 (c) MontaVista, Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#include <linux/config.h>
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/reboot.h>
#include <linux/pci.h>
#include <linux/kdev_t.h>
#include <linux/types.h>
#include <linux/major.h>
#include <linux/initrd.h>
#include <linux/console.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/irq.h>
#include <linux/seq_file.h>
#include <linux/root_dev.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/time.h>
#include <asm/i8259.h>
#include <asm/todc.h>
#include <asm/bootinfo.h>
#include "k2.h"
extern void k2_setup_hoses(void);
extern unsigned long loops_per_jiffy;
static unsigned int cpu_7xx[16] = {
0, 15, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
};
static unsigned int cpu_6xx[16] = {
0, 0, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 0, 12, 7, 0
};
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
/* IDE functions */
static void __init
k2_ide_init_hwif_ports (hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i = 8;
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
if (ctrl_port)
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
else
hw->io_ports[IDE_CONTROL_OFFSET] =
hw->io_ports[IDE_DATA_OFFSET] + 0x206;
if (irq != NULL)
*irq = 0;
}
#endif
static int
k2_get_bus_speed(void)
{
int bus_speed;
unsigned char board_id;
board_id = *(unsigned char *)K2_BOARD_ID_REG;
switch( K2_BUS_SPD(board_id) ) {
case 0:
default:
bus_speed = 100000000;
break;
case 1:
bus_speed = 83333333;
break;
case 2:
bus_speed = 75000000;
break;
case 3:
bus_speed = 66666666;
break;
}
return bus_speed;
}
static int
k2_get_cpu_speed(void)
{
unsigned long hid1;
int cpu_speed;
hid1 = mfspr(HID1) >> 28;
if ((mfspr(PVR) >> 16) == 8)
hid1 = cpu_7xx[hid1];
else
hid1 = cpu_6xx[hid1];
cpu_speed = k2_get_bus_speed()*hid1/2;
return cpu_speed;
}
static void __init
k2_calibrate_decr(void)
{
int freq, divisor = 4;
/* determine processor bus speed */
freq = k2_get_bus_speed();
tb_ticks_per_jiffy = freq / HZ / divisor;
tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000);
}
static int
k2_show_cpuinfo(struct seq_file *m)
{
unsigned char k2_geo_bits, k2_system_slot;
seq_printf(m, "vendor\t\t: SBS\n");
seq_printf(m, "machine\t\t: K2\n");
seq_printf(m, "cpu speed\t: %dMhz\n", k2_get_cpu_speed()/1000000);
seq_printf(m, "bus speed\t: %dMhz\n", k2_get_bus_speed()/1000000);
seq_printf(m, "memory type\t: SDRAM\n");
k2_geo_bits = readb(K2_MSIZ_GEO_REG) & K2_GEO_ADR_MASK;
k2_system_slot = !(readb(K2_MISC_REG) & K2_SYS_SLOT_MASK);
seq_printf(m, "backplane\t: %s slot board",
k2_system_slot ? "System" : "Non system");
seq_printf(m, "with geographical address %x\n", k2_geo_bits);
return 0;
}
extern char cmd_line[];
TODC_ALLOC();
static void __init
k2_setup_arch(void)
{
unsigned int cpu;
/* Setup TODC access */
TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
ioremap(K2_RTC_BASE_ADDRESS, K2_RTC_SIZE),
8);
/* init to some ~sane value until calibrate_delay() runs */
loops_per_jiffy = 50000000/HZ;
/* Setup PCI host bridges */
k2_setup_hoses();
#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start)
ROOT_DEV = Root_RAM0;
else
#endif
#ifdef CONFIG_ROOT_NFS
ROOT_DEV = Root_NFS;
#else
ROOT_DEV = Root_HDC1;
#endif
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
/* Identify the system */
printk("System Identification: SBS K2 - PowerPC 750 @ %d Mhz\n", k2_get_cpu_speed()/1000000);
printk("SBS K2 port (C) 2001 MontaVista Software, Inc. (source@mvista.com)\n");
/* Identify the CPU manufacturer */
cpu = PVR_REV(mfspr(PVR));
printk("CPU manufacturer: %s [rev=%04x]\n", (cpu & (1<<15)) ? "IBM" :
"Motorola", cpu);
}
static void
k2_restart(char *cmd)
{
local_irq_disable();
/* SRR0 has system reset vector, SRR1 has default MSR value */
/* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
__asm__ __volatile__
("lis 3,0xfff0\n\t"
"ori 3,3,0x0100\n\t"
"mtspr 26,3\n\t"
"li 3,0\n\t"
"mtspr 27,3\n\t"
"rfi\n\t");
for(;;);
}
static void
k2_power_off(void)
{
for(;;);
}
static void
k2_halt(void)
{
k2_restart(NULL);
}
/*
* Set BAT 3 to map PCI32 I/O space.
*/
static __inline__ void
k2_set_bat(void)
{
unsigned long bat3u, bat3l;
static int mapping_set = 0;
if (!mapping_set)
{
__asm__ __volatile__
("lis %0,0x8000\n\t"
"ori %1,%0,0x002a\n\t"
"ori %0,%0,0x1ffe\n\t"
"mtspr 0x21e,%0\n\t"
"mtspr 0x21f,%1\n\t"
"isync\n\t"
"sync\n\t"
: "=r" (bat3u), "=r" (bat3l));
mapping_set = 1;
}
return;
}
static unsigned long __init
k2_find_end_of_memory(void)
{
unsigned long total;
unsigned char msize = 7; /* Default to 128MB */
k2_set_bat();
msize = K2_MEM_SIZE(readb(K2_MSIZ_GEO_REG));
switch (msize)
{
case 2:
/*
* This will break without a lowered
* KERNELBASE or CONFIG_HIGHMEM on.
* It seems non 1GB builds exist yet,
* though.
*/
total = K2_MEM_SIZE_1GB;
break;
case 3:
case 4:
total = K2_MEM_SIZE_512MB;
break;
case 5:
case 6:
total = K2_MEM_SIZE_256MB;
break;
case 7:
total = K2_MEM_SIZE_128MB;
break;
default:
printk("K2: Invalid memory size detected, defaulting to 128MB\n");
total = K2_MEM_SIZE_128MB;
break;
}
return total;
}
static void __init
k2_map_io(void)
{
io_block_mapping(K2_PCI32_IO_BASE,
K2_PCI32_IO_BASE,
0x00200000,
_PAGE_IO);
io_block_mapping(0xff000000,
0xff000000,
0x01000000,
_PAGE_IO);
}
static void __init
k2_init_irq(void)
{
int i;
for ( i = 0 ; i < 16 ; i++ )
irq_desc[i].handler = &i8259_pic;
i8259_init(NULL);
}
void __init platform_init(unsigned long r3, unsigned long r4,
unsigned long r5, unsigned long r6, unsigned long r7)
{
parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
isa_io_base = K2_ISA_IO_BASE;
isa_mem_base = K2_ISA_MEM_BASE;
pci_dram_offset = K2_PCI32_SYS_MEM_BASE;
ppc_md.setup_arch = k2_setup_arch;
ppc_md.show_cpuinfo = k2_show_cpuinfo;
ppc_md.init_IRQ = k2_init_irq;
ppc_md.get_irq = i8259_irq;
ppc_md.find_end_of_memory = k2_find_end_of_memory;
ppc_md.setup_io_mappings = k2_map_io;
ppc_md.restart = k2_restart;
ppc_md.power_off = k2_power_off;
ppc_md.halt = k2_halt;
ppc_md.time_init = todc_time_init;
ppc_md.set_rtc_time = todc_set_rtc_time;
ppc_md.get_rtc_time = todc_get_rtc_time;
ppc_md.calibrate_decr = k2_calibrate_decr;
ppc_md.nvram_read_val = todc_direct_read_val;
ppc_md.nvram_write_val = todc_direct_write_val;
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.ide_init_hwif = k2_ide_init_hwif_ports;
#endif
}
...@@ -208,6 +208,9 @@ lopec_init_IRQ(void) ...@@ -208,6 +208,9 @@ lopec_init_IRQ(void)
openpic_set_sources(19, 1, OpenPIC_Addr + 0x110C0); openpic_set_sources(19, 1, OpenPIC_Addr + 0x110C0);
openpic_init(NUM_8259_INTERRUPTS); openpic_init(NUM_8259_INTERRUPTS);
/* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
&i8259_irq);
/* Map i8259 interrupts */ /* Map i8259 interrupts */
for(i = 0; i < NUM_8259_INTERRUPTS; i++) for(i = 0; i < NUM_8259_INTERRUPTS; i++)
......
...@@ -30,9 +30,6 @@ ...@@ -30,9 +30,6 @@
#include <linux/console.h> #include <linux/console.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/irq.h> #include <linux/irq.h>
#if 0
#include <linux/ide.h>
#endif
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <linux/serial.h> #include <linux/serial.h>
...@@ -385,6 +382,8 @@ mcpn765_init_IRQ(void) ...@@ -385,6 +382,8 @@ mcpn765_init_IRQ(void)
ppc_md.progress("init_irq: enter", 0); ppc_md.progress("init_irq: enter", 0);
openpic_init(NUM_8259_INTERRUPTS); openpic_init(NUM_8259_INTERRUPTS);
openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
i8259_irq);
for(i=0; i < NUM_8259_INTERRUPTS; i++) for(i=0; i < NUM_8259_INTERRUPTS; i++)
irq_desc[i].handler = &i8259_pic; irq_desc[i].handler = &i8259_pic;
......
...@@ -138,6 +138,7 @@ mvme5100_init_IRQ(void) ...@@ -138,6 +138,7 @@ mvme5100_init_IRQ(void)
#ifdef CONFIG_MVME5100_IPMC761_PRESENT #ifdef CONFIG_MVME5100_IPMC761_PRESENT
openpic_init(1, NUM_8259_INTERRUPTS, NULL, -1); openpic_init(1, NUM_8259_INTERRUPTS, NULL, -1);
openpic_hookup_cascade(NUM_8259_INTERRUPTS,"82c59 cascade",&i8259_irq);
for(i=0; i < NUM_8259_INTERRUPTS; i++) for(i=0; i < NUM_8259_INTERRUPTS; i++)
irq_desc[i].handler = &i8259_pic; irq_desc[i].handler = &i8259_pic;
......
...@@ -672,6 +672,8 @@ static void __init pplus_init_IRQ(void) ...@@ -672,6 +672,8 @@ static void __init pplus_init_IRQ(void)
openpic_set_sources(0, 16, OpenPIC_Addr + 0x10000); openpic_set_sources(0, 16, OpenPIC_Addr + 0x10000);
openpic_init(NUM_8259_INTERRUPTS); openpic_init(NUM_8259_INTERRUPTS);
openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
i8259_irq);
ppc_md.get_irq = openpic_get_irq; ppc_md.get_irq = openpic_get_irq;
} }
......
...@@ -134,6 +134,7 @@ EXPORT_SYMBOL(ppc_cs4232_dma2); ...@@ -134,6 +134,7 @@ EXPORT_SYMBOL(ppc_cs4232_dma2);
#define PREP_IBM_CAROLINA_IDE_0 0xf0 #define PREP_IBM_CAROLINA_IDE_0 0xf0
#define PREP_IBM_CAROLINA_IDE_1 0xf1 #define PREP_IBM_CAROLINA_IDE_1 0xf1
#define PREP_IBM_CAROLINA_IDE_2 0xf2 #define PREP_IBM_CAROLINA_IDE_2 0xf2
#define PREP_IBM_CAROLINA_IDE_3 0xf3
/* 7248-43P */ /* 7248-43P */
#define PREP_IBM_CAROLINA_SCSI_0 0xf4 #define PREP_IBM_CAROLINA_SCSI_0 0xf4
#define PREP_IBM_CAROLINA_SCSI_1 0xf5 #define PREP_IBM_CAROLINA_SCSI_1 0xf5
...@@ -855,8 +856,12 @@ prep_init_IRQ(void) ...@@ -855,8 +856,12 @@ prep_init_IRQ(void)
int i; int i;
unsigned int pci_viddid, pci_did; unsigned int pci_viddid, pci_did;
if (OpenPIC_Addr != NULL) if (OpenPIC_Addr != NULL) {
openpic_init(NUM_8259_INTERRUPTS); openpic_init(NUM_8259_INTERRUPTS);
/* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
i8259_irq);
}
for ( i = 0 ; i < NUM_8259_INTERRUPTS ; i++ ) for ( i = 0 ; i < NUM_8259_INTERRUPTS ; i++ )
irq_desc[i].handler = &i8259_pic; irq_desc[i].handler = &i8259_pic;
/* If we have a Raven PCI bridge or a Hawk PCI bridge / Memory /* If we have a Raven PCI bridge or a Hawk PCI bridge / Memory
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Author: Matt Porter <mporter@mvista.com> * Author: Matt Porter <mporter@mvista.com>
* *
* 2001 (c) MontaVista, Software, Inc. This file is licensed under * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program * the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express * is licensed "as is" without any warranty of any kind, whether express
* or implied. * or implied.
...@@ -28,56 +28,156 @@ ...@@ -28,56 +28,156 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <linux/slab.h>
#include <asm/byteorder.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/pci-bridge.h>
#include <asm/uaccess.h>
#include <asm/time.h> #include <asm/time.h>
#include <platforms/prpmc750.h>
#include <asm/open_pic.h> #include <asm/open_pic.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/pplus.h> #include <asm/hawk.h>
#include "prpmc750.h"
extern void prpmc750_find_bridges(void);
extern int mpic_init(void);
extern unsigned long loops_per_jiffy; extern unsigned long loops_per_jiffy;
extern void gen550_progress(char *, unsigned short);
static u_char prpmc750_openpic_initsenses[] __initdata = static u_char prpmc750_openpic_initsenses[] __initdata =
{ {
1, /* PRPMC750_INT_HOSTINT0 */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HOSTINT0 */
1, /* PRPMC750_INT_UART */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UART */
1, /* PRPMC750_INT_DEBUGINT */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_DEBUGINT */
1, /* PRPMC750_INT_HAWK_WDT */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HAWK_WDT */
1, /* PRPMC750_INT_UNUSED */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UNUSED */
1, /* PRPMC750_INT_ABORT */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_ABORT */
1, /* PRPMC750_INT_HOSTINT1 */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HOSTINT1 */
1, /* PRPMC750_INT_HOSTINT2 */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HOSTINT2 */
1, /* PRPMC750_INT_HOSTINT3 */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_HOSTINT3 */
1, /* PRPMC750_INT_PMC_INTA */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_PMC_INTA */
1, /* PRPMC750_INT_PMC_INTB */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_PMC_INTB */
1, /* PRPMC750_INT_PMC_INTC */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_PMC_INTC */
1, /* PRPMC750_INT_PMC_INTD */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_PMC_INTD */
1, /* PRPMC750_INT_UNUSED */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UNUSED */
1, /* PRPMC750_INT_UNUSED */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UNUSED */
1, /* PRPMC750_INT_UNUSED */ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* PRPMC750_INT_UNUSED */
};
/*
* Motorola PrPMC750/PrPMC800 in PrPMCBASE or PrPMC-Carrier
* Combined irq tables. Only Base has IDSEL 14, only Carrier has 21 and 22.
*/
static inline int
prpmc_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
{
static char pci_irq_table[][4] =
/*
* PCI IDSEL/INTPIN->INTLINE
* A B C D
*/
{
{12, 0, 0, 0}, /* IDSEL 14 - Ethernet, base */
{0, 0, 0, 0}, /* IDSEL 15 - unused */
{10, 11, 12, 9}, /* IDSEL 16 - PMC A1, PMC1 */
{10, 11, 12, 9}, /* IDSEL 17 - PrPMC-A-B, PMC2-B */
{11, 12, 9, 10}, /* IDSEL 18 - PMC A1-B, PMC1-B */
{0, 0, 0, 0}, /* IDSEL 19 - unused */
{9, 10, 11, 12}, /* IDSEL 20 - P2P Bridge */
{11, 12, 9, 10}, /* IDSEL 21 - PMC A2, carrier */
{12, 9, 10, 11}, /* IDSEL 22 - PMC A2-B, carrier */
};
const long min_idsel = 14, max_idsel = 22, irqs_per_slot = 4;
return PCI_IRQ_TABLE_LOOKUP;
}; };
static int static void __init prpmc750_pcibios_fixup(void)
prpmc750_show_cpuinfo(struct seq_file *m) {
struct pci_dev *dev;
unsigned short wtmp;
/*
* Kludge to clean up after PPC6BUG which doesn't
* configure the CL5446 VGA card. Also the
* resource subsystem doesn't fixup the
* PCI mem resources on the CL5446.
*/
if ((dev = pci_find_device(PCI_VENDOR_ID_CIRRUS,
PCI_DEVICE_ID_CIRRUS_5446, 0))) {
dev->resource[0].start += PRPMC750_PCI_PHY_MEM_OFFSET;
dev->resource[0].end += PRPMC750_PCI_PHY_MEM_OFFSET;
pci_read_config_word(dev, PCI_COMMAND, &wtmp);
pci_write_config_word(dev, PCI_COMMAND, wtmp | 3);
/* Enable Color mode in MISC reg */
outb(0x03, 0x3c2);
/* Select DRAM config reg */
outb(0x0f, 0x3c4);
/* Set proper DRAM config */
outb(0xdf, 0x3c5);
}
}
void __init prpmc750_find_bridges(void)
{
struct pci_controller *hose;
hose = pcibios_alloc_controller();
if (!hose)
return;
hose->first_busno = 0;
hose->last_busno = 0xff;
hose->io_base_virt = (void *)PRPMC750_ISA_IO_BASE;
hose->pci_mem_offset = PRPMC750_PCI_PHY_MEM_OFFSET;
pci_init_resource(&hose->io_resource,
PRPMC750_PCI_IO_START,
PRPMC750_PCI_IO_END,
IORESOURCE_IO, "PCI host bridge");
pci_init_resource(&hose->mem_resources[0],
PRPMC750_PROC_PCI_MEM_START,
PRPMC750_PROC_PCI_MEM_END,
IORESOURCE_MEM, "PCI host bridge");
hose->io_space.start = PRPMC750_PCI_IO_START;
hose->io_space.end = PRPMC750_PCI_IO_END;
hose->mem_space.start = PRPMC750_PCI_MEM_START;
hose->mem_space.end = PRPMC750_PCI_MEM_END - HAWK_MPIC_SIZE;
if (hawk_init(hose, PRPMC750_HAWK_PPC_REG_BASE,
PRPMC750_PROC_PCI_MEM_START,
PRPMC750_PROC_PCI_MEM_END - HAWK_MPIC_SIZE,
PRPMC750_PROC_PCI_IO_START, PRPMC750_PROC_PCI_IO_END,
PRPMC750_PROC_PCI_MEM_END - HAWK_MPIC_SIZE + 1)
!= 0) {
printk(KERN_CRIT "Could not initialize host bridge\n");
}
hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
ppc_md.pcibios_fixup = prpmc750_pcibios_fixup;
ppc_md.pci_swizzle = common_swizzle;
ppc_md.pci_map_irq = prpmc_map_irq;
}
static int prpmc750_show_cpuinfo(struct seq_file *m)
{ {
seq_printf(m, "machine\t\t: PrPMC750\n"); seq_printf(m, "machine\t\t: PrPMC750\n");
return 0; return 0;
} }
static void __init static void __init prpmc750_setup_arch(void)
prpmc750_setup_arch(void)
{ {
/* init to some ~sane value until calibrate_delay() runs */ /* init to some ~sane value until calibrate_delay() runs */
loops_per_jiffy = 50000000/HZ; loops_per_jiffy = 50000000 / HZ;
/* Lookup PCI host bridges */ /* Lookup PCI host bridges */
prpmc750_find_bridges(); prpmc750_find_bridges();
...@@ -97,20 +197,18 @@ prpmc750_setup_arch(void) ...@@ -97,20 +197,18 @@ prpmc750_setup_arch(void)
conswitchp = &dummy_con; conswitchp = &dummy_con;
#endif #endif
/* Find and map our OpenPIC */
pplus_mpic_init(PRPMC750_PCI_MEM_OFFSET);
OpenPIC_InitSenses = prpmc750_openpic_initsenses; OpenPIC_InitSenses = prpmc750_openpic_initsenses;
OpenPIC_NumInitSenses = sizeof(prpmc750_openpic_initsenses); OpenPIC_NumInitSenses = sizeof(prpmc750_openpic_initsenses);
printk("PrPMC750 port (C) 2001 MontaVista Software, Inc. (source@mvista.com)\n"); printk(KERN_INFO "Port by MontaVista Software, Inc. "
"(source@mvista.com)\n");
} }
/* /*
* Compute the PrPMC750's bus speed using the baud clock as a * Compute the PrPMC750's bus speed using the baud clock as a
* reference. * reference.
*/ */
static unsigned long __init static unsigned long __init prpmc750_get_bus_speed(void)
prpmc750_get_bus_speed(void)
{ {
unsigned long tbl_start, tbl_end; unsigned long tbl_start, tbl_end;
unsigned long current_state, old_state, bus_speed; unsigned long current_state, old_state, bus_speed;
...@@ -138,8 +236,8 @@ prpmc750_get_bus_speed(void) ...@@ -138,8 +236,8 @@ prpmc750_get_bus_speed(void)
old_state = readb(PRPMC750_STATUS_REG) & PRPMC750_BAUDOUT_MASK; old_state = readb(PRPMC750_STATUS_REG) & PRPMC750_BAUDOUT_MASK;
do { do {
current_state = readb(PRPMC750_STATUS_REG) & current_state = readb(PRPMC750_STATUS_REG) &
PRPMC750_BAUDOUT_MASK; PRPMC750_BAUDOUT_MASK;
} while(old_state == current_state); } while (old_state == current_state);
old_state = current_state; old_state = current_state;
...@@ -153,8 +251,8 @@ prpmc750_get_bus_speed(void) ...@@ -153,8 +251,8 @@ prpmc750_get_bus_speed(void)
do { do {
do { do {
current_state = readb(PRPMC750_STATUS_REG) & current_state = readb(PRPMC750_STATUS_REG) &
PRPMC750_BAUDOUT_MASK; PRPMC750_BAUDOUT_MASK;
} while(old_state == current_state); } while (old_state == current_state);
old_state = current_state; old_state = current_state;
} while (--count); } while (--count);
...@@ -162,13 +260,12 @@ prpmc750_get_bus_speed(void) ...@@ -162,13 +260,12 @@ prpmc750_get_bus_speed(void)
tbl_end = get_tbl(); tbl_end = get_tbl();
/* Compute bus speed */ /* Compute bus speed */
bus_speed = (tbl_end-tbl_start)*128; bus_speed = (tbl_end - tbl_start) * 128;
return bus_speed; return bus_speed;
} }
static void __init static void __init prpmc750_calibrate_decr(void)
prpmc750_calibrate_decr(void)
{ {
unsigned long freq; unsigned long freq;
int divisor = 4; int divisor = 4;
...@@ -176,81 +273,60 @@ prpmc750_calibrate_decr(void) ...@@ -176,81 +273,60 @@ prpmc750_calibrate_decr(void)
freq = prpmc750_get_bus_speed(); freq = prpmc750_get_bus_speed();
tb_ticks_per_jiffy = freq / (HZ * divisor); tb_ticks_per_jiffy = freq / (HZ * divisor);
tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000); tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
} }
static void static void prpmc750_restart(char *cmd)
prpmc750_restart(char *cmd)
{ {
local_irq_disable(); local_irq_disable();
writeb(PRPMC750_MODRST_MASK, PRPMC750_MODRST_REG); writeb(PRPMC750_MODRST_MASK, PRPMC750_MODRST_REG);
while(1); while (1) ;
} }
static void static void prpmc750_halt(void)
prpmc750_halt(void)
{ {
local_irq_disable(); local_irq_disable();
while (1); while (1) ;
} }
static void static void prpmc750_power_off(void)
prpmc750_power_off(void)
{ {
prpmc750_halt(); prpmc750_halt();
} }
static void __init static void __init prpmc750_init_IRQ(void)
prpmc750_init_IRQ(void)
{ {
openpic_init(1, 0, 0, -1); openpic_init(0);
} }
/* /*
* Set BAT 3 to map 0xf0000000 to end of physical memory space. * Set BAT 3 to map 0xf0000000 to end of physical memory space.
*/ */
static __inline__ void static __inline__ void prpmc750_set_bat(void)
prpmc750_set_bat(void)
{ {
unsigned long bat3u, bat3l; mb();
static int mapping_set = 0; mtspr(DBAT1U, 0xf0001ffe);
mtspr(DBAT1L, 0xf000002a);
if (!mapping_set) mb();
{
__asm__ __volatile__(
" lis %0,0xf000\n \
ori %1,%0,0x002a\n \
ori %0,%0,0x1ffe\n \
mtspr 0x21e,%0\n \
mtspr 0x21f,%1\n \
isync\n \
sync "
: "=r" (bat3u), "=r" (bat3l));
mapping_set = 1;
}
return;
} }
/* /*
* We need to read the Falcon/Hawk memory controller * We need to read the Falcon/Hawk memory controller
* to properly determine this value * to properly determine this value
*/ */
static unsigned long __init static unsigned long __init prpmc750_find_end_of_memory(void)
prpmc750_find_end_of_memory(void)
{ {
/* Cover the Hawk registers with a BAT */
prpmc750_set_bat();
/* Read the memory size from the Hawk SMC */ /* Read the memory size from the Hawk SMC */
return pplus_get_mem_size(PRPMC750_HAWK_SMC_BASE); return hawk_get_mem_size(PRPMC750_HAWK_SMC_BASE);
} }
static void __init static void __init prpmc750_map_io(void)
prpmc750_map_io(void)
{ {
io_block_mapping(0x80000000, 0x80000000, 0x10000000, _PAGE_IO); io_block_mapping(PRPMC750_ISA_IO_BASE, PRPMC750_ISA_IO_BASE,
0x10000000, _PAGE_IO);
#if 0
io_block_mapping(0xf0000000, 0xc0000000, 0x08000000, _PAGE_IO); io_block_mapping(0xf0000000, 0xc0000000, 0x08000000, _PAGE_IO);
#endif
io_block_mapping(0xf8000000, 0xf8000000, 0x08000000, _PAGE_IO); io_block_mapping(0xf8000000, 0xf8000000, 0x08000000, _PAGE_IO);
} }
...@@ -260,25 +336,32 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -260,25 +336,32 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
{ {
parse_bootinfo(find_bootinfo()); parse_bootinfo(find_bootinfo());
/* Cover the Hawk registers with a BAT */
prpmc750_set_bat();
isa_io_base = PRPMC750_ISA_IO_BASE; isa_io_base = PRPMC750_ISA_IO_BASE;
isa_mem_base = PRPMC750_ISA_MEM_BASE; isa_mem_base = PRPMC750_ISA_MEM_BASE;
pci_dram_offset = PRPMC750_SYS_MEM_BASE; pci_dram_offset = PRPMC750_PCI_DRAM_OFFSET;
ppc_md.setup_arch = prpmc750_setup_arch; ppc_md.setup_arch = prpmc750_setup_arch;
ppc_md.show_cpuinfo = prpmc750_show_cpuinfo; ppc_md.show_cpuinfo = prpmc750_show_cpuinfo;
ppc_md.init_IRQ = prpmc750_init_IRQ; ppc_md.init_IRQ = prpmc750_init_IRQ;
ppc_md.get_irq = openpic_get_irq; ppc_md.get_irq = openpic_get_irq;
ppc_md.find_end_of_memory = prpmc750_find_end_of_memory; ppc_md.find_end_of_memory = prpmc750_find_end_of_memory;
ppc_md.setup_io_mappings = prpmc750_map_io; ppc_md.setup_io_mappings = prpmc750_map_io;
ppc_md.restart = prpmc750_restart; ppc_md.restart = prpmc750_restart;
ppc_md.power_off = prpmc750_power_off; ppc_md.power_off = prpmc750_power_off;
ppc_md.halt = prpmc750_halt; ppc_md.halt = prpmc750_halt;
/* PrPMC750 has no timekeeper part */ /* PrPMC750 has no timekeeper part */
ppc_md.time_init = NULL; ppc_md.time_init = NULL;
ppc_md.get_rtc_time = NULL; ppc_md.get_rtc_time = NULL;
ppc_md.set_rtc_time = NULL; ppc_md.set_rtc_time = NULL;
ppc_md.calibrate_decr = prpmc750_calibrate_decr; ppc_md.calibrate_decr = prpmc750_calibrate_decr;
#ifdef CONFIG_SERIAL_TEXT_DEBUG
ppc_md.progress = gen550_progress;
#endif /* CONFIG_SERIAL_TEXT_DEBUG */
} }
...@@ -19,27 +19,47 @@ ...@@ -19,27 +19,47 @@
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#define PRPMC750_PCI_CONFIG_ADDR 0x80000cf8 /*
#define PRPMC750_PCI_CONFIG_DATA 0x80000cfc * Due to limiations imposed by legacy hardware (primaryily IDE controllers),
* the PrPMC750 carrier board operates using a PReP address map.
*
* From Processor (physical) -> PCI:
* PCI Mem Space: 0xc0000000 - 0xfe000000 -> 0x00000000 - 0x3e000000 (768 MB)
* PCI I/O Space: 0x80000000 - 0x90000000 -> 0x00000000 - 0x10000000 (256 MB)
* Note: Must skip 0xfe000000-0xfe400000 for CONFIG_HIGHMEM/PKMAP area
*
* From PCI -> Processor (physical):
* System Memory: 0x80000000 -> 0x00000000
*/
#define PRPMC750_PCI_PHY_MEM_BASE 0xc0000000 #define PRPMC750_ISA_IO_BASE PREP_ISA_IO_BASE
#define PRPMC750_PCI_MEM_BASE 0xf0000000 #define PRPMC750_ISA_MEM_BASE PREP_ISA_MEM_BASE
#define PRPMC750_PCI_IO_BASE 0x80000000
#define PRPMC750_ISA_IO_BASE PRPMC750_PCI_IO_BASE /* PCI Memory space mapping info */
#define PRPMC750_ISA_MEM_BASE PRPMC750_PCI_MEM_BASE #define PRPMC750_PCI_MEM_SIZE 0x30000000U
#define PRPMC750_PCI_MEM_OFFSET PRPMC750_PCI_PHY_MEM_BASE #define PRPMC750_PROC_PCI_MEM_START PRPMC750_ISA_MEM_BASE
#define PRPMC750_PROC_PCI_MEM_END (PRPMC750_PROC_PCI_MEM_START + \
PRPMC750_PCI_MEM_SIZE - 1)
#define PRPMC750_PCI_MEM_START 0x00000000U
#define PRPMC750_PCI_MEM_END (PRPMC750_PCI_MEM_START + \
PRPMC750_PCI_MEM_SIZE - 1)
#define PRPMC750_SYS_MEM_BASE 0x80000000 /* PCI I/O space mapping info */
#define PRPMC750_PCI_IO_SIZE 0x10000000U
#define PRPMC750_PROC_PCI_IO_START PRPMC750_ISA_IO_BASE
#define PRPMC750_PROC_PCI_IO_END (PRPMC750_PROC_PCI_IO_START + \
PRPMC750_PCI_IO_SIZE - 1)
#define PRPMC750_PCI_IO_START 0x00000000U
#define PRPMC750_PCI_IO_END (PRPMC750_PCI_IO_START + \
PRPMC750_PCI_IO_SIZE - 1)
#define PRPMC750_PCI_LOWER_MEM 0x00000000 /* System memory mapping info */
#define PRPMC750_PCI_UPPER_MEM_AUTO 0x3bf7ffff #define PRPMC750_PCI_DRAM_OFFSET PREP_PCI_DRAM_OFFSET
#define PRPMC750_PCI_UPPER_MEM 0x3bffffff #define PRPMC750_PCI_PHY_MEM_OFFSET (PRPMC750_ISA_MEM_BASE-PRPMC750_PCI_MEM_START)
#define PRPMC750_PCI_LOWER_IO 0x00000000
#define PRPMC750_PCI_UPPER_IO 0x0ff7ffff
#define PRPMC750_HAWK_MPIC_BASE 0xfbf80000 /* Register address definitions */
#define PRPMC750_HAWK_SMC_BASE 0xfef80000 #define PRPMC750_HAWK_SMC_BASE 0xfef80000U
#define PRPMC750_HAWK_PPC_REG_BASE 0xfeff0000U
#define PRPMC750_BASE_BAUD 1843200 #define PRPMC750_BASE_BAUD 1843200
#define PRPMC750_SERIAL_0 0xfef88000 #define PRPMC750_SERIAL_0 0xfef88000
...@@ -61,5 +81,5 @@ ...@@ -61,5 +81,5 @@
#define PRPMC750_TBEN_REG 0xfef880c0 #define PRPMC750_TBEN_REG 0xfef880c0
#define PRPMC750_TBEN_MASK 0x01 #define PRPMC750_TBEN_MASK 0x01
#endif /* __ASM_PRPMC750_H__ */ #endif /* __ASM_PRPMC750_H__ */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/*
* arch/ppc/platforms/prpmc750_pci.c
*
* PCI support for Motorola PrPMC750
*
* Author: Matt Porter <mporter@mvista.com>
*
* 2001 (c) MontaVista, Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <asm/machdep.h>
#include <asm/pci-bridge.h>
#include <platforms/prpmc750.h>
/*
* Motorola PrPMC750/PrPMC800 in PrPMCBASE or PrPMC-Carrier
* Combined irq tables. Only Base has IDSEL 14, only Carrier has 21 and 22.
*/
static inline int
prpmc_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
{
static char pci_irq_table[][4] =
/*
* PCI IDSEL/INTPIN->INTLINE
* A B C D
*/
{
{12, 0, 0, 0}, /* IDSEL 14 - Ethernet, base */
{0, 0, 0, 0}, /* IDSEL 15 - unused */
{10, 11, 12, 9}, /* IDSEL 16 - PMC A1, PMC1 */
{10, 11, 12, 9}, /* IDSEL 17 - PrPMC-A-B, PMC2-B */
{11, 12, 9, 10}, /* IDSEL 18 - PMC A1-B, PMC1-B */
{0, 0, 0, 0}, /* IDSEL 19 - unused */
{9, 10, 11, 12}, /* IDSEL 20 - P2P Bridge */
{11, 12, 9, 10}, /* IDSEL 21 - PMC A2, carrier */
{12, 9, 10, 11}, /* IDSEL 22 - PMC A2-B, carrier */
};
const long min_idsel = 14, max_idsel = 22, irqs_per_slot = 4;
return PCI_IRQ_TABLE_LOOKUP;
};
static void __init
prpmc750_pcibios_fixup(void)
{
struct pci_dev *dev;
unsigned short wtmp;
/*
* Kludge to clean up after PPC6BUG which doesn't
* configure the CL5446 VGA card. Also the
* resource subsystem doesn't fixup the
* PCI mem resources on the CL5446.
*/
if ((dev = pci_find_device(PCI_VENDOR_ID_CIRRUS,
PCI_DEVICE_ID_CIRRUS_5446, 0)))
{
dev->resource[0].start += PRPMC750_PCI_PHY_MEM_BASE;
dev->resource[0].end += PRPMC750_PCI_PHY_MEM_BASE;
pci_read_config_word(dev,
PCI_COMMAND,
&wtmp);
pci_write_config_word(dev,
PCI_COMMAND,
wtmp|3);
/* Enable Color mode in MISC reg */
outb(0x03, 0x3c2);
/* Select DRAM config reg */
outb(0x0f, 0x3c4);
/* Set proper DRAM config */
outb(0xdf, 0x3c5);
}
}
void __init
prpmc750_find_bridges(void)
{
struct pci_controller* hose;
hose = pcibios_alloc_controller();
if (!hose)
return;
hose->first_busno = 0;
hose->last_busno = 0xff;
hose->pci_mem_offset = PRPMC750_PCI_PHY_MEM_BASE;
pci_init_resource(&hose->io_resource,
PRPMC750_PCI_LOWER_IO,
PRPMC750_PCI_UPPER_IO,
IORESOURCE_IO,
"PCI host bridge");
pci_init_resource(&hose->mem_resources[0],
PRPMC750_PCI_LOWER_MEM + PRPMC750_PCI_PHY_MEM_BASE,
PRPMC750_PCI_UPPER_MEM + PRPMC750_PCI_PHY_MEM_BASE,
IORESOURCE_MEM,
"PCI host bridge");
hose->io_space.start = PRPMC750_PCI_LOWER_IO;
hose->io_space.end = PRPMC750_PCI_UPPER_IO;
hose->mem_space.start = PRPMC750_PCI_LOWER_MEM;
hose->mem_space.end = PRPMC750_PCI_UPPER_MEM_AUTO;
hose->io_base_virt = (void *)PRPMC750_ISA_IO_BASE;
setup_indirect_pci(hose,
PRPMC750_PCI_CONFIG_ADDR,
PRPMC750_PCI_CONFIG_DATA);
/*
* Disable MPIC response to PCI I/O space (BAR 0).
* Make MPIC respond to PCI Mem space at specified address.
* (BAR 1).
*/
early_write_config_dword(hose,
0,
PCI_DEVFN(0,0),
PCI_BASE_ADDRESS_0,
0x00000000 | 0x1);
early_write_config_dword(hose,
0,
PCI_DEVFN(0,0),
PCI_BASE_ADDRESS_1,
(PRPMC750_HAWK_MPIC_BASE -
PRPMC750_PCI_MEM_OFFSET) | 0x0);
hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
ppc_md.pcibios_fixup = prpmc750_pcibios_fixup;
ppc_md.pci_swizzle = common_swizzle;
ppc_md.pci_map_irq = prpmc_map_irq;
}
...@@ -444,6 +444,8 @@ sandpoint_init_IRQ(void) ...@@ -444,6 +444,8 @@ sandpoint_init_IRQ(void)
openpic_set_sources(0, 16, OpenPIC_Addr + 0x10200); openpic_set_sources(0, 16, OpenPIC_Addr + 0x10200);
openpic_init(NUM_8259_INTERRUPTS); openpic_init(NUM_8259_INTERRUPTS);
openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
i8259_irq);
/* /*
* openpic_init() has set up irq_desc[16-31] to be openpic * openpic_init() has set up irq_desc[16-31] to be openpic
......
...@@ -39,7 +39,7 @@ obj-$(CONFIG_ADIR) += i8259.o indirect_pci.o pci_auto.o \ ...@@ -39,7 +39,7 @@ obj-$(CONFIG_ADIR) += i8259.o indirect_pci.o pci_auto.o \
obj-$(CONFIG_EBONY) += indirect_pci.o pci_auto.o todc_time.o obj-$(CONFIG_EBONY) += indirect_pci.o pci_auto.o todc_time.o
obj-$(CONFIG_EV64260) += gt64260_common.o gt64260_pic.o \ obj-$(CONFIG_EV64260) += gt64260_common.o gt64260_pic.o \
indirect_pci.o todc_time.o pci_auto.o indirect_pci.o todc_time.o pci_auto.o
obj-$(CONFIG_GEMINI) += open_pic.o i8259.o indirect_pci.o obj-$(CONFIG_GEMINI) += open_pic.o indirect_pci.o
obj-$(CONFIG_K2) += i8259.o indirect_pci.o todc_time.o \ obj-$(CONFIG_K2) += i8259.o indirect_pci.o todc_time.o \
pci_auto.o pci_auto.o
obj-$(CONFIG_LOPEC) += pci_auto.o open_pic.o i8259.o todc_time.o obj-$(CONFIG_LOPEC) += pci_auto.o open_pic.o i8259.o todc_time.o
......
...@@ -26,8 +26,10 @@ ...@@ -26,8 +26,10 @@
#define ERRC 0xff001050 #define ERRC 0xff001050
#define SESR 0xff001060 #define SESR 0xff001060
#define SEAR 0xff001070 #define SEAR 0xff001070
#define SIOC1 0xff001090
#define PGCHP 0xff001100 #define PGCHP 0xff001100
#define GPDIR 0xff001130 #define GPDIR 0xff001130
#define GPOUT 0xff001150
#define ATAS 0xff001160 #define ATAS 0xff001160
#define AVDG 0xff001170 #define AVDG 0xff001170
#define MCCR 0xff001200 #define MCCR 0xff001200
......
...@@ -48,6 +48,8 @@ static u_int NumProcessors; ...@@ -48,6 +48,8 @@ static u_int NumProcessors;
static u_int NumSources; static u_int NumSources;
static int open_pic_irq_offset; static int open_pic_irq_offset;
static volatile OpenPIC_Source *ISR[NR_IRQS]; static volatile OpenPIC_Source *ISR[NR_IRQS];
static int openpic_cascade_irq = -1;
static int (*openpic_cascade_fn)(struct pt_regs *);
/* Global Operations */ /* Global Operations */
static void openpic_disable_8259_pass_through(void); static void openpic_disable_8259_pass_through(void);
...@@ -416,13 +418,6 @@ void __init openpic_init(int offset) ...@@ -416,13 +418,6 @@ void __init openpic_init(int offset)
/* Initialize the spurious interrupt */ /* Initialize the spurious interrupt */
if (ppc_md.progress) ppc_md.progress("openpic: spurious",0x3bd); if (ppc_md.progress) ppc_md.progress("openpic: spurious",0x3bd);
openpic_set_spurious(OPENPIC_VEC_SPURIOUS+offset); openpic_set_spurious(OPENPIC_VEC_SPURIOUS+offset);
/* Initialize the cascade */
if (offset) {
if (request_irq(offset, no_action, SA_INTERRUPT,
"82c59 cascade", NULL))
printk("Unable to get OpenPIC IRQ 0 for cascade\n");
}
openpic_disable_8259_pass_through(); openpic_disable_8259_pass_through();
#ifdef CONFIG_EPIC_SERIAL_MODE #ifdef CONFIG_EPIC_SERIAL_MODE
openpic_eicr_set_clk(7); /* Slowest value until we know better */ openpic_eicr_set_clk(7); /* Slowest value until we know better */
...@@ -682,6 +677,19 @@ openpic_init_nmi_irq(u_int irq) ...@@ -682,6 +677,19 @@ openpic_init_nmi_irq(u_int irq)
* *
*/ */
/*
* Hookup a cascade to the OpenPIC.
*/
void __init
openpic_hookup_cascade(u_int irq, char *name,
int (*cascade_fn)(struct pt_regs *))
{
openpic_cascade_irq = irq;
openpic_cascade_fn = cascade_fn;
if (request_irq(irq, no_action, SA_INTERRUPT, name, NULL))
printk("Unable to get OpenPIC IRQ %d for cascade\n",
irq - open_pic_irq_offset);
}
/* /*
* Enable/disable an external interrupt source * Enable/disable an external interrupt source
...@@ -841,14 +849,19 @@ openpic_get_irq(struct pt_regs *regs) ...@@ -841,14 +849,19 @@ openpic_get_irq(struct pt_regs *regs)
int irq = openpic_irq(); int irq = openpic_irq();
/* /*
* This needs to be cleaned up. We don't necessarily have * Check for the cascade interrupt and call the cascaded
* an i8259 cascaded or even a cascade. * interrupt controller function (usually i8259_irq) if so.
* This should move to irq.c eventually. -- paulus
*/ */
if (open_pic_irq_offset && irq == open_pic_irq_offset) { if (irq == openpic_cascade_irq && openpic_cascade_fn != NULL) {
/* Get the IRQ from the cascade. */ int cirq = openpic_cascade_fn(regs);
irq = i8259_irq(regs);
openpic_eoi(); /* Allow for the cascade being shared with other devices */
} else if (irq == OPENPIC_VEC_SPURIOUS + open_pic_irq_offset) if (cirq != -1) {
irq = cirq;
openpic_eoi();
}
} else if (irq == OPENPIC_VEC_SPURIOUS + open_pic_irq_offset)
irq = -1; irq = -1;
return irq; return irq;
} }
......
...@@ -184,6 +184,8 @@ static int __init parse_numa_properties(void) ...@@ -184,6 +184,8 @@ static int __init parse_numa_properties(void)
if (numa_domain >= MAX_NUMNODES) if (numa_domain >= MAX_NUMNODES)
BUG(); BUG();
node_set_online(numa_domain);
if (max_domain < numa_domain) if (max_domain < numa_domain)
max_domain = numa_domain; max_domain = numa_domain;
......
/* $Id: capi.c,v 1.1.2.6 2004/04/26 09:33:07 armin Exp $ /* $Id: capi.c,v 1.1.2.7 2004/04/28 09:48:59 armin Exp $
* *
* CAPI 2.0 Interface for Linux * CAPI 2.0 Interface for Linux
* *
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include "capifs.h" #include "capifs.h"
#endif #endif
static char *revision = "$Revision: 1.1.2.6 $"; static char *revision = "$Revision: 1.1.2.7 $";
MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface"); MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
...@@ -927,8 +927,8 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -927,8 +927,8 @@ capi_ioctl(struct inode *inode, struct file *file,
if ((mp = nccip->minorp) != 0) { if ((mp = nccip->minorp) != 0) {
count += atomic_read(&mp->ttyopencount); count += atomic_read(&mp->ttyopencount);
} }
up(&cdev->ncci_list_sem);
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
up(&cdev->ncci_list_sem);
return count; return count;
} }
return 0; return 0;
......
...@@ -1325,7 +1325,6 @@ int vfs_quota_off(struct super_block *sb, int type) ...@@ -1325,7 +1325,6 @@ int vfs_quota_off(struct super_block *sb, int type)
dqopt->ops[cnt] = NULL; dqopt->ops[cnt] = NULL;
} }
up(&dqopt->dqonoff_sem); up(&dqopt->dqonoff_sem);
out:
return 0; return 0;
} }
......
...@@ -108,7 +108,7 @@ linvfs_unwritten_done( ...@@ -108,7 +108,7 @@ linvfs_unwritten_done(
struct buffer_head *bh, struct buffer_head *bh,
int uptodate) int uptodate)
{ {
page_buf_t *pb = (page_buf_t *)bh->b_private; xfs_buf_t *pb = (xfs_buf_t *)bh->b_private;
ASSERT(buffer_unwritten(bh)); ASSERT(buffer_unwritten(bh));
bh->b_end_io = NULL; bh->b_end_io = NULL;
...@@ -265,9 +265,9 @@ xfs_map_at_offset( ...@@ -265,9 +265,9 @@ xfs_map_at_offset(
STATIC struct page * STATIC struct page *
xfs_probe_unwritten_page( xfs_probe_unwritten_page(
struct address_space *mapping, struct address_space *mapping,
unsigned long index, pgoff_t index,
xfs_iomap_t *iomapp, xfs_iomap_t *iomapp,
page_buf_t *pb, xfs_buf_t *pb,
unsigned long max_offset, unsigned long max_offset,
unsigned long *fsbs, unsigned long *fsbs,
unsigned int bbits) unsigned int bbits)
...@@ -316,7 +316,7 @@ xfs_probe_unwritten_page( ...@@ -316,7 +316,7 @@ xfs_probe_unwritten_page(
STATIC unsigned int STATIC unsigned int
xfs_probe_unmapped_page( xfs_probe_unmapped_page(
struct address_space *mapping, struct address_space *mapping,
unsigned long index, pgoff_t index,
unsigned int pg_offset) unsigned int pg_offset)
{ {
struct page *page; struct page *page;
...@@ -356,8 +356,8 @@ xfs_probe_unmapped_cluster( ...@@ -356,8 +356,8 @@ xfs_probe_unmapped_cluster(
struct buffer_head *bh, struct buffer_head *bh,
struct buffer_head *head) struct buffer_head *head)
{ {
unsigned long tindex, tlast, tloff; pgoff_t tindex, tlast, tloff;
unsigned int len, total = 0; unsigned int pg_offset, len, total = 0;
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
/* First sum forwards in this page */ /* First sum forwards in this page */
...@@ -382,9 +382,9 @@ xfs_probe_unmapped_cluster( ...@@ -382,9 +382,9 @@ xfs_probe_unmapped_cluster(
total += len; total += len;
} }
if (tindex == tlast && if (tindex == tlast &&
(tloff = i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) { (pg_offset = i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
total += xfs_probe_unmapped_page(mapping, total += xfs_probe_unmapped_page(mapping,
tindex, tloff); tindex, pg_offset);
} }
} }
return total; return total;
...@@ -398,7 +398,7 @@ xfs_probe_unmapped_cluster( ...@@ -398,7 +398,7 @@ xfs_probe_unmapped_cluster(
STATIC struct page * STATIC struct page *
xfs_probe_delalloc_page( xfs_probe_delalloc_page(
struct inode *inode, struct inode *inode,
unsigned long index) pgoff_t index)
{ {
struct page *page; struct page *page;
...@@ -445,7 +445,7 @@ xfs_map_unwritten( ...@@ -445,7 +445,7 @@ xfs_map_unwritten(
{ {
struct buffer_head *bh = curr; struct buffer_head *bh = curr;
xfs_iomap_t *tmp; xfs_iomap_t *tmp;
page_buf_t *pb; xfs_buf_t *pb;
loff_t offset, size; loff_t offset, size;
unsigned long nblocks = 0; unsigned long nblocks = 0;
...@@ -497,8 +497,9 @@ xfs_map_unwritten( ...@@ -497,8 +497,9 @@ xfs_map_unwritten(
*/ */
if (bh == head) { if (bh == head) {
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
unsigned long tindex, tloff, tlast, bs; pgoff_t tindex, tloff, tlast;
unsigned int bbits = inode->i_blkbits; unsigned long bs;
unsigned int pg_offset, bbits = inode->i_blkbits;
struct page *page; struct page *page;
tlast = i_size_read(inode) >> PAGE_CACHE_SHIFT; tlast = i_size_read(inode) >> PAGE_CACHE_SHIFT;
...@@ -522,10 +523,10 @@ xfs_map_unwritten( ...@@ -522,10 +523,10 @@ xfs_map_unwritten(
} }
if (tindex == tlast && if (tindex == tlast &&
(tloff = (i_size_read(inode) & (PAGE_CACHE_SIZE - 1)))) { (pg_offset = (i_size_read(inode) & (PAGE_CACHE_SIZE - 1)))) {
page = xfs_probe_unwritten_page(mapping, page = xfs_probe_unwritten_page(mapping,
tindex, iomapp, pb, tindex, iomapp, pb,
tloff, &bs, bbits); pg_offset, &bs, bbits);
if (page) { if (page) {
nblocks += bs; nblocks += bs;
atomic_add(bs, &pb->pb_io_remaining); atomic_add(bs, &pb->pb_io_remaining);
...@@ -603,7 +604,8 @@ xfs_convert_page( ...@@ -603,7 +604,8 @@ xfs_convert_page(
{ {
struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head; struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
xfs_iomap_t *mp = iomapp, *tmp; xfs_iomap_t *mp = iomapp, *tmp;
unsigned long end, offset, end_index; unsigned long end, offset;
pgoff_t end_index;
int i = 0, index = 0; int i = 0, index = 0;
int bbits = inode->i_blkbits; int bbits = inode->i_blkbits;
...@@ -671,12 +673,12 @@ xfs_convert_page( ...@@ -671,12 +673,12 @@ xfs_convert_page(
STATIC void STATIC void
xfs_cluster_write( xfs_cluster_write(
struct inode *inode, struct inode *inode,
unsigned long tindex, pgoff_t tindex,
xfs_iomap_t *iomapp, xfs_iomap_t *iomapp,
int startio, int startio,
int all_bh) int all_bh)
{ {
unsigned long tlast; pgoff_t tlast;
struct page *page; struct page *page;
tlast = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT; tlast = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
...@@ -716,7 +718,8 @@ xfs_page_state_convert( ...@@ -716,7 +718,8 @@ xfs_page_state_convert(
{ {
struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head; struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
xfs_iomap_t *iomp, iomap; xfs_iomap_t *iomp, iomap;
unsigned long p_offset = 0, end_index; unsigned long p_offset = 0;
pgoff_t end_index;
loff_t offset; loff_t offset;
unsigned long long end_offset; unsigned long long end_offset;
int len, err, i, cnt = 0, uptodate = 1; int len, err, i, cnt = 0, uptodate = 1;
......
...@@ -31,14 +31,10 @@ ...@@ -31,14 +31,10 @@
*/ */
/* /*
* page_buf.c * The xfs_buf.c code provides an abstract buffer cache model on top
* * of the Linux page cache. Cached metadata blocks for a file system
* The page_buf module provides an abstract buffer cache model on top of * are hashed to the inode for the block device. xfs_buf.c assembles
* the Linux page cache. Cached metadata blocks for a file system are * buffers (xfs_buf_t) on demand to aggregate such cached pages for I/O.
* hashed to the inode for the block device. The page_buf module
* assembles buffer (page_buf_t) objects on demand to aggregate such
* cached pages for I/O.
*
* *
* Written by Steve Lord, Jim Mostek, Russell Cattelan * Written by Steve Lord, Jim Mostek, Russell Cattelan
* and Rajagopal Ananthanarayanan ("ananth") at SGI. * and Rajagopal Ananthanarayanan ("ananth") at SGI.
...@@ -51,7 +47,6 @@ ...@@ -51,7 +47,6 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/blkdev.h>
#include <linux/bio.h> #include <linux/bio.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
...@@ -71,7 +66,7 @@ ...@@ -71,7 +66,7 @@
STATIC kmem_cache_t *pagebuf_cache; STATIC kmem_cache_t *pagebuf_cache;
STATIC void pagebuf_daemon_wakeup(void); STATIC void pagebuf_daemon_wakeup(void);
STATIC void pagebuf_delwri_queue(page_buf_t *, int); STATIC void pagebuf_delwri_queue(xfs_buf_t *, int);
STATIC struct workqueue_struct *pagebuf_logio_workqueue; STATIC struct workqueue_struct *pagebuf_logio_workqueue;
STATIC struct workqueue_struct *pagebuf_dataio_workqueue; STATIC struct workqueue_struct *pagebuf_dataio_workqueue;
...@@ -82,7 +77,7 @@ STATIC struct workqueue_struct *pagebuf_dataio_workqueue; ...@@ -82,7 +77,7 @@ STATIC struct workqueue_struct *pagebuf_dataio_workqueue;
#ifdef PAGEBUF_TRACE #ifdef PAGEBUF_TRACE
void void
pagebuf_trace( pagebuf_trace(
page_buf_t *pb, xfs_buf_t *pb,
char *id, char *id,
void *data, void *data,
void *ra) void *ra)
...@@ -169,8 +164,6 @@ _bhash( ...@@ -169,8 +164,6 @@ _bhash(
* Mapping of multi-page buffers into contiguous virtual space * Mapping of multi-page buffers into contiguous virtual space
*/ */
STATIC void *pagebuf_mapout_locked(page_buf_t *);
typedef struct a_list { typedef struct a_list {
void *vm_addr; void *vm_addr;
struct a_list *next; struct a_list *next;
...@@ -229,8 +222,8 @@ purge_addresses(void) ...@@ -229,8 +222,8 @@ purge_addresses(void)
STATIC void STATIC void
_pagebuf_initialize( _pagebuf_initialize(
page_buf_t *pb, xfs_buf_t *pb,
pb_target_t *target, xfs_buftarg_t *target,
loff_t range_base, loff_t range_base,
size_t range_length, size_t range_length,
page_buf_flags_t flags) page_buf_flags_t flags)
...@@ -240,7 +233,7 @@ _pagebuf_initialize( ...@@ -240,7 +233,7 @@ _pagebuf_initialize(
*/ */
flags &= ~(PBF_LOCK|PBF_MAPPED|PBF_DONT_BLOCK|PBF_READ_AHEAD); flags &= ~(PBF_LOCK|PBF_MAPPED|PBF_DONT_BLOCK|PBF_READ_AHEAD);
memset(pb, 0, sizeof(page_buf_t)); memset(pb, 0, sizeof(xfs_buf_t));
atomic_set(&pb->pb_hold, 1); atomic_set(&pb->pb_hold, 1);
init_MUTEX_LOCKED(&pb->pb_iodonesema); init_MUTEX_LOCKED(&pb->pb_iodonesema);
INIT_LIST_HEAD(&pb->pb_list); INIT_LIST_HEAD(&pb->pb_list);
...@@ -251,12 +244,12 @@ _pagebuf_initialize( ...@@ -251,12 +244,12 @@ _pagebuf_initialize(
pb->pb_file_offset = range_base; pb->pb_file_offset = range_base;
/* /*
* Set buffer_length and count_desired to the same value initially. * Set buffer_length and count_desired to the same value initially.
* IO routines should use count_desired, which will be the same in * I/O routines should use count_desired, which will be the same in
* most cases but may be reset (e.g. XFS recovery). * most cases but may be reset (e.g. XFS recovery).
*/ */
pb->pb_buffer_length = pb->pb_count_desired = range_length; pb->pb_buffer_length = pb->pb_count_desired = range_length;
pb->pb_flags = flags | PBF_NONE; pb->pb_flags = flags | PBF_NONE;
pb->pb_bn = PAGE_BUF_DADDR_NULL; pb->pb_bn = XFS_BUF_DADDR_NULL;
atomic_set(&pb->pb_pin_count, 0); atomic_set(&pb->pb_pin_count, 0);
init_waitqueue_head(&pb->pb_waiters); init_waitqueue_head(&pb->pb_waiters);
...@@ -270,7 +263,7 @@ _pagebuf_initialize( ...@@ -270,7 +263,7 @@ _pagebuf_initialize(
*/ */
STATIC int STATIC int
_pagebuf_get_pages( _pagebuf_get_pages(
page_buf_t *pb, xfs_buf_t *pb,
int page_count, int page_count,
page_buf_flags_t flags) page_buf_flags_t flags)
{ {
...@@ -292,164 +285,124 @@ _pagebuf_get_pages( ...@@ -292,164 +285,124 @@ _pagebuf_get_pages(
} }
/* /*
* Walk a pagebuf releasing all the pages contained within it. * Frees pb_pages if it was malloced.
*/ */
STATIC inline void STATIC void
_pagebuf_freepages( _pagebuf_free_pages(
page_buf_t *pb) xfs_buf_t *bp)
{ {
int buf_index; if (bp->pb_pages != bp->pb_page_array) {
kmem_free(bp->pb_pages,
for (buf_index = 0; buf_index < pb->pb_page_count; buf_index++) { bp->pb_page_count * sizeof(struct page *));
struct page *page = pb->pb_pages[buf_index];
if (page) {
pb->pb_pages[buf_index] = NULL;
page_cache_release(page);
}
} }
} }
/* /*
* pagebuf_free * Releases the specified buffer.
* *
* pagebuf_free releases the specified buffer. The modification * The modification state of any associated pages is left unchanged.
* state of any associated pages is left unchanged. * The buffer most not be on any hash - use pagebuf_rele instead for
* hashed and refcounted buffers
*/ */
void void
pagebuf_free( pagebuf_free(
page_buf_t *pb) xfs_buf_t *bp)
{ {
PB_TRACE(pb, "free", 0); PB_TRACE(bp, "free", 0);
ASSERT(list_empty(&pb->pb_hash_list)); ASSERT(list_empty(&bp->pb_hash_list));
/* release any virtual mapping */ ; if (bp->pb_flags & _PBF_PAGE_CACHE) {
if (pb->pb_flags & _PBF_ADDR_ALLOCATED) { uint i;
void *vaddr = pagebuf_mapout_locked(pb);
if (vaddr) { if ((bp->pb_flags & PBF_MAPPED) && (bp->pb_page_count > 1))
free_address(vaddr); free_address(bp->pb_addr - bp->pb_offset);
}
for (i = 0; i < bp->pb_page_count; i++)
page_cache_release(bp->pb_pages[i]);
_pagebuf_free_pages(bp);
} else if (bp->pb_flags & _PBF_KMEM_ALLOC) {
/*
* XXX(hch): bp->pb_count_desired might be incorrect (see
* pagebuf_associate_memory for details), but fortunately
* the Linux version of kmem_free ignores the len argument..
*/
kmem_free(bp->pb_addr, bp->pb_count_desired);
_pagebuf_free_pages(bp);
} }
if (pb->pb_flags & _PBF_MEM_ALLOCATED) { pagebuf_deallocate(bp);
if (pb->pb_pages) {
/* release the pages in the address list */
if ((pb->pb_pages[0]) &&
(pb->pb_flags & _PBF_MEM_SLAB)) {
kfree(pb->pb_addr);
} else {
_pagebuf_freepages(pb);
}
if (pb->pb_pages != pb->pb_page_array)
kfree(pb->pb_pages);
pb->pb_pages = NULL;
}
pb->pb_flags &= ~(_PBF_MEM_ALLOCATED|_PBF_MEM_SLAB);
}
pagebuf_deallocate(pb);
} }
/* /*
* _pagebuf_lookup_pages * Finds all pages for buffer in question and builds it's page list.
*
* _pagebuf_lookup_pages finds all pages which match the buffer
* in question and the range of file offsets supplied,
* and builds the page list for the buffer, if the
* page list is not already formed or if not all of the pages are
* already in the list. Invalid pages (pages which have not yet been
* read in from disk) are assigned for any pages which are not found.
*/ */
STATIC int STATIC int
_pagebuf_lookup_pages( _pagebuf_lookup_pages(
page_buf_t *pb, xfs_buf_t *bp,
struct address_space *aspace, uint flags)
page_buf_flags_t flags)
{ {
loff_t next_buffer_offset; struct address_space *mapping = bp->pb_target->pbr_mapping;
unsigned long page_count, pi, index; unsigned int sectorshift = bp->pb_target->pbr_sshift;
struct page *page; size_t blocksize = bp->pb_target->pbr_bsize;
size_t size = bp->pb_count_desired;
size_t nbytes, offset;
int gfp_mask = pb_to_gfp(flags); int gfp_mask = pb_to_gfp(flags);
int all_mapped, good_pages, nbytes, rval, retries; unsigned short page_count, i;
unsigned int blocksize, sectorshift; pgoff_t first;
size_t size, offset; loff_t end;
int error;
next_buffer_offset = pb->pb_file_offset + pb->pb_buffer_length;
good_pages = page_count = (page_buf_btoc(next_buffer_offset) -
page_buf_btoct(pb->pb_file_offset));
if (pb->pb_flags & _PBF_ALL_PAGES_MAPPED) {
/* Bring pages forward in cache */
for (pi = 0; pi < page_count; pi++) {
mark_page_accessed(pb->pb_pages[pi]);
}
if ((flags & PBF_MAPPED) && !(pb->pb_flags & PBF_MAPPED)) {
all_mapped = 1;
rval = 0;
goto mapit;
}
return 0;
}
/* Ensure pb_pages field has been initialised */ end = bp->pb_file_offset + bp->pb_buffer_length;
rval = _pagebuf_get_pages(pb, page_count, flags); page_count = page_buf_btoc(end) - page_buf_btoct(bp->pb_file_offset);
if (rval)
return rval;
all_mapped = 1; error = _pagebuf_get_pages(bp, page_count, flags);
blocksize = pb->pb_target->pbr_bsize; if (unlikely(error))
sectorshift = pb->pb_target->pbr_sshift; return error;
size = pb->pb_count_desired;
offset = pb->pb_offset; offset = bp->pb_offset;
first = bp->pb_file_offset >> PAGE_CACHE_SHIFT;
/* Enter the pages in the page list */
index = (pb->pb_file_offset - pb->pb_offset) >> PAGE_CACHE_SHIFT; for (i = 0; i < bp->pb_page_count; i++) {
for (pi = 0; pi < page_count; pi++, index++) { struct page *page;
if (pb->pb_pages[pi] == 0) { uint retries = 0;
retries = 0;
retry: retry:
page = find_or_create_page(aspace, index, gfp_mask); page = find_or_create_page(mapping, first + i, gfp_mask);
if (!page) { if (unlikely(page == NULL)) {
if (flags & PBF_READ_AHEAD) if (flags & PBF_READ_AHEAD)
return -ENOMEM; return -ENOMEM;
/*
* This could deadlock. But until all the /*
* XFS lowlevel code is revamped to handle * This could deadlock.
* buffer allocation failures we can't do *
* much. * But until all the XFS lowlevel code is revamped to
*/ * handle buffer allocation failures we can't do much.
if (!(++retries % 100)) { */
printk(KERN_ERR if (!(++retries % 100)) {
"possibly deadlocking in %s\n", printk(KERN_ERR "possibly deadlocking in %s\n",
__FUNCTION__); __FUNCTION__);
}
XFS_STATS_INC(pb_page_retries);
pagebuf_daemon_wakeup();
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(10);
goto retry;
} }
XFS_STATS_INC(pb_page_found);
mark_page_accessed(page); XFS_STATS_INC(pb_page_retries);
pb->pb_pages[pi] = page; pagebuf_daemon_wakeup();
} else { current->state = TASK_UNINTERRUPTIBLE;
page = pb->pb_pages[pi]; schedule_timeout(10);
lock_page(page); goto retry;
} }
nbytes = PAGE_CACHE_SIZE - offset; XFS_STATS_INC(pb_page_found);
if (nbytes > size)
nbytes = size; nbytes = min_t(size_t, size, PAGE_CACHE_SIZE - offset);
size -= nbytes; size -= nbytes;
if (!PageUptodate(page)) { if (!PageUptodate(page)) {
page_count--;
if (blocksize == PAGE_CACHE_SIZE) { if (blocksize == PAGE_CACHE_SIZE) {
if (flags & PBF_READ) if (flags & PBF_READ)
pb->pb_locked = 1; bp->pb_locked = 1;
good_pages--;
} else if (!PagePrivate(page)) { } else if (!PagePrivate(page)) {
unsigned long i, range; unsigned long j, range;
/* /*
* In this case page->private holds a bitmap * In this case page->private holds a bitmap
...@@ -457,60 +410,62 @@ _pagebuf_lookup_pages( ...@@ -457,60 +410,62 @@ _pagebuf_lookup_pages(
*/ */
ASSERT(blocksize < PAGE_CACHE_SIZE); ASSERT(blocksize < PAGE_CACHE_SIZE);
range = (offset + nbytes) >> sectorshift; range = (offset + nbytes) >> sectorshift;
for (i = offset >> sectorshift; i < range; i++) for (j = offset >> sectorshift; j < range; j++)
if (!test_bit(i, &page->private)) if (!test_bit(j, &page->private))
break; break;
if (i != range) if (j == range)
good_pages--; page_count++;
} else {
good_pages--;
} }
} }
bp->pb_pages[i] = page;
offset = 0; offset = 0;
} }
if (!pb->pb_locked) { if (!bp->pb_locked) {
for (pi = 0; pi < page_count; pi++) { for (i = 0; i < bp->pb_page_count; i++)
if (pb->pb_pages[pi]) unlock_page(bp->pb_pages[i]);
unlock_page(pb->pb_pages[pi]);
}
} }
pb->pb_flags |= _PBF_PAGECACHE; bp->pb_flags |= _PBF_PAGE_CACHE;
mapit:
pb->pb_flags |= _PBF_MEM_ALLOCATED; if (page_count) {
if (all_mapped) { /* if we have any uptodate pages, mark that in the buffer */
pb->pb_flags |= _PBF_ALL_PAGES_MAPPED; bp->pb_flags &= ~PBF_NONE;
/* A single page buffer is always mappable */ /* if some pages aren't uptodate, mark that in the buffer */
if (page_count == 1) { if (page_count != bp->pb_page_count)
pb->pb_addr = (caddr_t) bp->pb_flags |= PBF_PARTIAL;
page_address(pb->pb_pages[0]) + pb->pb_offset;
pb->pb_flags |= PBF_MAPPED;
} else if (flags & PBF_MAPPED) {
if (as_list_len > 64)
purge_addresses();
pb->pb_addr = vmap(pb->pb_pages, page_count,
VM_MAP, PAGE_KERNEL);
if (pb->pb_addr == NULL)
return -ENOMEM;
pb->pb_addr += pb->pb_offset;
pb->pb_flags |= PBF_MAPPED | _PBF_ADDR_ALLOCATED;
}
}
/* If some pages were found with data in them
* we are not in PBF_NONE state.
*/
if (good_pages != 0) {
pb->pb_flags &= ~(PBF_NONE);
if (good_pages != page_count) {
pb->pb_flags |= PBF_PARTIAL;
}
} }
PB_TRACE(pb, "lookup_pages", (long)good_pages); PB_TRACE(bp, "lookup_pages", (long)page_count);
return error;
}
return rval; /*
* Map buffer into kernel address-space if nessecary.
*/
STATIC int
_pagebuf_map_pages(
xfs_buf_t *bp,
uint flags)
{
/* A single page buffer is always mappable */
if (bp->pb_page_count == 1) {
bp->pb_addr = page_address(bp->pb_pages[0]) + bp->pb_offset;
bp->pb_flags |= PBF_MAPPED;
} else if (flags & PBF_MAPPED) {
if (as_list_len > 64)
purge_addresses();
bp->pb_addr = vmap(bp->pb_pages, bp->pb_page_count,
VM_MAP, PAGE_KERNEL);
if (unlikely(bp->pb_addr == NULL))
return -ENOMEM;
bp->pb_addr += bp->pb_offset;
bp->pb_flags |= PBF_MAPPED;
}
return 0;
} }
/* /*
...@@ -527,20 +482,19 @@ _pagebuf_lookup_pages( ...@@ -527,20 +482,19 @@ _pagebuf_lookup_pages(
* which may imply that this call will block until those buffers * which may imply that this call will block until those buffers
* are unlocked. No I/O is implied by this call. * are unlocked. No I/O is implied by this call.
*/ */
STATIC page_buf_t * STATIC xfs_buf_t *
_pagebuf_find( /* find buffer for block */ _pagebuf_find( /* find buffer for block */
pb_target_t *target,/* target for block */ xfs_buftarg_t *target,/* target for block */
loff_t ioff, /* starting offset of range */ loff_t ioff, /* starting offset of range */
size_t isize, /* length of range */ size_t isize, /* length of range */
page_buf_flags_t flags, /* PBF_TRYLOCK */ page_buf_flags_t flags, /* PBF_TRYLOCK */
page_buf_t *new_pb)/* newly allocated buffer */ xfs_buf_t *new_pb)/* newly allocated buffer */
{ {
loff_t range_base; loff_t range_base;
size_t range_length; size_t range_length;
int hval; int hval;
pb_hash_t *h; pb_hash_t *h;
struct list_head *p; xfs_buf_t *pb, *n;
page_buf_t *pb;
int not_locked; int not_locked;
range_base = (ioff << BBSHIFT); range_base = (ioff << BBSHIFT);
...@@ -556,9 +510,7 @@ _pagebuf_find( /* find buffer for block */ ...@@ -556,9 +510,7 @@ _pagebuf_find( /* find buffer for block */
h = &pbhash[hval]; h = &pbhash[hval];
spin_lock(&h->pb_hash_lock); spin_lock(&h->pb_hash_lock);
list_for_each(p, &h->pb_hash) { list_for_each_entry_safe(pb, n, &h->pb_hash, pb_hash_list) {
pb = list_entry(p, page_buf_t, pb_hash_list);
if (pb->pb_target == target && if (pb->pb_target == target &&
pb->pb_file_offset == range_base && pb->pb_file_offset == range_base &&
pb->pb_buffer_length == range_length) { pb->pb_buffer_length == range_length) {
...@@ -616,11 +568,7 @@ _pagebuf_find( /* find buffer for block */ ...@@ -616,11 +568,7 @@ _pagebuf_find( /* find buffer for block */
} }
if (pb->pb_flags & PBF_STALE) if (pb->pb_flags & PBF_STALE)
pb->pb_flags &= PBF_MAPPED | \ pb->pb_flags &= PBF_MAPPED;
_PBF_ALL_PAGES_MAPPED | \
_PBF_ADDR_ALLOCATED | \
_PBF_MEM_ALLOCATED | \
_PBF_MEM_SLAB;
PB_TRACE(pb, "got_lock", 0); PB_TRACE(pb, "got_lock", 0);
XFS_STATS_INC(pb_get_locked); XFS_STATS_INC(pb_get_locked);
return (pb); return (pb);
...@@ -637,10 +585,10 @@ _pagebuf_find( /* find buffer for block */ ...@@ -637,10 +585,10 @@ _pagebuf_find( /* find buffer for block */
* pages are present in the buffer, not all of every page may be * pages are present in the buffer, not all of every page may be
* valid. * valid.
*/ */
page_buf_t * xfs_buf_t *
pagebuf_find( /* find buffer for block */ pagebuf_find( /* find buffer for block */
/* if the block is in memory */ /* if the block is in memory */
pb_target_t *target,/* target for block */ xfs_buftarg_t *target,/* target for block */
loff_t ioff, /* starting offset of range */ loff_t ioff, /* starting offset of range */
size_t isize, /* length of range */ size_t isize, /* length of range */
page_buf_flags_t flags) /* PBF_TRYLOCK */ page_buf_flags_t flags) /* PBF_TRYLOCK */
...@@ -657,37 +605,48 @@ pagebuf_find( /* find buffer for block */ ...@@ -657,37 +605,48 @@ pagebuf_find( /* find buffer for block */
* although backing storage may not be. If PBF_READ is set in * although backing storage may not be. If PBF_READ is set in
* flags, pagebuf_iostart is called also. * flags, pagebuf_iostart is called also.
*/ */
page_buf_t * xfs_buf_t *
pagebuf_get( /* allocate a buffer */ pagebuf_get( /* allocate a buffer */
pb_target_t *target,/* target for buffer */ xfs_buftarg_t *target,/* target for buffer */
loff_t ioff, /* starting offset of range */ loff_t ioff, /* starting offset of range */
size_t isize, /* length of range */ size_t isize, /* length of range */
page_buf_flags_t flags) /* PBF_TRYLOCK */ page_buf_flags_t flags) /* PBF_TRYLOCK */
{ {
page_buf_t *pb, *new_pb; xfs_buf_t *pb, *new_pb;
int error; int error = 0, i;
new_pb = pagebuf_allocate(flags); new_pb = pagebuf_allocate(flags);
if (unlikely(!new_pb)) if (unlikely(!new_pb))
return (NULL); return NULL;
pb = _pagebuf_find(target, ioff, isize, flags, new_pb); pb = _pagebuf_find(target, ioff, isize, flags, new_pb);
if (pb != new_pb) { if (pb == new_pb) {
error = _pagebuf_lookup_pages(pb, flags);
if (unlikely(error)) {
printk(KERN_WARNING
"pagebuf_get: failed to lookup pages\n");
goto no_buffer;
}
} else {
pagebuf_deallocate(new_pb); pagebuf_deallocate(new_pb);
if (unlikely(!pb)) if (unlikely(pb == NULL))
return (NULL); return NULL;
} }
XFS_STATS_INC(pb_get); for (i = 0; i < pb->pb_page_count; i++)
mark_page_accessed(pb->pb_pages[i]);
/* fill in any missing pages */ if (!(pb->pb_flags & PBF_MAPPED)) {
error = _pagebuf_lookup_pages(pb, pb->pb_target->pbr_mapping, flags); error = _pagebuf_map_pages(pb, flags);
if (unlikely(error)) { if (unlikely(error)) {
printk(KERN_WARNING printk(KERN_WARNING
"pagebuf_get: warning, failed to lookup pages\n"); "pagebuf_get: failed to map pages\n");
goto no_buffer; goto no_buffer;
}
} }
XFS_STATS_INC(pb_get);
/* /*
* Always fill in the block number now, the mapped cases can do * Always fill in the block number now, the mapped cases can do
* their own overlay of this later. * their own overlay of this later.
...@@ -728,14 +687,14 @@ pagebuf_get( /* allocate a buffer */ ...@@ -728,14 +687,14 @@ pagebuf_get( /* allocate a buffer */
/* /*
* Create a skeletal pagebuf (no pages associated with it). * Create a skeletal pagebuf (no pages associated with it).
*/ */
page_buf_t * xfs_buf_t *
pagebuf_lookup( pagebuf_lookup(
struct pb_target *target, xfs_buftarg_t *target,
loff_t ioff, loff_t ioff,
size_t isize, size_t isize,
page_buf_flags_t flags) page_buf_flags_t flags)
{ {
page_buf_t *pb; xfs_buf_t *pb;
pb = pagebuf_allocate(flags); pb = pagebuf_allocate(flags);
if (pb) { if (pb) {
...@@ -750,7 +709,7 @@ pagebuf_lookup( ...@@ -750,7 +709,7 @@ pagebuf_lookup(
*/ */
void void
pagebuf_readahead( pagebuf_readahead(
pb_target_t *target, xfs_buftarg_t *target,
loff_t ioff, loff_t ioff,
size_t isize, size_t isize,
page_buf_flags_t flags) page_buf_flags_t flags)
...@@ -767,12 +726,12 @@ pagebuf_readahead( ...@@ -767,12 +726,12 @@ pagebuf_readahead(
pagebuf_get(target, ioff, isize, flags); pagebuf_get(target, ioff, isize, flags);
} }
page_buf_t * xfs_buf_t *
pagebuf_get_empty( pagebuf_get_empty(
size_t len, size_t len,
pb_target_t *target) xfs_buftarg_t *target)
{ {
page_buf_t *pb; xfs_buf_t *pb;
pb = pagebuf_allocate(0); pb = pagebuf_allocate(0);
if (pb) if (pb)
...@@ -794,7 +753,7 @@ mem_to_page( ...@@ -794,7 +753,7 @@ mem_to_page(
int int
pagebuf_associate_memory( pagebuf_associate_memory(
page_buf_t *pb, xfs_buf_t *pb,
void *mem, void *mem,
size_t len) size_t len)
{ {
...@@ -811,9 +770,9 @@ pagebuf_associate_memory( ...@@ -811,9 +770,9 @@ pagebuf_associate_memory(
page_count++; page_count++;
/* Free any previous set of page pointers */ /* Free any previous set of page pointers */
if (pb->pb_pages && (pb->pb_pages != pb->pb_page_array)) { if (pb->pb_pages)
kfree(pb->pb_pages); _pagebuf_free_pages(pb);
}
pb->pb_pages = NULL; pb->pb_pages = NULL;
pb->pb_addr = mem; pb->pb_addr = mem;
...@@ -843,54 +802,54 @@ pagebuf_associate_memory( ...@@ -843,54 +802,54 @@ pagebuf_associate_memory(
return 0; return 0;
} }
page_buf_t * xfs_buf_t *
pagebuf_get_no_daddr( pagebuf_get_no_daddr(
size_t len, size_t len,
pb_target_t *target) xfs_buftarg_t *target)
{ {
int rval; size_t malloc_len = len;
void *rmem = NULL; xfs_buf_t *bp;
page_buf_flags_t flags = PBF_FORCEIO; void *data;
page_buf_t *pb; int error;
size_t tlen = 0;
if (unlikely(len > 0x20000)) if (unlikely(len > 0x20000))
return NULL; goto fail;
pb = pagebuf_allocate(flags); bp = pagebuf_allocate(0);
if (!pb) if (unlikely(bp == NULL))
return NULL; goto fail;
_pagebuf_initialize(bp, target, 0, len, PBF_FORCEIO);
_pagebuf_initialize(pb, target, 0, len, flags);
try_again:
do { data = kmem_alloc(malloc_len, KM_SLEEP);
if (tlen == 0) { if (unlikely(data == NULL))
tlen = len; /* first time */ goto fail_free_buf;
} else {
kfree(rmem); /* free the mem from the previous try */ /* check whether alignment matches.. */
tlen <<= 1; /* double the size and try again */ if ((__psunsigned_t)data !=
} ((__psunsigned_t)data & ~target->pbr_smask)) {
if ((rmem = kmalloc(tlen, GFP_KERNEL)) == 0) { /* .. else double the size and try again */
pagebuf_free(pb); kmem_free(data, malloc_len);
return NULL; malloc_len <<= 1;
} goto try_again;
} while ((size_t)rmem != ((size_t)rmem & ~target->pbr_smask));
if ((rval = pagebuf_associate_memory(pb, rmem, len)) != 0) {
kfree(rmem);
pagebuf_free(pb);
return NULL;
} }
/* otherwise pagebuf_free just ignores it */
pb->pb_flags |= (_PBF_MEM_ALLOCATED | _PBF_MEM_SLAB);
PB_CLEAR_OWNER(pb);
up(&pb->pb_sema); /* Return unlocked pagebuf */
PB_TRACE(pb, "no_daddr", rmem); error = pagebuf_associate_memory(bp, data, len);
if (error)
goto fail_free_mem;
bp->pb_flags |= _PBF_KMEM_ALLOC;
return pb; pagebuf_unlock(bp);
}
PB_TRACE(bp, "no_daddr", data);
return bp;
fail_free_mem:
kmem_free(data, malloc_len);
fail_free_buf:
pagebuf_free(bp);
fail:
return NULL;
}
/* /*
* pagebuf_hold * pagebuf_hold
...@@ -902,7 +861,7 @@ pagebuf_get_no_daddr( ...@@ -902,7 +861,7 @@ pagebuf_get_no_daddr(
*/ */
void void
pagebuf_hold( pagebuf_hold(
page_buf_t *pb) xfs_buf_t *pb)
{ {
atomic_inc(&pb->pb_hold); atomic_inc(&pb->pb_hold);
PB_TRACE(pb, "hold", 0); PB_TRACE(pb, "hold", 0);
...@@ -916,7 +875,7 @@ pagebuf_hold( ...@@ -916,7 +875,7 @@ pagebuf_hold(
*/ */
void void
pagebuf_rele( pagebuf_rele(
page_buf_t *pb) xfs_buf_t *pb)
{ {
pb_hash_t *hash = pb_hash(pb); pb_hash_t *hash = pb_hash(pb);
...@@ -975,7 +934,7 @@ pagebuf_rele( ...@@ -975,7 +934,7 @@ pagebuf_rele(
int int
pagebuf_cond_lock( /* lock buffer, if not locked */ pagebuf_cond_lock( /* lock buffer, if not locked */
/* returns -EBUSY if locked) */ /* returns -EBUSY if locked) */
page_buf_t *pb) xfs_buf_t *pb)
{ {
int locked; int locked;
...@@ -994,7 +953,7 @@ pagebuf_cond_lock( /* lock buffer, if not locked */ ...@@ -994,7 +953,7 @@ pagebuf_cond_lock( /* lock buffer, if not locked */
*/ */
int int
pagebuf_lock_value( pagebuf_lock_value(
page_buf_t *pb) xfs_buf_t *pb)
{ {
return(atomic_read(&pb->pb_sema.count)); return(atomic_read(&pb->pb_sema.count));
} }
...@@ -1009,7 +968,7 @@ pagebuf_lock_value( ...@@ -1009,7 +968,7 @@ pagebuf_lock_value(
*/ */
int int
pagebuf_lock( pagebuf_lock(
page_buf_t *pb) xfs_buf_t *pb)
{ {
PB_TRACE(pb, "lock", 0); PB_TRACE(pb, "lock", 0);
if (atomic_read(&pb->pb_io_remaining)) if (atomic_read(&pb->pb_io_remaining))
...@@ -1029,7 +988,7 @@ pagebuf_lock( ...@@ -1029,7 +988,7 @@ pagebuf_lock(
*/ */
void void
pagebuf_unlock( /* unlock buffer */ pagebuf_unlock( /* unlock buffer */
page_buf_t *pb) /* buffer to unlock */ xfs_buf_t *pb) /* buffer to unlock */
{ {
PB_CLEAR_OWNER(pb); PB_CLEAR_OWNER(pb);
up(&pb->pb_sema); up(&pb->pb_sema);
...@@ -1057,7 +1016,7 @@ pagebuf_unlock( /* unlock buffer */ ...@@ -1057,7 +1016,7 @@ pagebuf_unlock( /* unlock buffer */
*/ */
void void
pagebuf_pin( pagebuf_pin(
page_buf_t *pb) xfs_buf_t *pb)
{ {
atomic_inc(&pb->pb_pin_count); atomic_inc(&pb->pb_pin_count);
PB_TRACE(pb, "pin", (long)pb->pb_pin_count.counter); PB_TRACE(pb, "pin", (long)pb->pb_pin_count.counter);
...@@ -1072,7 +1031,7 @@ pagebuf_pin( ...@@ -1072,7 +1031,7 @@ pagebuf_pin(
*/ */
void void
pagebuf_unpin( pagebuf_unpin(
page_buf_t *pb) xfs_buf_t *pb)
{ {
if (atomic_dec_and_test(&pb->pb_pin_count)) { if (atomic_dec_and_test(&pb->pb_pin_count)) {
wake_up_all(&pb->pb_waiters); wake_up_all(&pb->pb_waiters);
...@@ -1082,7 +1041,7 @@ pagebuf_unpin( ...@@ -1082,7 +1041,7 @@ pagebuf_unpin(
int int
pagebuf_ispin( pagebuf_ispin(
page_buf_t *pb) xfs_buf_t *pb)
{ {
return atomic_read(&pb->pb_pin_count); return atomic_read(&pb->pb_pin_count);
} }
...@@ -1096,7 +1055,7 @@ pagebuf_ispin( ...@@ -1096,7 +1055,7 @@ pagebuf_ispin(
*/ */
static inline void static inline void
_pagebuf_wait_unpin( _pagebuf_wait_unpin(
page_buf_t *pb) xfs_buf_t *pb)
{ {
DECLARE_WAITQUEUE (wait, current); DECLARE_WAITQUEUE (wait, current);
...@@ -1131,23 +1090,17 @@ void ...@@ -1131,23 +1090,17 @@ void
pagebuf_iodone_work( pagebuf_iodone_work(
void *v) void *v)
{ {
page_buf_t *pb = (page_buf_t *)v; xfs_buf_t *bp = (xfs_buf_t *)v;
if (pb->pb_iodone) {
(*(pb->pb_iodone)) (pb);
return;
}
if (pb->pb_flags & PBF_ASYNC) { if (bp->pb_iodone)
if (!pb->pb_relse) (*(bp->pb_iodone))(bp);
pagebuf_unlock(pb); else if (bp->pb_flags & PBF_ASYNC)
pagebuf_rele(pb); xfs_buf_relse(bp);
}
} }
void void
pagebuf_iodone( pagebuf_iodone(
page_buf_t *pb, xfs_buf_t *pb,
int dataio, int dataio,
int schedule) int schedule)
{ {
...@@ -1178,10 +1131,11 @@ pagebuf_iodone( ...@@ -1178,10 +1131,11 @@ pagebuf_iodone(
*/ */
void void
pagebuf_ioerror( /* mark/clear buffer error flag */ pagebuf_ioerror( /* mark/clear buffer error flag */
page_buf_t *pb, /* buffer to mark */ xfs_buf_t *pb, /* buffer to mark */
unsigned int error) /* error to store (0 if none) */ int error) /* error to store (0 if none) */
{ {
pb->pb_error = error; ASSERT(error >= 0 && error <= 0xffff);
pb->pb_error = (unsigned short)error;
PB_TRACE(pb, "ioerror", (unsigned long)error); PB_TRACE(pb, "ioerror", (unsigned long)error);
} }
...@@ -1199,7 +1153,7 @@ pagebuf_ioerror( /* mark/clear buffer error flag */ ...@@ -1199,7 +1153,7 @@ pagebuf_ioerror( /* mark/clear buffer error flag */
*/ */
int int
pagebuf_iostart( /* start I/O on a buffer */ pagebuf_iostart( /* start I/O on a buffer */
page_buf_t *pb, /* buffer to start */ xfs_buf_t *pb, /* buffer to start */
page_buf_flags_t flags) /* PBF_LOCK, PBF_ASYNC, PBF_READ, */ page_buf_flags_t flags) /* PBF_LOCK, PBF_ASYNC, PBF_READ, */
/* PBF_WRITE, PBF_DELWRI, */ /* PBF_WRITE, PBF_DELWRI, */
/* PBF_DONT_BLOCK */ /* PBF_DONT_BLOCK */
...@@ -1216,11 +1170,11 @@ pagebuf_iostart( /* start I/O on a buffer */ ...@@ -1216,11 +1170,11 @@ pagebuf_iostart( /* start I/O on a buffer */
} }
pb->pb_flags &= ~(PBF_READ | PBF_WRITE | PBF_ASYNC | PBF_DELWRI | \ pb->pb_flags &= ~(PBF_READ | PBF_WRITE | PBF_ASYNC | PBF_DELWRI | \
PBF_READ_AHEAD | PBF_RUN_QUEUES); PBF_READ_AHEAD | _PBF_RUN_QUEUES);
pb->pb_flags |= flags & (PBF_READ | PBF_WRITE | PBF_ASYNC | \ pb->pb_flags |= flags & (PBF_READ | PBF_WRITE | PBF_ASYNC | \
PBF_READ_AHEAD | PBF_RUN_QUEUES); PBF_READ_AHEAD | _PBF_RUN_QUEUES);
BUG_ON(pb->pb_bn == PAGE_BUF_DADDR_NULL); BUG_ON(pb->pb_bn == XFS_BUF_DADDR_NULL);
/* For writes allow an alternate strategy routine to precede /* For writes allow an alternate strategy routine to precede
* the actual I/O request (which may not be issued at all in * the actual I/O request (which may not be issued at all in
...@@ -1246,7 +1200,7 @@ pagebuf_iostart( /* start I/O on a buffer */ ...@@ -1246,7 +1200,7 @@ pagebuf_iostart( /* start I/O on a buffer */
STATIC __inline__ int STATIC __inline__ int
_pagebuf_iolocked( _pagebuf_iolocked(
page_buf_t *pb) xfs_buf_t *pb)
{ {
ASSERT(pb->pb_flags & (PBF_READ|PBF_WRITE)); ASSERT(pb->pb_flags & (PBF_READ|PBF_WRITE));
if (pb->pb_flags & PBF_READ) if (pb->pb_flags & PBF_READ)
...@@ -1256,7 +1210,7 @@ _pagebuf_iolocked( ...@@ -1256,7 +1210,7 @@ _pagebuf_iolocked(
STATIC __inline__ void STATIC __inline__ void
_pagebuf_iodone( _pagebuf_iodone(
page_buf_t *pb, xfs_buf_t *pb,
int schedule) int schedule)
{ {
if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) { if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
...@@ -1271,7 +1225,7 @@ bio_end_io_pagebuf( ...@@ -1271,7 +1225,7 @@ bio_end_io_pagebuf(
unsigned int bytes_done, unsigned int bytes_done,
int error) int error)
{ {
page_buf_t *pb = (page_buf_t *)bio->bi_private; xfs_buf_t *pb = (xfs_buf_t *)bio->bi_private;
unsigned int i, blocksize = pb->pb_target->pbr_bsize; unsigned int i, blocksize = pb->pb_target->pbr_bsize;
unsigned int sectorshift = pb->pb_target->pbr_sshift; unsigned int sectorshift = pb->pb_target->pbr_sshift;
struct bio_vec *bvec = bio->bi_io_vec; struct bio_vec *bvec = bio->bi_io_vec;
...@@ -1289,8 +1243,9 @@ bio_end_io_pagebuf( ...@@ -1289,8 +1243,9 @@ bio_end_io_pagebuf(
SetPageError(page); SetPageError(page);
} else if (blocksize == PAGE_CACHE_SIZE) { } else if (blocksize == PAGE_CACHE_SIZE) {
SetPageUptodate(page); SetPageUptodate(page);
} else if (!PagePrivate(page)) { } else if (!PagePrivate(page) &&
unsigned int j, range; (pb->pb_flags & _PBF_PAGE_CACHE)) {
unsigned long j, range;
ASSERT(blocksize < PAGE_CACHE_SIZE); ASSERT(blocksize < PAGE_CACHE_SIZE);
range = (bvec->bv_offset + bvec->bv_len) >> sectorshift; range = (bvec->bv_offset + bvec->bv_len) >> sectorshift;
...@@ -1312,7 +1267,7 @@ bio_end_io_pagebuf( ...@@ -1312,7 +1267,7 @@ bio_end_io_pagebuf(
void void
_pagebuf_ioapply( _pagebuf_ioapply(
page_buf_t *pb) xfs_buf_t *pb)
{ {
int i, map_i, total_nr_pages, nr_pages; int i, map_i, total_nr_pages, nr_pages;
struct bio *bio; struct bio *bio;
...@@ -1404,34 +1359,19 @@ _pagebuf_ioapply( ...@@ -1404,34 +1359,19 @@ _pagebuf_ioapply(
pagebuf_ioerror(pb, EIO); pagebuf_ioerror(pb, EIO);
} }
if (pb->pb_flags & PBF_RUN_QUEUES) { if (pb->pb_flags & _PBF_RUN_QUEUES) {
pb->pb_flags &= ~PBF_RUN_QUEUES; pb->pb_flags &= ~_PBF_RUN_QUEUES;
if (atomic_read(&pb->pb_io_remaining) > 1) if (atomic_read(&pb->pb_io_remaining) > 1)
blk_run_address_space(pb->pb_target->pbr_mapping); blk_run_address_space(pb->pb_target->pbr_mapping);
} }
} }
/* /*
* pagebuf_iorequest * pagebuf_iorequest -- the core I/O request routine.
*
* pagebuf_iorequest is the core I/O request routine.
* It assumes that the buffer is well-formed and
* mapped and ready for physical I/O, unlike
* pagebuf_iostart() and pagebuf_iophysio(). Those
* routines call the pagebuf_ioinitiate routine to start I/O,
* if it is present, or else call pagebuf_iorequest()
* directly if the pagebuf_ioinitiate routine is not present.
*
* This function will be responsible for ensuring access to the
* pages is restricted whilst I/O is in progress - for locking
* pagebufs the pagebuf lock is the mediator, for non-locking
* pagebufs the pages will be locked. In the locking case we
* need to use the pagebuf lock as multiple meta-data buffers
* will reference the same page.
*/ */
int int
pagebuf_iorequest( /* start real I/O */ pagebuf_iorequest( /* start real I/O */
page_buf_t *pb) /* buffer to convey to device */ xfs_buf_t *pb) /* buffer to convey to device */
{ {
PB_TRACE(pb, "iorequest", 0); PB_TRACE(pb, "iorequest", 0);
...@@ -1467,7 +1407,7 @@ pagebuf_iorequest( /* start real I/O */ ...@@ -1467,7 +1407,7 @@ pagebuf_iorequest( /* start real I/O */
*/ */
int int
pagebuf_iowait( pagebuf_iowait(
page_buf_t *pb) xfs_buf_t *pb)
{ {
PB_TRACE(pb, "iowait", 0); PB_TRACE(pb, "iowait", 0);
if (atomic_read(&pb->pb_io_remaining)) if (atomic_read(&pb->pb_io_remaining))
...@@ -1477,28 +1417,9 @@ pagebuf_iowait( ...@@ -1477,28 +1417,9 @@ pagebuf_iowait(
return pb->pb_error; return pb->pb_error;
} }
STATIC void *
pagebuf_mapout_locked(
page_buf_t *pb)
{
void *old_addr = NULL;
if (pb->pb_flags & PBF_MAPPED) {
if (pb->pb_flags & _PBF_ADDR_ALLOCATED)
old_addr = pb->pb_addr - pb->pb_offset;
pb->pb_addr = NULL;
pb->pb_flags &= ~(PBF_MAPPED | _PBF_ADDR_ALLOCATED);
}
return old_addr; /* Caller must free the address space,
* we are under a spin lock, probably
* not safe to do vfree here
*/
}
caddr_t caddr_t
pagebuf_offset( pagebuf_offset(
page_buf_t *pb, xfs_buf_t *pb,
size_t offset) size_t offset)
{ {
struct page *page; struct page *page;
...@@ -1516,7 +1437,7 @@ pagebuf_offset( ...@@ -1516,7 +1437,7 @@ pagebuf_offset(
*/ */
void void
pagebuf_iomove( pagebuf_iomove(
page_buf_t *pb, /* buffer to process */ xfs_buf_t *pb, /* buffer to process */
size_t boff, /* starting buffer offset */ size_t boff, /* starting buffer offset */
size_t bsize, /* length to copy */ size_t bsize, /* length to copy */
caddr_t data, /* data address */ caddr_t data, /* data address */
...@@ -1550,6 +1471,64 @@ pagebuf_iomove( ...@@ -1550,6 +1471,64 @@ pagebuf_iomove(
} }
} }
/*
* Handling of buftargs.
*/
void
xfs_free_buftarg(
xfs_buftarg_t *btp,
int external)
{
xfs_flush_buftarg(btp, 1);
if (external)
xfs_blkdev_put(btp->pbr_bdev);
kmem_free(btp, sizeof(*btp));
}
void
xfs_incore_relse(
xfs_buftarg_t *btp,
int delwri_only,
int wait)
{
invalidate_bdev(btp->pbr_bdev, 1);
truncate_inode_pages(btp->pbr_mapping, 0LL);
}
void
xfs_setsize_buftarg(
xfs_buftarg_t *btp,
unsigned int blocksize,
unsigned int sectorsize)
{
btp->pbr_bsize = blocksize;
btp->pbr_sshift = ffs(sectorsize) - 1;
btp->pbr_smask = sectorsize - 1;
if (set_blocksize(btp->pbr_bdev, sectorsize)) {
printk(KERN_WARNING
"XFS: Cannot set_blocksize to %u on device %s\n",
sectorsize, XFS_BUFTARG_NAME(btp));
}
}
xfs_buftarg_t *
xfs_alloc_buftarg(
struct block_device *bdev)
{
xfs_buftarg_t *btp;
btp = kmem_zalloc(sizeof(*btp), KM_SLEEP);
btp->pbr_dev = bdev->bd_dev;
btp->pbr_bdev = bdev;
btp->pbr_mapping = bdev->bd_inode->i_mapping;
xfs_setsize_buftarg(btp, PAGE_CACHE_SIZE, bdev_hardsect_size(bdev));
return btp;
}
/* /*
* Pagebuf delayed write buffer handling * Pagebuf delayed write buffer handling
...@@ -1560,10 +1539,12 @@ STATIC spinlock_t pbd_delwrite_lock = SPIN_LOCK_UNLOCKED; ...@@ -1560,10 +1539,12 @@ STATIC spinlock_t pbd_delwrite_lock = SPIN_LOCK_UNLOCKED;
STATIC void STATIC void
pagebuf_delwri_queue( pagebuf_delwri_queue(
page_buf_t *pb, xfs_buf_t *pb,
int unlock) int unlock)
{ {
PB_TRACE(pb, "delwri_q", (long)unlock); PB_TRACE(pb, "delwri_q", (long)unlock);
ASSERT(pb->pb_flags & PBF_DELWRI);
spin_lock(&pbd_delwrite_lock); spin_lock(&pbd_delwrite_lock);
/* If already in the queue, dequeue and place at tail */ /* If already in the queue, dequeue and place at tail */
if (!list_empty(&pb->pb_list)) { if (!list_empty(&pb->pb_list)) {
...@@ -1574,7 +1555,7 @@ pagebuf_delwri_queue( ...@@ -1574,7 +1555,7 @@ pagebuf_delwri_queue(
} }
list_add_tail(&pb->pb_list, &pbd_delwrite_queue); list_add_tail(&pb->pb_list, &pbd_delwrite_queue);
pb->pb_flushtime = jiffies + xfs_age_buffer; pb->pb_queuetime = jiffies;
spin_unlock(&pbd_delwrite_lock); spin_unlock(&pbd_delwrite_lock);
if (unlock) if (unlock)
...@@ -1583,7 +1564,7 @@ pagebuf_delwri_queue( ...@@ -1583,7 +1564,7 @@ pagebuf_delwri_queue(
void void
pagebuf_delwri_dequeue( pagebuf_delwri_dequeue(
page_buf_t *pb) xfs_buf_t *pb)
{ {
PB_TRACE(pb, "delwri_uq", 0); PB_TRACE(pb, "delwri_uq", 0);
spin_lock(&pbd_delwrite_lock); spin_lock(&pbd_delwrite_lock);
...@@ -1617,8 +1598,8 @@ STATIC int ...@@ -1617,8 +1598,8 @@ STATIC int
pagebuf_daemon( pagebuf_daemon(
void *data) void *data)
{ {
page_buf_t *pb; struct list_head tmp;
struct list_head *curr, *next, tmp; xfs_buf_t *pb, *n;
/* Set up the thread */ /* Set up the thread */
daemonize("xfsbufd"); daemonize("xfsbufd");
...@@ -1638,16 +1619,15 @@ pagebuf_daemon( ...@@ -1638,16 +1619,15 @@ pagebuf_daemon(
schedule_timeout(xfs_flush_interval); schedule_timeout(xfs_flush_interval);
spin_lock(&pbd_delwrite_lock); spin_lock(&pbd_delwrite_lock);
list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) {
list_for_each_safe(curr, next, &pbd_delwrite_queue) {
pb = list_entry(curr, page_buf_t, pb_list);
PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb)); PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb));
ASSERT(pb->pb_flags & PBF_DELWRI);
if ((pb->pb_flags & PBF_DELWRI) && if (!pagebuf_ispin(pb) && !pagebuf_cond_lock(pb)) {
!pagebuf_ispin(pb) && !pagebuf_cond_lock(pb)) {
if (!force_flush && if (!force_flush &&
time_before(jiffies, pb->pb_flushtime)) { time_before(jiffies,
pb->pb_queuetime +
xfs_age_buffer)) {
pagebuf_unlock(pb); pagebuf_unlock(pb);
break; break;
} }
...@@ -1657,12 +1637,11 @@ pagebuf_daemon( ...@@ -1657,12 +1637,11 @@ pagebuf_daemon(
list_move(&pb->pb_list, &tmp); list_move(&pb->pb_list, &tmp);
} }
} }
spin_unlock(&pbd_delwrite_lock); spin_unlock(&pbd_delwrite_lock);
while (!list_empty(&tmp)) { while (!list_empty(&tmp)) {
pb = list_entry(tmp.next, page_buf_t, pb_list); pb = list_entry(tmp.next, xfs_buf_t, pb_list);
list_del_init(&pb->pb_list); list_del_init(&pb->pb_list);
pagebuf_iostrategy(pb); pagebuf_iostrategy(pb);
blk_run_address_space(pb->pb_target->pbr_mapping); blk_run_address_space(pb->pb_target->pbr_mapping);
} }
...@@ -1676,34 +1655,31 @@ pagebuf_daemon( ...@@ -1676,34 +1655,31 @@ pagebuf_daemon(
complete_and_exit(&pagebuf_daemon_done, 0); complete_and_exit(&pagebuf_daemon_done, 0);
} }
void /*
pagebuf_delwri_flush( * Go through all incore buffers, and release buffers if they belong to
pb_target_t *target, * the given device. This is used in filesystem error handling to
u_long flags, * preserve the consistency of its metadata.
int *pinptr) */
int
xfs_flush_buftarg(
xfs_buftarg_t *target,
int wait)
{ {
page_buf_t *pb; struct list_head tmp;
struct list_head *curr, *next, tmp; xfs_buf_t *pb, *n;
int pincount = 0; int pincount = 0;
pagebuf_runall_queues(pagebuf_dataio_workqueue); pagebuf_runall_queues(pagebuf_dataio_workqueue);
pagebuf_runall_queues(pagebuf_logio_workqueue); pagebuf_runall_queues(pagebuf_logio_workqueue);
spin_lock(&pbd_delwrite_lock);
INIT_LIST_HEAD(&tmp); INIT_LIST_HEAD(&tmp);
spin_lock(&pbd_delwrite_lock);
list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) {
list_for_each_safe(curr, next, &pbd_delwrite_queue) { if (pb->pb_target != target)
pb = list_entry(curr, page_buf_t, pb_list);
/*
* Skip other targets, markers and in progress buffers
*/
if ((pb->pb_flags == 0) || (pb->pb_target != target) ||
!(pb->pb_flags & PBF_DELWRI)) {
continue; continue;
}
ASSERT(pb->pb_flags & PBF_DELWRI);
PB_TRACE(pb, "walkq2", (long)pagebuf_ispin(pb)); PB_TRACE(pb, "walkq2", (long)pagebuf_ispin(pb));
if (pagebuf_ispin(pb)) { if (pagebuf_ispin(pb)) {
pincount++; pincount++;
...@@ -1714,37 +1690,36 @@ pagebuf_delwri_flush( ...@@ -1714,37 +1690,36 @@ pagebuf_delwri_flush(
pb->pb_flags |= PBF_WRITE; pb->pb_flags |= PBF_WRITE;
list_move(&pb->pb_list, &tmp); list_move(&pb->pb_list, &tmp);
} }
/* ok found all the items that can be worked on
* drop the lock and process the private list */
spin_unlock(&pbd_delwrite_lock); spin_unlock(&pbd_delwrite_lock);
list_for_each_safe(curr, next, &tmp) { /*
pb = list_entry(curr, page_buf_t, pb_list); * Dropped the delayed write list lock, now walk the temporary list
*/
if (flags & PBDF_WAIT) list_for_each_entry_safe(pb, n, &tmp, pb_list) {
if (wait)
pb->pb_flags &= ~PBF_ASYNC; pb->pb_flags &= ~PBF_ASYNC;
else else
list_del_init(curr); list_del_init(&pb->pb_list);
pagebuf_lock(pb); pagebuf_lock(pb);
pagebuf_iostrategy(pb); pagebuf_iostrategy(pb);
} }
/*
* Remaining list items must be flushed before returning
*/
while (!list_empty(&tmp)) { while (!list_empty(&tmp)) {
pb = list_entry(tmp.next, page_buf_t, pb_list); pb = list_entry(tmp.next, xfs_buf_t, pb_list);
list_del_init(&pb->pb_list); list_del_init(&pb->pb_list);
pagebuf_iowait(pb); xfs_iowait(pb);
if (!pb->pb_relse) xfs_buf_relse(pb);
pagebuf_unlock(pb);
pagebuf_rele(pb);
} }
if (flags & PBDF_WAIT) if (wait)
blk_run_address_space(target->pbr_mapping); blk_run_address_space(target->pbr_mapping);
if (pinptr) return pincount;
*pinptr = pincount;
} }
STATIC int STATIC int
...@@ -1796,7 +1771,7 @@ pagebuf_init(void) ...@@ -1796,7 +1771,7 @@ pagebuf_init(void)
{ {
int i; int i;
pagebuf_cache = kmem_cache_create("page_buf_t", sizeof(page_buf_t), 0, pagebuf_cache = kmem_cache_create("xfs_buf_t", sizeof(xfs_buf_t), 0,
SLAB_HWCACHE_ALIGN, NULL, NULL); SLAB_HWCACHE_ALIGN, NULL, NULL);
if (pagebuf_cache == NULL) { if (pagebuf_cache == NULL) {
printk("pagebuf: couldn't init pagebuf cache\n"); printk("pagebuf: couldn't init pagebuf cache\n");
......
...@@ -51,10 +51,7 @@ ...@@ -51,10 +51,7 @@
* Base types * Base types
*/ */
/* daddr must be signed since -1 is used for bmaps that are not yet allocated */ #define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL))
typedef loff_t page_buf_daddr_t;
#define PAGE_BUF_DADDR_NULL ((page_buf_daddr_t) (-1LL))
#define page_buf_ctob(pp) ((pp) * PAGE_CACHE_SIZE) #define page_buf_ctob(pp) ((pp) * PAGE_CACHE_SIZE)
#define page_buf_btoc(dd) (((dd) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) #define page_buf_btoc(dd) (((dd) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)
...@@ -76,44 +73,39 @@ typedef enum page_buf_flags_e { /* pb_flags values */ ...@@ -76,44 +73,39 @@ typedef enum page_buf_flags_e { /* pb_flags values */
PBF_ASYNC = (1 << 4), /* initiator will not wait for completion */ PBF_ASYNC = (1 << 4), /* initiator will not wait for completion */
PBF_NONE = (1 << 5), /* buffer not read at all */ PBF_NONE = (1 << 5), /* buffer not read at all */
PBF_DELWRI = (1 << 6), /* buffer has dirty pages */ PBF_DELWRI = (1 << 6), /* buffer has dirty pages */
PBF_STALE = (1 << 10), /* buffer has been staled, do not find it */ PBF_STALE = (1 << 7), /* buffer has been staled, do not find it */
PBF_FS_MANAGED = (1 << 11), /* filesystem controls freeing memory */ PBF_FS_MANAGED = (1 << 8), /* filesystem controls freeing memory */
PBF_FS_DATAIOD = (1 << 12), /* schedule IO completion on fs datad */ PBF_FS_DATAIOD = (1 << 9), /* schedule IO completion on fs datad */
PBF_FORCEIO = (1 << 10), /* ignore any cache state */
PBF_FLUSH = (1 << 11), /* flush disk write cache */
PBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead */
/* flags used only as arguments to access routines */ /* flags used only as arguments to access routines */
PBF_LOCK = (1 << 13), /* lock requested */ PBF_LOCK = (1 << 14), /* lock requested */
PBF_TRYLOCK = (1 << 14), /* lock requested, but do not wait */ PBF_TRYLOCK = (1 << 15), /* lock requested, but do not wait */
PBF_DONT_BLOCK = (1 << 15), /* do not block in current thread */ PBF_DONT_BLOCK = (1 << 16), /* do not block in current thread */
/* flags used only internally */ /* flags used only internally */
_PBF_PAGECACHE = (1 << 16), /* backed by pagecache */ _PBF_PAGE_CACHE = (1 << 17),/* backed by pagecache */
_PBF_ALL_PAGES_MAPPED = (1 << 18), /* all pages in range mapped */ _PBF_KMEM_ALLOC = (1 << 18),/* backed by kmem_alloc() */
_PBF_ADDR_ALLOCATED = (1 << 19), /* pb_addr space was allocated */ _PBF_RUN_QUEUES = (1 << 19),/* run block device task queue */
_PBF_MEM_ALLOCATED = (1 << 20), /* underlying pages are allocated */
_PBF_MEM_SLAB = (1 << 21), /* underlying pages are slab allocated */
PBF_FORCEIO = (1 << 22), /* ignore any cache state */
PBF_FLUSH = (1 << 23), /* flush disk write cache */
PBF_READ_AHEAD = (1 << 24), /* asynchronous read-ahead */
PBF_RUN_QUEUES = (1 << 25), /* run block device task queue */
} page_buf_flags_t; } page_buf_flags_t;
#define PBF_UPDATE (PBF_READ | PBF_WRITE) #define PBF_UPDATE (PBF_READ | PBF_WRITE)
#define PBF_NOT_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) != 0) #define PBF_NOT_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) != 0)
#define PBF_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) == 0) #define PBF_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) == 0)
typedef struct pb_target { typedef struct xfs_buftarg {
dev_t pbr_dev; dev_t pbr_dev;
struct block_device *pbr_bdev; struct block_device *pbr_bdev;
struct address_space *pbr_mapping; struct address_space *pbr_mapping;
unsigned int pbr_bsize; unsigned int pbr_bsize;
unsigned int pbr_sshift; unsigned int pbr_sshift;
size_t pbr_smask; size_t pbr_smask;
} pb_target_t; } xfs_buftarg_t;
/* /*
* page_buf_t: Buffer structure for page cache-based buffers * xfs_buf_t: Buffer structure for page cache-based buffers
* *
* This buffer structure is used by the page cache buffer management routines * This buffer structure is used by the page cache buffer management routines
* to refer to an assembly of pages forming a logical buffer. The actual * to refer to an assembly of pages forming a logical buffer. The actual
...@@ -128,26 +120,26 @@ typedef struct pb_target { ...@@ -128,26 +120,26 @@ typedef struct pb_target {
* to indicate which disk blocks in the page are not valid. * to indicate which disk blocks in the page are not valid.
*/ */
struct page_buf_s; struct xfs_buf;
typedef void (*page_buf_iodone_t)(struct page_buf_s *); typedef void (*page_buf_iodone_t)(struct xfs_buf *);
/* call-back function on I/O completion */ /* call-back function on I/O completion */
typedef void (*page_buf_relse_t)(struct page_buf_s *); typedef void (*page_buf_relse_t)(struct xfs_buf *);
/* call-back function on I/O completion */ /* call-back function on I/O completion */
typedef int (*page_buf_bdstrat_t)(struct page_buf_s *); typedef int (*page_buf_bdstrat_t)(struct xfs_buf *);
#define PB_PAGES 4 #define PB_PAGES 4
typedef struct page_buf_s { typedef struct xfs_buf {
struct semaphore pb_sema; /* semaphore for lockables */ struct semaphore pb_sema; /* semaphore for lockables */
unsigned long pb_flushtime; /* time to flush pagebuf */ unsigned long pb_queuetime; /* time buffer was queued */
atomic_t pb_pin_count; /* pin count */ atomic_t pb_pin_count; /* pin count */
wait_queue_head_t pb_waiters; /* unpin waiters */ wait_queue_head_t pb_waiters; /* unpin waiters */
struct list_head pb_list; struct list_head pb_list;
page_buf_flags_t pb_flags; /* status flags */ page_buf_flags_t pb_flags; /* status flags */
struct list_head pb_hash_list; struct list_head pb_hash_list;
struct pb_target *pb_target; /* logical object */ xfs_buftarg_t *pb_target; /* logical object */
atomic_t pb_hold; /* reference count */ atomic_t pb_hold; /* reference count */
page_buf_daddr_t pb_bn; /* block number for I/O */ xfs_daddr_t pb_bn; /* block number for I/O */
loff_t pb_file_offset; /* offset in file */ loff_t pb_file_offset; /* offset in file */
size_t pb_buffer_length; /* size of buffer in bytes */ size_t pb_buffer_length; /* size of buffer in bytes */
size_t pb_count_desired; /* desired transfer size */ size_t pb_count_desired; /* desired transfer size */
...@@ -171,52 +163,52 @@ typedef struct page_buf_s { ...@@ -171,52 +163,52 @@ typedef struct page_buf_s {
#ifdef PAGEBUF_LOCK_TRACKING #ifdef PAGEBUF_LOCK_TRACKING
int pb_last_holder; int pb_last_holder;
#endif #endif
} page_buf_t; } xfs_buf_t;
/* Finding and Reading Buffers */ /* Finding and Reading Buffers */
extern page_buf_t *pagebuf_find( /* find buffer for block if */ extern xfs_buf_t *pagebuf_find( /* find buffer for block if */
/* the block is in memory */ /* the block is in memory */
struct pb_target *, /* inode for block */ xfs_buftarg_t *, /* inode for block */
loff_t, /* starting offset of range */ loff_t, /* starting offset of range */
size_t, /* length of range */ size_t, /* length of range */
page_buf_flags_t); /* PBF_LOCK */ page_buf_flags_t); /* PBF_LOCK */
extern page_buf_t *pagebuf_get( /* allocate a buffer */ extern xfs_buf_t *pagebuf_get( /* allocate a buffer */
struct pb_target *, /* inode for buffer */ xfs_buftarg_t *, /* inode for buffer */
loff_t, /* starting offset of range */ loff_t, /* starting offset of range */
size_t, /* length of range */ size_t, /* length of range */
page_buf_flags_t); /* PBF_LOCK, PBF_READ, */ page_buf_flags_t); /* PBF_LOCK, PBF_READ, */
/* PBF_ASYNC */ /* PBF_ASYNC */
extern page_buf_t *pagebuf_lookup( extern xfs_buf_t *pagebuf_lookup(
struct pb_target *, xfs_buftarg_t *,
loff_t, /* starting offset of range */ loff_t, /* starting offset of range */
size_t, /* length of range */ size_t, /* length of range */
page_buf_flags_t); /* PBF_READ, PBF_WRITE, */ page_buf_flags_t); /* PBF_READ, PBF_WRITE, */
/* PBF_FORCEIO, */ /* PBF_FORCEIO, */
extern page_buf_t *pagebuf_get_empty( /* allocate pagebuf struct with */ extern xfs_buf_t *pagebuf_get_empty( /* allocate pagebuf struct with */
/* no memory or disk address */ /* no memory or disk address */
size_t len, size_t len,
struct pb_target *); /* mount point "fake" inode */ xfs_buftarg_t *); /* mount point "fake" inode */
extern page_buf_t *pagebuf_get_no_daddr(/* allocate pagebuf struct */ extern xfs_buf_t *pagebuf_get_no_daddr(/* allocate pagebuf struct */
/* without disk address */ /* without disk address */
size_t len, size_t len,
struct pb_target *); /* mount point "fake" inode */ xfs_buftarg_t *); /* mount point "fake" inode */
extern int pagebuf_associate_memory( extern int pagebuf_associate_memory(
page_buf_t *, xfs_buf_t *,
void *, void *,
size_t); size_t);
extern void pagebuf_hold( /* increment reference count */ extern void pagebuf_hold( /* increment reference count */
page_buf_t *); /* buffer to hold */ xfs_buf_t *); /* buffer to hold */
extern void pagebuf_readahead( /* read ahead into cache */ extern void pagebuf_readahead( /* read ahead into cache */
struct pb_target *, /* target for buffer (or NULL) */ xfs_buftarg_t *, /* target for buffer (or NULL) */
loff_t, /* starting offset of range */ loff_t, /* starting offset of range */
size_t, /* length of range */ size_t, /* length of range */
page_buf_flags_t); /* additional read flags */ page_buf_flags_t); /* additional read flags */
...@@ -224,63 +216,63 @@ extern void pagebuf_readahead( /* read ahead into cache */ ...@@ -224,63 +216,63 @@ extern void pagebuf_readahead( /* read ahead into cache */
/* Releasing Buffers */ /* Releasing Buffers */
extern void pagebuf_free( /* deallocate a buffer */ extern void pagebuf_free( /* deallocate a buffer */
page_buf_t *); /* buffer to deallocate */ xfs_buf_t *); /* buffer to deallocate */
extern void pagebuf_rele( /* release hold on a buffer */ extern void pagebuf_rele( /* release hold on a buffer */
page_buf_t *); /* buffer to release */ xfs_buf_t *); /* buffer to release */
/* Locking and Unlocking Buffers */ /* Locking and Unlocking Buffers */
extern int pagebuf_cond_lock( /* lock buffer, if not locked */ extern int pagebuf_cond_lock( /* lock buffer, if not locked */
/* (returns -EBUSY if locked) */ /* (returns -EBUSY if locked) */
page_buf_t *); /* buffer to lock */ xfs_buf_t *); /* buffer to lock */
extern int pagebuf_lock_value( /* return count on lock */ extern int pagebuf_lock_value( /* return count on lock */
page_buf_t *); /* buffer to check */ xfs_buf_t *); /* buffer to check */
extern int pagebuf_lock( /* lock buffer */ extern int pagebuf_lock( /* lock buffer */
page_buf_t *); /* buffer to lock */ xfs_buf_t *); /* buffer to lock */
extern void pagebuf_unlock( /* unlock buffer */ extern void pagebuf_unlock( /* unlock buffer */
page_buf_t *); /* buffer to unlock */ xfs_buf_t *); /* buffer to unlock */
/* Buffer Read and Write Routines */ /* Buffer Read and Write Routines */
extern void pagebuf_iodone( /* mark buffer I/O complete */ extern void pagebuf_iodone( /* mark buffer I/O complete */
page_buf_t *, /* buffer to mark */ xfs_buf_t *, /* buffer to mark */
int, /* use data/log helper thread. */ int, /* use data/log helper thread. */
int); /* run completion locally, or in int); /* run completion locally, or in
* a helper thread. */ * a helper thread. */
extern void pagebuf_ioerror( /* mark buffer in error (or not) */ extern void pagebuf_ioerror( /* mark buffer in error (or not) */
page_buf_t *, /* buffer to mark */ xfs_buf_t *, /* buffer to mark */
unsigned int); /* error to store (0 if none) */ int); /* error to store (0 if none) */
extern int pagebuf_iostart( /* start I/O on a buffer */ extern int pagebuf_iostart( /* start I/O on a buffer */
page_buf_t *, /* buffer to start */ xfs_buf_t *, /* buffer to start */
page_buf_flags_t); /* PBF_LOCK, PBF_ASYNC, */ page_buf_flags_t); /* PBF_LOCK, PBF_ASYNC, */
/* PBF_READ, PBF_WRITE, */ /* PBF_READ, PBF_WRITE, */
/* PBF_DELWRI */ /* PBF_DELWRI */
extern int pagebuf_iorequest( /* start real I/O */ extern int pagebuf_iorequest( /* start real I/O */
page_buf_t *); /* buffer to convey to device */ xfs_buf_t *); /* buffer to convey to device */
extern int pagebuf_iowait( /* wait for buffer I/O done */ extern int pagebuf_iowait( /* wait for buffer I/O done */
page_buf_t *); /* buffer to wait on */ xfs_buf_t *); /* buffer to wait on */
extern void pagebuf_iomove( /* move data in/out of pagebuf */ extern void pagebuf_iomove( /* move data in/out of pagebuf */
page_buf_t *, /* buffer to manipulate */ xfs_buf_t *, /* buffer to manipulate */
size_t, /* starting buffer offset */ size_t, /* starting buffer offset */
size_t, /* length in buffer */ size_t, /* length in buffer */
caddr_t, /* data pointer */ caddr_t, /* data pointer */
page_buf_rw_t); /* direction */ page_buf_rw_t); /* direction */
static inline int pagebuf_iostrategy(page_buf_t *pb) static inline int pagebuf_iostrategy(xfs_buf_t *pb)
{ {
return pb->pb_strat ? pb->pb_strat(pb) : pagebuf_iorequest(pb); return pb->pb_strat ? pb->pb_strat(pb) : pagebuf_iorequest(pb);
} }
static inline int pagebuf_geterror(page_buf_t *pb) static inline int pagebuf_geterror(xfs_buf_t *pb)
{ {
return pb ? pb->pb_error : ENOMEM; return pb ? pb->pb_error : ENOMEM;
} }
...@@ -288,30 +280,23 @@ static inline int pagebuf_geterror(page_buf_t *pb) ...@@ -288,30 +280,23 @@ static inline int pagebuf_geterror(page_buf_t *pb)
/* Buffer Utility Routines */ /* Buffer Utility Routines */
extern caddr_t pagebuf_offset( /* pointer at offset in buffer */ extern caddr_t pagebuf_offset( /* pointer at offset in buffer */
page_buf_t *, /* buffer to offset into */ xfs_buf_t *, /* buffer to offset into */
size_t); /* offset */ size_t); /* offset */
/* Pinning Buffer Storage in Memory */ /* Pinning Buffer Storage in Memory */
extern void pagebuf_pin( /* pin buffer in memory */ extern void pagebuf_pin( /* pin buffer in memory */
page_buf_t *); /* buffer to pin */ xfs_buf_t *); /* buffer to pin */
extern void pagebuf_unpin( /* unpin buffered data */ extern void pagebuf_unpin( /* unpin buffered data */
page_buf_t *); /* buffer to unpin */ xfs_buf_t *); /* buffer to unpin */
extern int pagebuf_ispin( /* check if buffer is pinned */ extern int pagebuf_ispin( /* check if buffer is pinned */
page_buf_t *); /* buffer to check */ xfs_buf_t *); /* buffer to check */
/* Delayed Write Buffer Routines */ /* Delayed Write Buffer Routines */
#define PBDF_WAIT 0x01 extern void pagebuf_delwri_dequeue(xfs_buf_t *);
extern void pagebuf_delwri_flush(
pb_target_t *,
unsigned long,
int *);
extern void pagebuf_delwri_dequeue(
page_buf_t *);
/* Buffer Daemon Setup Routines */ /* Buffer Daemon Setup Routines */
...@@ -322,7 +307,7 @@ extern void pagebuf_terminate(void); ...@@ -322,7 +307,7 @@ extern void pagebuf_terminate(void);
#ifdef PAGEBUF_TRACE #ifdef PAGEBUF_TRACE
extern ktrace_t *pagebuf_trace_buf; extern ktrace_t *pagebuf_trace_buf;
extern void pagebuf_trace( extern void pagebuf_trace(
page_buf_t *, /* buffer being traced */ xfs_buf_t *, /* buffer being traced */
char *, /* description of operation */ char *, /* description of operation */
void *, /* arbitrary diagnostic value */ void *, /* arbitrary diagnostic value */
void *); /* return address */ void *); /* return address */
...@@ -369,7 +354,7 @@ extern void pagebuf_trace( ...@@ -369,7 +354,7 @@ extern void pagebuf_trace(
#define XFS_BUF_MANAGE PBF_FS_MANAGED #define XFS_BUF_MANAGE PBF_FS_MANAGED
#define XFS_BUF_UNMANAGE(x) ((x)->pb_flags &= ~PBF_FS_MANAGED) #define XFS_BUF_UNMANAGE(x) ((x)->pb_flags &= ~PBF_FS_MANAGED)
static inline void xfs_buf_undelay(page_buf_t *pb) static inline void xfs_buf_undelay(xfs_buf_t *pb)
{ {
if (pb->pb_flags & PBF_DELWRI) { if (pb->pb_flags & PBF_DELWRI) {
if (pb->pb_list.next != &pb->pb_list) { if (pb->pb_list.next != &pb->pb_list) {
...@@ -423,12 +408,6 @@ static inline void xfs_buf_undelay(page_buf_t *pb) ...@@ -423,12 +408,6 @@ static inline void xfs_buf_undelay(page_buf_t *pb)
#define XFS_BUF_BP_ISMAPPED(bp) 1 #define XFS_BUF_BP_ISMAPPED(bp) 1
typedef struct page_buf_s xfs_buf_t;
#define xfs_buf page_buf_s
typedef struct pb_target xfs_buftarg_t;
#define xfs_buftarg pb_target
#define XFS_BUF_DATAIO(x) ((x)->pb_flags |= PBF_FS_DATAIOD) #define XFS_BUF_DATAIO(x) ((x)->pb_flags |= PBF_FS_DATAIOD)
#define XFS_BUF_UNDATAIO(x) ((x)->pb_flags &= ~PBF_FS_DATAIOD) #define XFS_BUF_UNDATAIO(x) ((x)->pb_flags &= ~PBF_FS_DATAIOD)
...@@ -461,7 +440,7 @@ typedef struct pb_target xfs_buftarg_t; ...@@ -461,7 +440,7 @@ typedef struct pb_target xfs_buftarg_t;
#define XFS_BUF_PTR(bp) (xfs_caddr_t)((bp)->pb_addr) #define XFS_BUF_PTR(bp) (xfs_caddr_t)((bp)->pb_addr)
extern inline xfs_caddr_t xfs_buf_offset(page_buf_t *bp, size_t offset) extern inline xfs_caddr_t xfs_buf_offset(xfs_buf_t *bp, size_t offset)
{ {
if (bp->pb_flags & PBF_MAPPED) if (bp->pb_flags & PBF_MAPPED)
return XFS_BUF_PTR(bp) + offset; return XFS_BUF_PTR(bp) + offset;
...@@ -472,7 +451,7 @@ extern inline xfs_caddr_t xfs_buf_offset(page_buf_t *bp, size_t offset) ...@@ -472,7 +451,7 @@ extern inline xfs_caddr_t xfs_buf_offset(page_buf_t *bp, size_t offset)
pagebuf_associate_memory(bp, val, count) pagebuf_associate_memory(bp, val, count)
#define XFS_BUF_ADDR(bp) ((bp)->pb_bn) #define XFS_BUF_ADDR(bp) ((bp)->pb_bn)
#define XFS_BUF_SET_ADDR(bp, blk) \ #define XFS_BUF_SET_ADDR(bp, blk) \
((bp)->pb_bn = (page_buf_daddr_t)(blk)) ((bp)->pb_bn = (blk))
#define XFS_BUF_OFFSET(bp) ((bp)->pb_file_offset) #define XFS_BUF_OFFSET(bp) ((bp)->pb_file_offset)
#define XFS_BUF_SET_OFFSET(bp, off) \ #define XFS_BUF_SET_OFFSET(bp, off) \
((bp)->pb_file_offset = (off)) ((bp)->pb_file_offset = (off))
...@@ -517,15 +496,15 @@ extern inline xfs_caddr_t xfs_buf_offset(page_buf_t *bp, size_t offset) ...@@ -517,15 +496,15 @@ extern inline xfs_caddr_t xfs_buf_offset(page_buf_t *bp, size_t offset)
#define xfs_buf_get_flags(target, blkno, len, flags) \ #define xfs_buf_get_flags(target, blkno, len, flags) \
pagebuf_get((target), (blkno), (len), (flags)) pagebuf_get((target), (blkno), (len), (flags))
static inline int xfs_bawrite(void *mp, page_buf_t *bp) static inline int xfs_bawrite(void *mp, xfs_buf_t *bp)
{ {
bp->pb_fspriv3 = mp; bp->pb_fspriv3 = mp;
bp->pb_strat = xfs_bdstrat_cb; bp->pb_strat = xfs_bdstrat_cb;
xfs_buf_undelay(bp); xfs_buf_undelay(bp);
return pagebuf_iostart(bp, PBF_WRITE | PBF_ASYNC | PBF_RUN_QUEUES); return pagebuf_iostart(bp, PBF_WRITE | PBF_ASYNC | _PBF_RUN_QUEUES);
} }
static inline void xfs_buf_relse(page_buf_t *bp) static inline void xfs_buf_relse(xfs_buf_t *bp)
{ {
if (!bp->pb_relse) if (!bp->pb_relse)
pagebuf_unlock(bp); pagebuf_unlock(bp);
...@@ -553,13 +532,13 @@ static inline void xfs_buf_relse(page_buf_t *bp) ...@@ -553,13 +532,13 @@ static inline void xfs_buf_relse(page_buf_t *bp)
pagebuf_iomove((pb), (off), (len), NULL, PBRW_ZERO) pagebuf_iomove((pb), (off), (len), NULL, PBRW_ZERO)
static inline int XFS_bwrite(page_buf_t *pb) static inline int XFS_bwrite(xfs_buf_t *pb)
{ {
int iowait = (pb->pb_flags & PBF_ASYNC) == 0; int iowait = (pb->pb_flags & PBF_ASYNC) == 0;
int error = 0; int error = 0;
if (!iowait) if (!iowait)
pb->pb_flags |= PBF_RUN_QUEUES; pb->pb_flags |= _PBF_RUN_QUEUES;
xfs_buf_undelay(pb); xfs_buf_undelay(pb);
pagebuf_iostrategy(pb); pagebuf_iostrategy(pb);
...@@ -573,7 +552,7 @@ static inline int XFS_bwrite(page_buf_t *pb) ...@@ -573,7 +552,7 @@ static inline int XFS_bwrite(page_buf_t *pb)
#define XFS_bdwrite(pb) \ #define XFS_bdwrite(pb) \
pagebuf_iostart(pb, PBF_DELWRI | PBF_ASYNC) pagebuf_iostart(pb, PBF_DELWRI | PBF_ASYNC)
static inline int xfs_bdwrite(void *mp, page_buf_t *bp) static inline int xfs_bdwrite(void *mp, xfs_buf_t *bp)
{ {
bp->pb_strat = xfs_bdstrat_cb; bp->pb_strat = xfs_bdstrat_cb;
bp->pb_fspriv3 = mp; bp->pb_fspriv3 = mp;
...@@ -585,21 +564,6 @@ static inline int xfs_bdwrite(void *mp, page_buf_t *bp) ...@@ -585,21 +564,6 @@ static inline int xfs_bdwrite(void *mp, page_buf_t *bp)
#define xfs_iowait(pb) pagebuf_iowait(pb) #define xfs_iowait(pb) pagebuf_iowait(pb)
/*
* Go through all incore buffers, and release buffers
* if they belong to the given device. This is used in
* filesystem error handling to preserve the consistency
* of its metadata.
*/
#define xfs_binval(buftarg) xfs_flush_buftarg(buftarg)
#define XFS_bflush(buftarg) xfs_flush_buftarg(buftarg)
#define xfs_incore_relse(buftarg,delwri_only,wait) \
xfs_relse_buftarg(buftarg)
#define xfs_baread(target, rablkno, ralen) \ #define xfs_baread(target, rablkno, ralen) \
pagebuf_readahead((target), (rablkno), (ralen), PBF_DONT_BLOCK) pagebuf_readahead((target), (rablkno), (ralen), PBF_DONT_BLOCK)
...@@ -607,5 +571,24 @@ static inline int xfs_bdwrite(void *mp, page_buf_t *bp) ...@@ -607,5 +571,24 @@ static inline int xfs_bdwrite(void *mp, page_buf_t *bp)
#define xfs_buf_get_noaddr(len, target) pagebuf_get_no_daddr((len), (target)) #define xfs_buf_get_noaddr(len, target) pagebuf_get_no_daddr((len), (target))
#define xfs_buf_free(bp) pagebuf_free(bp) #define xfs_buf_free(bp) pagebuf_free(bp)
#endif /* __XFS_BUF_H__ */
/*
* Handling of buftargs.
*/
extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *);
extern void xfs_free_buftarg(xfs_buftarg_t *, int);
extern void xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int);
extern void xfs_incore_relse(xfs_buftarg_t *, int, int);
extern int xfs_flush_buftarg(xfs_buftarg_t *, int);
#define xfs_getsize_buftarg(buftarg) \
block_size((buftarg)->pbr_bdev)
#define xfs_readonly_buftarg(buftarg) \
bdev_read_only((buftarg)->pbr_bdev)
#define xfs_binval(buftarg) \
xfs_flush_buftarg(buftarg, 1)
#define XFS_bflush(buftarg) \
xfs_flush_buftarg(buftarg, 1)
#endif /* __XFS_BUF_H__ */
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include "xfs_rw.h" #include "xfs_rw.h"
#include <linux/dcache.h> #include <linux/dcache.h>
#include <linux/mman.h> /* for PROT_WRITE */
static struct vm_operations_struct linvfs_file_vm_ops; static struct vm_operations_struct linvfs_file_vm_ops;
...@@ -488,7 +487,7 @@ linvfs_mprotect( ...@@ -488,7 +487,7 @@ linvfs_mprotect(
if ((vp->v_type == VREG) && (vp->v_vfsp->vfs_flag & VFS_DMI)) { if ((vp->v_type == VREG) && (vp->v_vfsp->vfs_flag & VFS_DMI)) {
if ((vma->vm_flags & VM_MAYSHARE) && if ((vma->vm_flags & VM_MAYSHARE) &&
(newflags & PROT_WRITE) && !(vma->vm_flags & PROT_WRITE)) { (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE)) {
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
error = XFS_SEND_MMAP(mp, vma, VM_WRITE); error = XFS_SEND_MMAP(mp, vma, VM_WRITE);
......
...@@ -50,19 +50,19 @@ unsigned long xfs_physmem; ...@@ -50,19 +50,19 @@ unsigned long xfs_physmem;
*/ */
xfs_param_t xfs_params = { xfs_param_t xfs_params = {
/* MIN DFLT MAX */ /* MIN DFLT MAX */
.restrict_chown = { 0, 1, 1 }, .restrict_chown = { 0, 1, 1 },
.sgid_inherit = { 0, 0, 1 }, .sgid_inherit = { 0, 0, 1 },
.symlink_mode = { 0, 0, 1 }, .symlink_mode = { 0, 0, 1 },
.panic_mask = { 0, 0, 127 }, .panic_mask = { 0, 0, 127 },
.error_level = { 0, 3, 11 }, .error_level = { 0, 3, 11 },
.sync_interval = { HZ, 30*HZ, 60*HZ }, .sync_interval = { USER_HZ, 30*USER_HZ, 7200*USER_HZ },
.stats_clear = { 0, 0, 1 }, .stats_clear = { 0, 0, 1 },
.inherit_sync = { 0, 1, 1 }, .inherit_sync = { 0, 1, 1 },
.inherit_nodump = { 0, 1, 1 }, .inherit_nodump = { 0, 1, 1 },
.inherit_noatim = { 0, 1, 1 }, .inherit_noatim = { 0, 1, 1 },
.flush_interval = { HZ/2, HZ, 30*HZ }, .flush_interval = { USER_HZ/2, USER_HZ, 30*USER_HZ },
.age_buffer = { 1*HZ, 15*HZ, 300*HZ }, .age_buffer = { 1*USER_HZ, 15*USER_HZ, 7200*USER_HZ },
}; };
/* /*
......
...@@ -659,7 +659,7 @@ xfs_ioctl( ...@@ -659,7 +659,7 @@ xfs_ioctl(
case XFS_IOC_DIOINFO: { case XFS_IOC_DIOINFO: {
struct dioattr da; struct dioattr da;
pb_target_t *target = xfs_buftarg_t *target =
(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
mp->m_rtdev_targp : mp->m_ddev_targp; mp->m_rtdev_targp : mp->m_ddev_targp;
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/blkdev.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/file.h> #include <linux/file.h>
...@@ -134,13 +135,13 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) ...@@ -134,13 +135,13 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
#define irix_symlink_mode xfs_params.symlink_mode.val #define irix_symlink_mode xfs_params.symlink_mode.val
#define xfs_panic_mask xfs_params.panic_mask.val #define xfs_panic_mask xfs_params.panic_mask.val
#define xfs_error_level xfs_params.error_level.val #define xfs_error_level xfs_params.error_level.val
#define xfs_syncd_interval xfs_params.sync_interval.val #define xfs_syncd_interval (xfs_params.sync_interval.val * HZ / USER_HZ)
#define xfs_stats_clear xfs_params.stats_clear.val #define xfs_stats_clear xfs_params.stats_clear.val
#define xfs_inherit_sync xfs_params.inherit_sync.val #define xfs_inherit_sync xfs_params.inherit_sync.val
#define xfs_inherit_nodump xfs_params.inherit_nodump.val #define xfs_inherit_nodump xfs_params.inherit_nodump.val
#define xfs_inherit_noatime xfs_params.inherit_noatim.val #define xfs_inherit_noatime xfs_params.inherit_noatim.val
#define xfs_flush_interval xfs_params.flush_interval.val #define xfs_flush_interval (xfs_params.flush_interval.val * HZ / USER_HZ)
#define xfs_age_buffer xfs_params.age_buffer.val #define xfs_age_buffer (xfs_params.age_buffer.val * HZ / USER_HZ)
#define current_cpu() smp_processor_id() #define current_cpu() smp_processor_id()
#define current_pid() (current->pid) #define current_pid() (current->pid)
...@@ -247,10 +248,11 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) ...@@ -247,10 +248,11 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
#define howmany(x, y) (((x)+((y)-1))/(y)) #define howmany(x, y) (((x)+((y)-1))/(y))
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
static inline void xfs_stack_trace(void) #define xfs_stack_trace() dump_stack()
{
dump_stack(); #define xfs_itruncate_data(ip, off) \
} (-vmtruncate(LINVFS_GET_IP(XFS_ITOV(ip)), (off)))
/* Move the kernel do_div definition off to one side */ /* Move the kernel do_div definition off to one side */
......
...@@ -301,7 +301,7 @@ xfs_read( ...@@ -301,7 +301,7 @@ xfs_read(
/* END copy & waste from filemap.c */ /* END copy & waste from filemap.c */
if (ioflags & IO_ISDIRECT) { if (ioflags & IO_ISDIRECT) {
pb_target_t *target = xfs_buftarg_t *target =
(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
mp->m_rtdev_targp : mp->m_ddev_targp; mp->m_rtdev_targp : mp->m_ddev_targp;
if ((*offset & target->pbr_smask) || if ((*offset & target->pbr_smask) ||
...@@ -687,7 +687,7 @@ xfs_write( ...@@ -687,7 +687,7 @@ xfs_write(
} }
if (ioflags & IO_ISDIRECT) { if (ioflags & IO_ISDIRECT) {
pb_target_t *target = xfs_buftarg_t *target =
(xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? (xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
mp->m_rtdev_targp : mp->m_ddev_targp; mp->m_rtdev_targp : mp->m_ddev_targp;
......
...@@ -38,7 +38,7 @@ struct xfs_mount; ...@@ -38,7 +38,7 @@ struct xfs_mount;
struct xfs_iocore; struct xfs_iocore;
struct xfs_inode; struct xfs_inode;
struct xfs_bmbt_irec; struct xfs_bmbt_irec;
struct page_buf_s; struct xfs_buf;
struct xfs_iomap; struct xfs_iomap;
#if defined(XFS_RW_TRACE) #if defined(XFS_RW_TRACE)
...@@ -89,8 +89,8 @@ extern void xfs_inval_cached_trace(struct xfs_iocore *, ...@@ -89,8 +89,8 @@ extern void xfs_inval_cached_trace(struct xfs_iocore *,
extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int, extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
struct xfs_iomap *, int *); struct xfs_iomap *, int *);
extern int xfsbdstrat(struct xfs_mount *, struct page_buf_s *); extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
extern int xfs_bdstrat_cb(struct page_buf_s *); extern int xfs_bdstrat_cb(struct xfs_buf *);
extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t, extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t,
xfs_fsize_t, xfs_fsize_t); xfs_fsize_t, xfs_fsize_t);
......
/* /*
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_version.h" #include "xfs_version.h"
#include <linux/blkdev.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mount.h> #include <linux/mount.h>
...@@ -153,8 +152,7 @@ xfs_set_inodeops( ...@@ -153,8 +152,7 @@ xfs_set_inodeops(
inode->i_mapping->a_ops = &linvfs_aops; inode->i_mapping->a_ops = &linvfs_aops;
} else { } else {
inode->i_op = &linvfs_file_inode_operations; inode->i_op = &linvfs_file_inode_operations;
init_special_inode(inode, inode->i_mode, init_special_inode(inode, inode->i_mode, inode->i_rdev);
inode->i_rdev);
} }
} }
...@@ -283,75 +281,6 @@ xfs_blkdev_put( ...@@ -283,75 +281,6 @@ xfs_blkdev_put(
close_bdev_excl(bdev); close_bdev_excl(bdev);
} }
void
xfs_flush_buftarg(
xfs_buftarg_t *btp)
{
pagebuf_delwri_flush(btp, PBDF_WAIT, NULL);
}
void
xfs_free_buftarg(
xfs_buftarg_t *btp)
{
xfs_flush_buftarg(btp);
kmem_free(btp, sizeof(*btp));
}
int
xfs_readonly_buftarg(
xfs_buftarg_t *btp)
{
return bdev_read_only(btp->pbr_bdev);
}
void
xfs_relse_buftarg(
xfs_buftarg_t *btp)
{
invalidate_bdev(btp->pbr_bdev, 1);
truncate_inode_pages(btp->pbr_mapping, 0LL);
}
unsigned int
xfs_getsize_buftarg(
xfs_buftarg_t *btp)
{
return block_size(btp->pbr_bdev);
}
void
xfs_setsize_buftarg(
xfs_buftarg_t *btp,
unsigned int blocksize,
unsigned int sectorsize)
{
btp->pbr_bsize = blocksize;
btp->pbr_sshift = ffs(sectorsize) - 1;
btp->pbr_smask = sectorsize - 1;
if (set_blocksize(btp->pbr_bdev, sectorsize)) {
printk(KERN_WARNING
"XFS: Cannot set_blocksize to %u on device %s\n",
sectorsize, XFS_BUFTARG_NAME(btp));
}
}
xfs_buftarg_t *
xfs_alloc_buftarg(
struct block_device *bdev)
{
xfs_buftarg_t *btp;
btp = kmem_zalloc(sizeof(*btp), KM_SLEEP);
btp->pbr_dev = bdev->bd_dev;
btp->pbr_bdev = bdev;
btp->pbr_mapping = bdev->bd_inode->i_mapping;
xfs_setsize_buftarg(btp, PAGE_CACHE_SIZE, bdev_hardsect_size(bdev));
return btp;
}
STATIC struct inode * STATIC struct inode *
linvfs_alloc_inode( linvfs_alloc_inode(
...@@ -448,7 +377,8 @@ linvfs_clear_inode( ...@@ -448,7 +377,8 @@ linvfs_clear_inode(
#define SYNCD_FLAGS (SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR) #define SYNCD_FLAGS (SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR)
STATIC int STATIC int
syncd(void *arg) xfssyncd(
void *arg)
{ {
vfs_t *vfsp = (vfs_t *) arg; vfs_t *vfsp = (vfs_t *) arg;
int error; int error;
...@@ -480,20 +410,22 @@ syncd(void *arg) ...@@ -480,20 +410,22 @@ syncd(void *arg)
} }
STATIC int STATIC int
linvfs_start_syncd(vfs_t *vfsp) linvfs_start_syncd(
vfs_t *vfsp)
{ {
int pid; int pid;
pid = kernel_thread(syncd, (void *) vfsp, pid = kernel_thread(xfssyncd, (void *) vfsp,
CLONE_VM | CLONE_FS | CLONE_FILES); CLONE_VM | CLONE_FS | CLONE_FILES);
if (pid < 0) if (pid < 0)
return pid; return -pid;
wait_event(vfsp->vfs_wait_sync_task, vfsp->vfs_sync_task); wait_event(vfsp->vfs_wait_sync_task, vfsp->vfs_sync_task);
return 0; return 0;
} }
STATIC void STATIC void
linvfs_stop_syncd(vfs_t *vfsp) linvfs_stop_syncd(
vfs_t *vfsp)
{ {
vfsp->vfs_flag |= VFS_UMOUNT; vfsp->vfs_flag |= VFS_UMOUNT;
wmb(); wmb();
...@@ -735,7 +667,7 @@ linvfs_fill_super( ...@@ -735,7 +667,7 @@ linvfs_fill_super(
struct vfs *vfsp = vfs_allocate(); struct vfs *vfsp = vfs_allocate();
struct xfs_mount_args *args = xfs_args_allocate(sb); struct xfs_mount_args *args = xfs_args_allocate(sb);
struct kstatfs statvfs; struct kstatfs statvfs;
int error; int error, error2;
vfsp->vfs_super = sb; vfsp->vfs_super = sb;
LINVFS_SET_VFS(sb, vfsp); LINVFS_SET_VFS(sb, vfsp);
...@@ -776,11 +708,15 @@ linvfs_fill_super( ...@@ -776,11 +708,15 @@ linvfs_fill_super(
goto fail_unmount; goto fail_unmount;
sb->s_root = d_alloc_root(LINVFS_GET_IP(rootvp)); sb->s_root = d_alloc_root(LINVFS_GET_IP(rootvp));
if (!sb->s_root) if (!sb->s_root) {
error = ENOMEM;
goto fail_vnrele; goto fail_vnrele;
if (is_bad_inode(sb->s_root->d_inode)) }
if (is_bad_inode(sb->s_root->d_inode)) {
error = EINVAL;
goto fail_vnrele; goto fail_vnrele;
if (linvfs_start_syncd(vfsp)) }
if ((error = linvfs_start_syncd(vfsp)))
goto fail_vnrele; goto fail_vnrele;
vn_trace_exit(rootvp, __FUNCTION__, (inst_t *)__return_address); vn_trace_exit(rootvp, __FUNCTION__, (inst_t *)__return_address);
...@@ -796,7 +732,7 @@ linvfs_fill_super( ...@@ -796,7 +732,7 @@ linvfs_fill_super(
} }
fail_unmount: fail_unmount:
VFS_UNMOUNT(vfsp, 0, NULL, error); VFS_UNMOUNT(vfsp, 0, NULL, error2);
fail_vfsop: fail_vfsop:
vfs_deallocate(vfsp); vfs_deallocate(vfsp);
......
...@@ -112,7 +112,7 @@ extern void xfs_qm_exit(void); ...@@ -112,7 +112,7 @@ extern void xfs_qm_exit(void);
struct xfs_inode; struct xfs_inode;
struct xfs_mount; struct xfs_mount;
struct pb_target; struct xfs_buftarg;
struct block_device; struct block_device;
extern __uint64_t xfs_max_file_offset(unsigned int); extern __uint64_t xfs_max_file_offset(unsigned int);
...@@ -126,12 +126,4 @@ extern int xfs_blkdev_get(struct xfs_mount *, const char *, ...@@ -126,12 +126,4 @@ extern int xfs_blkdev_get(struct xfs_mount *, const char *,
struct block_device **); struct block_device **);
extern void xfs_blkdev_put(struct block_device *); extern void xfs_blkdev_put(struct block_device *);
extern struct pb_target *xfs_alloc_buftarg(struct block_device *);
extern void xfs_relse_buftarg(struct pb_target *);
extern void xfs_free_buftarg(struct pb_target *);
extern void xfs_flush_buftarg(struct pb_target *);
extern int xfs_readonly_buftarg(struct pb_target *);
extern void xfs_setsize_buftarg(struct pb_target *, unsigned int, unsigned int);
extern unsigned int xfs_getsize_buftarg(struct pb_target *);
#endif /* __XFS_SUPER_H__ */ #endif /* __XFS_SUPER_H__ */
...@@ -111,7 +111,7 @@ posix_acl_xattr_to_xfs( ...@@ -111,7 +111,7 @@ posix_acl_xattr_to_xfs(
return EINVAL; return EINVAL;
if (src->a_version != cpu_to_le32(POSIX_ACL_XATTR_VERSION)) if (src->a_version != cpu_to_le32(POSIX_ACL_XATTR_VERSION))
return EINVAL; return EOPNOTSUPP;
memset(dest, 0, sizeof(xfs_acl_t)); memset(dest, 0, sizeof(xfs_acl_t));
dest->acl_cnt = posix_acl_xattr_count(size); dest->acl_cnt = posix_acl_xattr_count(size);
......
/* /*
* Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
...@@ -224,12 +224,21 @@ xfs_dir2_leafn_add( ...@@ -224,12 +224,21 @@ xfs_dir2_leafn_add(
mp = dp->i_mount; mp = dp->i_mount;
tp = args->trans; tp = args->trans;
leaf = bp->data; leaf = bp->data;
/*
* Quick check just to make sure we are not going to index
* into other peoples memory
*/
if (index < 0)
return XFS_ERROR(EFSCORRUPTED);
/* /*
* If there are already the maximum number of leaf entries in * If there are already the maximum number of leaf entries in
* the block, if there are no stale entries it won't fit. * the block, if there are no stale entries it won't fit.
* Caller will do a split. If there are stale entries we'll do * Caller will do a split. If there are stale entries we'll do
* a compact. * a compact.
*/ */
if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == XFS_DIR2_MAX_LEAF_ENTS(mp)) { if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == XFS_DIR2_MAX_LEAF_ENTS(mp)) {
if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT))
return XFS_ERROR(ENOSPC); return XFS_ERROR(ENOSPC);
...@@ -828,12 +837,24 @@ xfs_dir2_leafn_rebalance( ...@@ -828,12 +837,24 @@ xfs_dir2_leafn_rebalance(
state->inleaf = !swap; state->inleaf = !swap;
else else
state->inleaf = state->inleaf =
swap ^ (args->hashval < INT_GET(leaf2->ents[0].hashval, ARCH_CONVERT)); swap ^ (blk1->index <= INT_GET(leaf1->hdr.count, ARCH_CONVERT));
/* /*
* Adjust the expected index for insertion. * Adjust the expected index for insertion.
*/ */
if (!state->inleaf) if (!state->inleaf)
blk2->index = blk1->index - INT_GET(leaf1->hdr.count, ARCH_CONVERT); blk2->index = blk1->index - INT_GET(leaf1->hdr.count, ARCH_CONVERT);
/*
* Finally sanity check just to make sure we are not returning a negative index
*/
if(blk2->index < 0) {
state->inleaf = 1;
blk2->index = 0;
cmn_err(CE_ALERT,
"xfs_dir2_leafn_rebalance: picked the wrong leaf? reverting orignal leaf: "
"blk1->index %d\n",
blk1->index);
}
} }
/* /*
......
...@@ -591,10 +591,11 @@ xfs_iomap_write_delay( ...@@ -591,10 +591,11 @@ xfs_iomap_write_delay(
firstblock = NULLFSBLOCK; firstblock = NULLFSBLOCK;
/* /*
* roundup the allocation request to m_dalign boundary if file size * Roundup the allocation request to a stripe unit (m_dalign) boundary
* is greater that 512K and we are allocating past the allocation eof * if the file size is >= stripe unit size, and we are allocating past
* the allocation eof.
*/ */
if (mp->m_dalign && (isize >= mp->m_dalign) && aeof) { if (mp->m_dalign && (isize >= XFS_FSB_TO_B(mp, mp->m_dalign)) && aeof) {
int eof; int eof;
xfs_fileoff_t new_last_fsb; xfs_fileoff_t new_last_fsb;
new_last_fsb = roundup_64(last_fsb, mp->m_dalign); new_last_fsb = roundup_64(last_fsb, mp->m_dalign);
......
...@@ -1126,22 +1126,11 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr) ...@@ -1126,22 +1126,11 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
void void
xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr) xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr)
{ {
int have_logdev = (mp->m_logdev_targp != mp->m_ddev_targp); if (mp->m_logdev_targp != mp->m_ddev_targp)
xfs_free_buftarg(mp->m_logdev_targp, 1);
if (mp->m_ddev_targp) { if (mp->m_rtdev_targp)
xfs_free_buftarg(mp->m_ddev_targp); xfs_free_buftarg(mp->m_rtdev_targp, 1);
mp->m_ddev_targp = NULL; xfs_free_buftarg(mp->m_ddev_targp, 0);
}
if (mp->m_rtdev_targp) {
xfs_blkdev_put(mp->m_rtdev_targp->pbr_bdev);
xfs_free_buftarg(mp->m_rtdev_targp);
mp->m_rtdev_targp = NULL;
}
if (mp->m_logdev_targp && have_logdev) {
xfs_blkdev_put(mp->m_logdev_targp->pbr_bdev);
xfs_free_buftarg(mp->m_logdev_targp);
mp->m_logdev_targp = NULL;
}
} }
int int
......
...@@ -213,9 +213,9 @@ xfs_cleanup(void) ...@@ -213,9 +213,9 @@ xfs_cleanup(void)
*/ */
STATIC int STATIC int
xfs_start_flags( xfs_start_flags(
struct vfs *vfs,
struct xfs_mount_args *ap, struct xfs_mount_args *ap,
struct xfs_mount *mp, struct xfs_mount *mp)
int ronly)
{ {
/* Values are in BBs */ /* Values are in BBs */
if ((ap->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) { if ((ap->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) {
...@@ -305,7 +305,7 @@ xfs_start_flags( ...@@ -305,7 +305,7 @@ xfs_start_flags(
* no recovery flag requires a read-only mount * no recovery flag requires a read-only mount
*/ */
if (ap->flags & XFSMNT_NORECOVERY) { if (ap->flags & XFSMNT_NORECOVERY) {
if (!ronly) { if (!(vfs->vfs_flag & VFS_RDONLY)) {
cmn_err(CE_WARN, cmn_err(CE_WARN,
"XFS: tried to mount a FS read-write without recovery!"); "XFS: tried to mount a FS read-write without recovery!");
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
...@@ -327,10 +327,12 @@ xfs_start_flags( ...@@ -327,10 +327,12 @@ xfs_start_flags(
*/ */
STATIC int STATIC int
xfs_finish_flags( xfs_finish_flags(
struct vfs *vfs,
struct xfs_mount_args *ap, struct xfs_mount_args *ap,
struct xfs_mount *mp, struct xfs_mount *mp)
int ronly)
{ {
int ronly = (vfs->vfs_flag & VFS_RDONLY);
/* Fail a mount where the logbuf is smaller then the log stripe */ /* Fail a mount where the logbuf is smaller then the log stripe */
if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) { if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) {
if ((ap->logbufsize == -1) && if ((ap->logbufsize == -1) &&
...@@ -420,7 +422,6 @@ xfs_mount( ...@@ -420,7 +422,6 @@ xfs_mount(
struct bhv_desc *p; struct bhv_desc *p;
struct xfs_mount *mp = XFS_BHVTOM(bhvp); struct xfs_mount *mp = XFS_BHVTOM(bhvp);
struct block_device *ddev, *logdev, *rtdev; struct block_device *ddev, *logdev, *rtdev;
int ronly = (vfsp->vfs_flag & VFS_RDONLY);
int flags = 0, error; int flags = 0, error;
ddev = vfsp->vfs_super->s_bdev; ddev = vfsp->vfs_super->s_bdev;
...@@ -472,13 +473,13 @@ xfs_mount( ...@@ -472,13 +473,13 @@ xfs_mount(
/* /*
* Setup flags based on mount(2) options and then the superblock * Setup flags based on mount(2) options and then the superblock
*/ */
error = xfs_start_flags(args, mp, ronly); error = xfs_start_flags(vfsp, args, mp);
if (error) if (error)
goto error; goto error;
error = xfs_readsb(mp); error = xfs_readsb(mp);
if (error) if (error)
goto error; goto error;
error = xfs_finish_flags(args, mp, ronly); error = xfs_finish_flags(vfsp, args, mp);
if (error) { if (error) {
xfs_freesb(mp); xfs_freesb(mp);
goto error; goto error;
...@@ -624,7 +625,7 @@ xfs_mntupdate( ...@@ -624,7 +625,7 @@ xfs_mntupdate(
if (*flags & MS_RDONLY) { if (*flags & MS_RDONLY) {
xfs_refcache_purge_mp(mp); xfs_refcache_purge_mp(mp);
pagebuf_delwri_flush(mp->m_ddev_targp, 0, NULL); xfs_flush_buftarg(mp->m_ddev_targp, 0);
xfs_finish_reclaim_all(mp, 0); xfs_finish_reclaim_all(mp, 0);
/* This loop must run at least twice. /* This loop must run at least twice.
...@@ -636,9 +637,11 @@ xfs_mntupdate( ...@@ -636,9 +637,11 @@ xfs_mntupdate(
*/ */
do { do {
VFS_SYNC(vfsp, REMOUNT_READONLY_FLAGS, NULL, error); VFS_SYNC(vfsp, REMOUNT_READONLY_FLAGS, NULL, error);
pagebuf_delwri_flush(mp->m_ddev_targp, PBDF_WAIT, pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);
&pincount); if (!pincount) {
if(0 == pincount) { delay(50); count++; } delay(50);
count++;
}
} while (count < 2); } while (count < 2);
/* Ok now write out an unmount record */ /* Ok now write out an unmount record */
......
...@@ -680,18 +680,12 @@ xfs_setattr( ...@@ -680,18 +680,12 @@ xfs_setattr(
* once it is a part of the transaction. * once it is a part of the transaction.
*/ */
if (mask & XFS_AT_SIZE) { if (mask & XFS_AT_SIZE) {
if (vap->va_size > ip->i_d.di_size) { code = 0;
if (vap->va_size > ip->i_d.di_size)
code = xfs_igrow_start(ip, vap->va_size, credp); code = xfs_igrow_start(ip, vap->va_size, credp);
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
} else if (vap->va_size <= ip->i_d.di_size) { if (!code)
xfs_iunlock(ip, XFS_ILOCK_EXCL); code = xfs_itruncate_data(ip, vap->va_size);
xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE,
(xfs_fsize_t)vap->va_size);
code = 0;
} else {
xfs_iunlock(ip, XFS_ILOCK_EXCL);
code = 0;
}
if (code) { if (code) {
ASSERT(tp == NULL); ASSERT(tp == NULL);
lock_flags &= ~XFS_ILOCK_EXCL; lock_flags &= ~XFS_ILOCK_EXCL;
......
...@@ -74,6 +74,8 @@ typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; ...@@ -74,6 +74,8 @@ typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
#ifdef __KERNEL__ #ifdef __KERNEL__
struct task_struct;
/* /*
* This is used to ensure we don't load something for the wrong architecture. * This is used to ensure we don't load something for the wrong architecture.
*/ */
......
...@@ -41,6 +41,8 @@ extern void* OpenPIC_Addr; ...@@ -41,6 +41,8 @@ extern void* OpenPIC_Addr;
extern void openpic_set_sources(int first_irq, int num_irqs, void *isr); extern void openpic_set_sources(int first_irq, int num_irqs, void *isr);
extern void openpic_init(int linux_irq_offset); extern void openpic_init(int linux_irq_offset);
extern void openpic_init_nmi_irq(u_int irq); extern void openpic_init_nmi_irq(u_int irq);
extern void openpic_hookup_cascade(u_int irq, char *name,
int (*cascade_fn)(struct pt_regs *));
extern u_int openpic_irq(void); extern u_int openpic_irq(void);
extern void openpic_eoi(void); extern void openpic_eoi(void);
extern void openpic_request_IPIs(void); extern void openpic_request_IPIs(void);
......
...@@ -41,8 +41,7 @@ static inline struct rw_semaphore *__rwsem_do_wake(struct rw_semaphore *sem, int ...@@ -41,8 +41,7 @@ static inline struct rw_semaphore *__rwsem_do_wake(struct rw_semaphore *sem, int
{ {
struct rwsem_waiter *waiter; struct rwsem_waiter *waiter;
struct list_head *next; struct list_head *next;
signed long oldcount; signed long oldcount, woken, loop;
int woken, loop;
rwsemtrace(sem,"Entering __rwsem_do_wake"); rwsemtrace(sem,"Entering __rwsem_do_wake");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment