All of lore.kernel.org
 help / color / mirror / Atom feed
* "Segmentation fault"message
From: yamazaki @ 2002-12-13  5:01 UTC (permalink / raw)
  To: linuxppc-embedded


hi.
we made custom board(cpu is MPC8245)
kernel is 2.4.18
our application sometimes stop with the message "Segmentation fault"or
"illegal instruction".
So i searched this message on kernel source code by grep command.
But i could not find this message "Segmentation fault".
somebody tell me where i can find this message "Segmentation fault"and
"illegal instruction".

----
yamazaki  yama@isd.mci.mei.co.jp

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply

* [ANNOUNCE] Fault-Injection Test Harness Project
From: Rusty Lynch @ 2002-12-13  5:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: fault-injection-developer, lclaudio, acme, olive, riel

Fault-Injection Test Harness Project
-------------------------------------

I am pleased to announce the formation of a new project for developing a
test harness for inserting faults into a running kernel.  The project is
based at http://fault-injection.sf.net, with a bitkeeper tree hosted at
http://fault-injection.bkbits.net:8080/linux-2.5/, and an IRC channel named
#fi on 206.103.61.170. (The DNS entry for the IRC address is about to
change, but the number should stay the same.)

The project started out to try to validate that a kernel driver was
acceptable for a carrier environment (the "mystical" hardened driver) :).
Now, it has morphed to building a general tool for inserting faults into
any part of the kernel to see if the kernel reacts in a way the test
developer expects.  We have kind of straw man design with some
_very_ early prototype work, but for the most part things are just 
now getting started. I know there are some people on this list that 
have some considerable experience in fault injection on other Unix's, 
and some of you have hinted to me in emails that you might be 
interested in creating some kind of fault injection tool for Linux.  
I just hope I can entice you into joining our efforts (even if you 
only want to give us some directional guidance.)

As mentioned we are developing off of a clone of the 2.5 tree that we
periodically sync.  A CVS tree and snapshots are available from the
sourceforge site for those that do not use bitkeeper, but they will always
lag behind.

        -rustyl




^ permalink raw reply

* Re: [BENCHMARK] short summary of LM bench performance of mm2 patch
From: Larry McVoy @ 2002-12-13  5:02 UTC (permalink / raw)
  To: Aniruddha M Marathe; +Cc: linux-kernel, Josh Fryman
In-Reply-To: <94F20261551DC141B6B559DC4910867201DF05@blr-m3-msg.wipro.com>

On Fri, Dec 13, 2002 at 10:29:11AM +0530, Aniruddha M Marathe wrote:
> Hi,
> Josh, please comment on the format.

Well, I'm not josh, but what is wrong with the default LMbench output
format?  It's much easier to see what's going on than what you posted.
-- 
---
Larry McVoy            	 lm at bitmover.com           http://www.bitmover.com/lm 

^ permalink raw reply

* CONFIG_IPV6
From: Matt Young @ 2002-12-13  4:59 UTC (permalink / raw)
  To: linux-kernel

My SUSE 2.4.19 sets and uses this flag and attbi uses ipv6.

make config likes to turn it off; is this right?

^ permalink raw reply

* [BENCHMARK] short summary of LM bench performance of mm2 patch
From: Aniruddha M Marathe @ 2002-12-13  4:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Josh Fryman

Hi,
Josh, please comment on the format.
Here is a short summary of performance of 2.5.51 mm2 as compared to 2.5.51 mm1 on LM bench. Figures below are 'median' of 5 results.

-------------------------------------------------------------------------------
For detailed results, please mail me so that I will send results individually.
-------------------------------------------------------------------------------

								2.5.51 mm1		2.5.51-mm2
==================================================================================
Processor, Processes - times in microseconds - smaller is better

1. Null call time decreased a bit.			0.46			0.44
2. increase in time for fork proc 			362			403
----------------------------------------------------------------------------------
Context switching - times in microseconds - smaller is better

1. 2p/16K ctxsw						5.01			4.84
----------------------------------------------------------------------------------
*Local* Communication latencies in microseconds - smaller is better
1. UDP							33			35
2. TCP							122			125
----------------------------------------------------------------------------------
File & VM system latencies in microseconds - smaller is better
1. 10K file delete					57			59
2. mmap latency						615			651
==================================================================================

Rest of the results are not much different.
	

Regards,
Aniruddha Marathe
WIPRO technologies, India
Aniruddha.marathe@wipro.com			
+91-80-5502001 extn 5092

^ permalink raw reply

* Re: Support for Arctic platform (405LP based)
From: Cort Dougan @ 2002-12-13  4:51 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <20021213043628.GI21319@zax.zax>


Would you be able to commit them to _2_4 instead so they're not in the
wildly divergent _2_4_devel tree?  That would definitely be handy when
trying to find where the working trees are.

} The patch below adds support for IBM's Arctic-II development system,
} based on the 405LP processor.  For now this is just the core support,
} more drivers coming soon.  Are there any objections, or suggestions
} for doing things better before I commit this to linuxppc_2_4_devel?
}
} In particular, I'd welcome comments on the handling of the bootstrap
} for Arctic:  the normal bootloader is PIBS, which is quite different
} from IBM OpenBIOS, but uses the same image format.  For now I'm *not*
} defining CONFIG_IBM_OPENBIOS, but duplicating the targets in the
} arch/ppc/boot/simple/Makefile so that we get a treeboot image.
}
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/boot/simple/Makefile linux-bartholomew/arch/ppc/boot/simple/Makefile
} --- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/boot/simple/Makefile	2002-10-03 12:09:32.000000000 +1000
} +++ linux-bartholomew/arch/ppc/boot/simple/Makefile	2002-12-12 14:32:18.000000000 +1100
} @@ -19,6 +19,12 @@
}  # Normally, we use the 'misc-simple.c' file for decompress_kernel and
}  # whatnot.  Sometimes we need to override this however.
}  MISC				:= ../common/misc-simple.o
} +ifeq ($(CONFIG_ARCTIC2),y)
} +ZIMAGE				:= zImage-TREE
} +ZIMAGEINITRD			:= zImage.initrd-TREE
} +TFTPIMAGE			:= /tftpboot/zImage.embedded
} +MISC				:= misc-embedded.o
} +endif
}  ifeq ($(CONFIG_IBM_OPENBIOS),y)
}  ZIMAGE				:= zImage-TREE
}  ZIMAGEINITRD			:= zImage.initrd-TREE
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/boot/simple/embed_config.c linux-bartholomew/arch/ppc/boot/simple/embed_config.c
} --- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/boot/simple/embed_config.c	2002-12-04 10:44:50.000000000 +1100
} +++ linux-bartholomew/arch/ppc/boot/simple/embed_config.c	2002-12-12 14:32:27.000000000 +1100
} @@ -941,6 +941,68 @@
}  #endif /* CONFIG_BEECH */
}  #endif /* CONFIG_IBM_OPENBIOS */
}
} +#ifdef CONFIG_ARCTIC2
} +/* Several bootloaders have been used on the Arctic.  We assume either
} + * SSX or PIBS */
} +
} +#define SSX_BIOS_ADDR 		0xFFFF0000
} +#define SSX_BIOS_GET_BOARD_INFO 0
} +#define	PIBS_BOARD_INFO_VECTOR	0xFFF62004
} +
} +struct ssx_bios_id {
} +	unsigned int boot_branch;	/* Branch to bootcode */
} +	char ssx_bios[8];		/* "SSX BIOS" (no \0) */
} +	void (*bios_entry_point)(unsigned int, bd_t *); /* Call bios_entry_point(cmd, &data) */
} +};
} +
} +extern int memcmp(const void *s1, const void *s2, size_t n);
} +
} +static void get_board_info(bd_t **bdp)
} +{
} +	struct ssx_bios_id *ssx = (struct ssx_bios_id *)SSX_BIOS_ADDR;
} +
} +	/* Check for SSX signature */
} +
} +	if (memcmp(&ssx->ssx_bios, "SSX BIOS", 8) == 0) {
} +		ssx->bios_entry_point(SSX_BIOS_GET_BOARD_INFO, *bdp);
} +	} else {
} +		/* It's not SSX, so assume PIBS */
} +		typedef void (*PFV)(bd_t *bd);
} +		((PFV)(*(unsigned long *)PIBS_BOARD_INFO_VECTOR))(*bdp);
} +	}
} +}
} +
} +void embed_config(bd_t **bdp)
} +{
} +        *bdp = &bdinfo;
} +	get_board_info(bdp);
} +	/* HACK! PIBS seems to get the UART clock wrong at the moment */
} +	mtdcr(DCRN_CPC0_CGCR0, (mfdcr(DCRN_CPC0_CGCR0) & ~0x003e0000) | 0x00160000);
} +#if 0
} +	/* Enable RefClk/4 mode for both UARTs */
} +	mtdcr(DCRN_CPC0_CR0, mfdcr(DCRN_CPC0_CR0) | 0x30000000);
} +#endif
} +}
} +
} +#endif
} +
} +#ifdef CONFIG_BEECH
} +static void
} +get_board_info(bd_t **bdp)
} +{
} +	typedef void (*PFV)(bd_t *bd);
} +	((PFV)(*(unsigned long *)BOARD_INFO_VECTOR))(*bdp);
} +	return;
} +}
} +
} +void
} +embed_config(bd_t **bdp)
} +{
} +        *bdp = &bdinfo;
} +	get_board_info(bdp);
} +}
} +#endif
} +
}  #ifdef CONFIG_EP405
}  #include <linux/serial_reg.h>
}
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/config.in linux-bartholomew/arch/ppc/config.in
} --- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/config.in	2002-10-03 12:09:32.000000000 +1000
} +++ linux-bartholomew/arch/ppc/config.in	2002-12-11 16:17:18.000000000 +1100
} @@ -73,7 +73,8 @@
}
}  if [ "$CONFIG_40x" = "y" ]; then
}      choice 'Machine Type'			\
} -	"Ash		CONFIG_ASH		\
} +	"Arctic-II	CONFIG_ARCTIC2		\
} +	 Ash		CONFIG_ASH		\
}  	 Ceder		CONFIG_CEDER		\
}  	 Beech		CONFIG_BEECH		\
}  	 CPCI405	CONFIG_CPCI405 		\
} @@ -309,10 +310,14 @@
}      define_bool CONFIG_IBM405_ERR77 y
}      define_bool CONFIG_IBM_OCP y
}    fi
} +  if [ "$CONFIG_ARCTIC2" = "y" ]; then
} +    define_bool CONFIG_405LP y
} +    define_bool CONFIG_IBM405_ERR77 y
} +    define_bool CONFIG_IBM_OCP y
} +  fi
}    if [ "$CONFIG_SYCAMORE" = "y" ]; then
}      define_bool CONFIG_405GPR y
}      define_bool CONFIG_BIOS_FIXUP y
} -    define_bool CONFIG_IBM_OPENBIOS y
}      define_bool CONFIG_IBM405_ERR77 y
}      define_bool CONFIG_IBM_OCP y
}    fi
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/Makefile linux-bartholomew/arch/ppc/platforms/Makefile
} --- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/Makefile	2002-08-08 15:04:56.000000000 +1000
} +++ linux-bartholomew/arch/ppc/platforms/Makefile	2002-12-11 16:00:06.000000000 +1100
} @@ -40,6 +40,7 @@
}  obj-$(CONFIG_RAINIER)		+= rainier.o ibmnp4gs.o
}  obj-$(CONFIG_APUS)		+= apus_setup.o
}  obj-$(CONFIG_BEECH)		+= beech.o ibm405lp.o
} +obj-$(CONFIG_ARCTIC2)		+= arctic2.o subzero.o ibm405lp.o
}  obj-$(CONFIG_SYCAMORE)		+= sycamore.o ibm405gpr.o
}
}  obj-$(CONFIG_EBONY)		+= ebony.o ibm440gp.o
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.c linux-bartholomew/arch/ppc/platforms/arctic2.c
} --- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.c	Thu Jan 01 10:00:00 1970
} +++ linux-bartholomew/arch/ppc/platforms/arctic2.c	Thu Dec 12 17:14:44 2002
} @@ -0,0 +1,113 @@
} +/*
} + * arch/ppc/platforms/arctic2.c  Platform setup for the IBM Arctic-2 reference platform
} + *					with the Subzero core card and Beech personality card
} + * 				      Based on beech.c by Bishop Brock
} + *
} + * This program is free software; you can redistribute it and/or modify
} + * it under the terms of the GNU General Public License as published by
} + * the Free Software Foundation; either version 2 of the License, or
} + * (at your option) any later version.
} + *
} + * This program is distributed in the hope that it will be useful,
} + * but WITHOUT ANY WARRANTY; without even the implied warranty of
} + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
} + * GNU General Public License for more details.
} + *
} + * You should have received a copy of the GNU General Public License
} + * along with this program; if not, write to the Free Software
} + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
} + *
} + * Copyright (C) 2002, International Business Machines Corporation
} + * All Rights Reserved.
} + *
} + * Ken Inoue
} + * IBM Thomas J. Watson Research Center
} + * keninoue@us.ibm.com
} + *
} + * David Gibson
} + * IBM Ozlabs, Canberra, Australia
} + * arctic@gibson.dropbear.id.au
} + */
} +
} +#include <linux/blk.h>
} +#include <linux/config.h>
} +#include <linux/init.h>
} +#include <linux/module.h>
} +#include <linux/param.h>
} +#include <linux/rtc.h>
} +#include <linux/string.h>
} +
} +#include <asm/delay.h>
} +#include <asm/io.h>
} +#include <asm/machdep.h>
} +#include <asm/page.h>
} +#include <asm/processor.h>
} +#include <asm/system.h>
} +#include <asm/time.h>
} +
} +#include <platforms/arctic2.h>
} +
} +void __init
} +board_setup_arch(void)
} +{
} +}
} +
} +/* All Arctic-2 core physical memory resources are direct-mapped at boot time.
} +*  Need to change that. */
} +
} +void __init
} +board_io_mapping(void)
} +{
} +	/* FIXME: yuck.  Need to get rid of these */
} +	io_block_mapping(ARCTIC2_FPGA8_VADDR, ARCTIC2_FPGA8_PADDR,
} +			 ARCTIC2_FPGA8_SIZE, _PAGE_IO);
} +	io_block_mapping(ARCTIC2_FPGA16_VADDR, ARCTIC2_FPGA16_PADDR,
} +			 ARCTIC2_FPGA16_SIZE, _PAGE_IO);
} +	io_block_mapping(SUBZERO_BEECH_PCMCIA_VADDR, SUBZERO_BEECH_PCMCIA_PADDR,
} +			 SUBZERO_BEECH_PCMCIA_SIZE, _PAGE_IO);
} +}
} +
} +void __init
} +board_setup_irq(void)
} +{
} +}
} +
} +void __init
} +board_init(void)
} +{
} +#ifdef CONFIG_PPC_RTC
} +	ppc_md.time_init = ibm405lp_time_init;
} +	ppc_md.set_rtc_time = ibm405lp_set_rtc_time;
} +	ppc_md.get_rtc_time = ibm405lp_get_rtc_time;
} +#endif
} +
} +	/* Set up the EBC, then Disable the LCD controller, which may have been
} +	   left on by the BIOS. */
} +
} +	subzero_core_ebc_setup();
} +
} +	/* Configure the Arctic-II specific EBC banks */
} +
} +	/* Bank 1: 16-bit FPGA peripherals (ethernet data, SDIO, USB, DOC)
} +	 * 1MB, RW, 16-bit at 0xf1000000-0xf10fffff */
} +	/* The access parameters are programmed assuming a 33Mhz EBC
} +	   clock, which is true for nearly all the operating points we
} +	   have defined:
} +	   	BME=0, TWT=5, CSN=0, OEN=1, WBN=1, WBF=1 TH=4
} +		RE=1, SOR=0, BEM=0, PEN=0
} +	 */
} +	mtdcri(DCRN_EBC0, BnAP(1), 0x02815900);
} +	mtdcri(DCRN_EBC0, BnCR(1), ARCTIC2_FPGA16_PADDR | 0x1a000);
} +
} +	/* Bank 2: 8-bit FPGA peripherals (switch/control, ethernet regs, TCPA)
} +	 * 1MB, RW, 8-bit at 0xf8000000-0xf80fffff */
} +	mtdcri(DCRN_EBC0, BnAP(2), 0x02815580);
} +	mtdcri(DCRN_EBC0, BnCR(2), ARCTIC2_FPGA8_PADDR | 0x18000);
} +
} +	mtdcri(DCRN_LCD0, DER, 0);
} +}
} +
} +/*
} + * Local variables:
} + * c-basic-offset: 8
} + * End: */
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.h linux-bartholomew/arch/ppc/platforms/arctic2.h
} --- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.h	Thu Jan 01 10:00:00 1970
} +++ linux-bartholomew/arch/ppc/platforms/arctic2.h	Thu Dec 12 16:52:42 2002
} @@ -0,0 +1,63 @@
} +/*
} + * arch/ppc/platforms/arctic2.h   Platform definitions for the IBM Arctic-II
} + *				based on beech.h by Bishop Brock
} + *
} + * This program is free software; you can redistribute it and/or modify
} + * it under the terms of the GNU General Public License as published by
} + * the Free Software Foundation; either version 2 of the License, or
} + * (at your option) any later version.
} + *
} + * This program is distributed in the hope that it will be useful,
} + * but WITHOUT ANY WARRANTY; without even the implied warranty of
} + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
} + * GNU General Public License for more details.
} + *
} + * You should have received a copy of the GNU General Public License
} + * along with this program; if not, write to the Free Software
} + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
} + *
} + * Copyright (C) 2002, International Business Machines Corporation
} + * All Rights Reserved.
} + *
} + * Ken Inoue
} + * IBM Thomas J. Watson Research Center
} + * keninoue@us.ibm.com
} + *
} + * David Gibson
} + * IBM Ozlabs, Canberra, Australia
} + * arctic@gibson.dropbear.id.au
} + *
} + */
} +
} +#ifdef __KERNEL__
} +#ifndef __ASM_ARCTIC2_H__
} +#define __ASM_ARCTIC2_H__
} +
} +#include <platforms/subzero.h>
} +
} +#ifndef __ASSEMBLY__
} +
} +#define ARCTIC2_FPGA8_PADDR	(0xf8000000)
} +#define ARCTIC2_FPGA8_VADDR	ARCTIC2_FPGA8_PADDR
} +#define ARCTIC2_FPGA8_SIZE	(768*1024)
} +
} +#define ARCTIC2_FPGA16_PADDR	(0xf9000000)
} +#define ARCTIC2_FPGA16_VADDR	ARCTIC2_FPGA16_PADDR
} +#define ARCTIC2_FPGA16_SIZE	(1024*1024)
} +
} +/* Arctic II uses the internal clock for UART. Note that the OPB
} +   frequency must be more than 2x the UART clock frequency. At OPB
} +   frequencies less than this the serial port will not function due to
} +   the way that SerClk is sampled.  We use 11.1111MHz as the frequency
} +   because it can be generated from a wide range of OPB frequencies we
} +   want to use. */
} +
} +#define PPC4xx_SERCLK_FREQ 11111111
} +
} +#define BASE_BAUD (PPC4xx_SERCLK_FREQ / 16)
} +
} +#define PPC4xx_MACHINE_NAME	"IBM Arctic II"
} +
} +#endif /* !__ASSEMBLY__ */
} +#endif /* __ASM_ARCTIC2_H__ */
} +#endif /* __KERNEL__ */
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.c linux-bartholomew/arch/ppc/platforms/subzero.c
} --- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.c	Thu Jan 01 10:00:00 1970
} +++ linux-bartholomew/arch/ppc/platforms/subzero.c	Thu Dec 12 14:57:18 2002
} @@ -0,0 +1,96 @@
} +/*
} + * arch/ppc/platforms/subzero.c  Platform setup for the IBM Subzero CPU core card.
} + *
} + *				Based on arctic1.c by Ken Inoue, which
} + *				was based on beech.c by Bishop Brock
} + *
} + * The source code contained herein is licensed under the IBM Public License
} + * Version 1.0, which has been approved by the Open Source Initiative.
} + * Copyright (C) 2002, International Business Machines Corporation
} + * All Rights Reserved.
} + *
} + * David Gibson
} + * IBM OzLabs, Canberra, Australia
} + * <dwg@au1.ibm.com>
} + */
} +
} +#include <linux/blk.h>
} +#include <linux/config.h>
} +#include <linux/init.h>
} +#include <linux/module.h>
} +#include <linux/param.h>
} +#include <linux/rtc.h>
} +#include <linux/string.h>
} +
} +#include <asm/delay.h>
} +#include <asm/io.h>
} +#include <asm/machdep.h>
} +#include <asm/page.h>
} +#include <asm/processor.h>
} +#include <asm/system.h>
} +#include <asm/time.h>
} +
} +/*
} +   Subzero core card physical memory map:
} +
} +   Main Memory (Initialized by the BIOS)
} +   =======================================================================
} +
} +   SDRAM (32 MB)     0x00000000 - 0x02000000
} +
} +   OPB Space: (Mapped virtual = physical in ppc4xx_setup.c)
} +   =======================================================================
} +
} +   UART0               	      0xEF600300
} +   UART1               	      0xEF600400
} +   IIC                 	      0xEF600500
} +   OPB Arbiter         	      0xEF600600
} +   GPIO Controller     	      0xEF600700
} +   CODEC Interface            0xEF600900
} +   Touch Panel Controller     0xEF600A00
} +   DES Controller             0xEF600B00
} +
} +
} +   EBC Space: (Mapped virtual = physical in board_io_mapping())
} +	      (EBC setup for personality cards left to individual card setups)
} +   Space             EBC Bank    Physical Addresses  EBC Base Address
} +   =========================================================================
} +   Boot/Linux Flash      0       FF000000 - FFFFFFFF  FF000000 (16MB)
} +
} +*/
} +
} +
} +/****************************************************************************
} + * EBC Setup
} + ****************************************************************************/
} +
} +/* The EBC is set up for Arctic1.  This may simply replicate the setup already
} +   done by the IBM BIOS for Arctic1 (possibly with some address map changes), or
} +   may be the first initialization if the board is booting from another BIOS.
} +   Virtually all that is required to boot Linux on Subzero is that the BIOS
} +   enable the memory controller, load a Linux image from flash, and run it.
} +
} +   For optimal dynamic frequency scaling the EBC settings will also vary as the
} +   frequency varies.
} +*/
} +
} +void __init
} +subzero_core_ebc_setup(void)
} +{
} +	ebc0_bnap_t ap;
} +
} +	/* Set EBC bank 0 for the boot/data flash.
} +
} +	   Access parameters assume 150ns Intel flash @ 66.66 MHz maximum bus
} +	   speed = 10 cycle access with 2 turnaround cycles (30 ns).
} +
} +	   NB: IBM BIOS sets this bank to burst, however bursting will never
} +	   happen in Linux because this region is mapped non-cacheable and
} +	   guarded, so it is set non-burst here. */
} +	ap.reg = mfdcri(DCRN_EBC0, BnAP(0)) & EBC0_BnAP_MASK;
} +	ap.fields.twt = 10;
} +	ap.fields.th = 2;
} +	mtdcri(DCRN_EBC0, BnAP(0), ap.reg);
} +
} +}
} +
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.h linux-bartholomew/arch/ppc/platforms/subzero.h
} --- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.h	Thu Jan 01 10:00:00 1970
} +++ linux-bartholomew/arch/ppc/platforms/subzero.h	Thu Dec 12 15:22:30 2002
} @@ -0,0 +1,114 @@
} +/*
} + * arch/ppc/platforms/subzero.h   Platform definitions for the IBM
} + *				Subzero card, based on beech.h by Bishop Brock
} + *
} + * This program is free software; you can redistribute it and/or modify
} + * it under the terms of the GNU General Public License as published by
} + * the Free Software Foundation; either version 2 of the License, or
} + * (at your option) any later version.
} + *
} + * This program is distributed in the hope that it will be useful,
} + * but WITHOUT ANY WARRANTY; without even the implied warranty of
} + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
} + * GNU General Public License for more details.
} + *
} + * You should have received a copy of the GNU General Public License
} + * along with this program; if not, write to the Free Software
} + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
} + *
} + * Copyright (C) 2002, International Business Machines Corporation
} + * All Rights Reserved.
} + *
} + * David Gibson
} + * IBM OzLabs, Canberra, Australia
} + * <arctic@gibson.dropbear.id.au>
} + *
} + * Ken Inoue
} + * IBM Thomas J. Watson Research Center
} + * <keninoue@us.ibm.com>
} + *
} + */
} +
} +#ifdef __KERNEL__
} +#ifndef __ASM_SUBZERO_CORE_H__
} +#define __ASM_SUBZERO_CORE_H__
} +
} +#include <platforms/ibm405lp.h>
} +
} +#ifndef __ASSEMBLY__
} +
} +#include <linux/types.h>
} +
} +/*
} + * Data structure defining board information maintained by the standard boot
} + * ROM on the IBM Subzero card. An effort has been made to
} + * keep the field names consistent with the 8xx 'bd_t' board info
} + * structures.
} + *
} + * Original Beech BIOS Definition:
} + *
} + * typedef struct board_cfg_data {
} + *    unsigned char     usr_config_ver[4];
} + *    unsigned long     timerclk_freq;
} + *    unsigned char     rom_sw_ver[30];
} + *    unsigned int      mem_size;
} + *    unsigned long     sysclock_period;
} + *    unsigned long     sys_speed;
} + *    unsigned long     cpu_speed;
} + *    unsigned long     vco_speed;
} + *    unsigned long     plb_speed;
} + *    unsigned long     opb_speed;
} + *    unsigned long     ebc_speed;
} + *  } bd_t;
} + */
} +
} +typedef struct board_info {
} +	unsigned char     bi_s_version[4];  /* Version of this structure */
} +	unsigned long     bi_tbfreq;        /* Frequency of SysTmrClk */
} +	unsigned char     bi_r_version[30]; /* Version of the IBM ROM */
} +	unsigned int      bi_memsize;       /* DRAM installed, in bytes */
} +	unsigned long     sysclock_period;  /* SysClk period in ns */
} +	unsigned long     sys_speed;        /* SysCLk frequency in Hz */
} +	unsigned long     bi_intfreq;       /* Processor speed, in Hz */
} +	unsigned long     vco_speed;        /* PLL VCO speed, in Hz */
} +	unsigned long     bi_busfreq;       /* PLB Bus speed, in Hz */
} +	unsigned long     opb_speed;        /* OPB Bus speed, in Hz */
} +	unsigned long     ebc_speed;        /* EBC Bus speed, in Hz */
} +
} +} bd_t;
} +
} +/* EBC Bank 0 controls the boot flash
} + *
} + * FIXME? these values assume that there is 16MB of flash on the
} + * personality card, in addition to the 16MB on the subzero card
} + * itself */
} +#define SUBZERO_BANK0_PADDR      ((uint)0xfe000000)
} +#define SUBZERO_BANK0_EBC_SIZE   EBC0_BnCR_BS_32MB
} +
} +#define SUBZERO_BOOTFLASH_PADDR  (SUBZERO_BANK0_PADDR)
} +#define SUBZERO_BOOTFLASH_SIZE   ((uint)(32 * 1024 * 1024))
} +
} +/* The PCMCIA controller driver 4xx_pccf.c is responsible for the EBC setup of
} +   PCMCIA.  Externally, EBC bank selects 3..7 take on PCMCIA functions when
} +   PCMCIA is enabled. */
} +
} +#define SUBZERO_BEECH_PCMCIA_PADDR     ((uint)0xf0000000)
} +#define SUBZERO_BEECH_PCMCIA_VADDR     SUBZERO_BEECH_PCMCIA_PADDR
} +#define SUBZERO_BEECH_PCMCIA_SIZE      ((uint)(32 * 1024 * 1024))
} +
} +#define SUBZERO_BEECH_PCMCIA_IO_BASE (SUBZERO_BEECH_PCMCIA_VADDR + 0x01800000)
} +
} +/* Define _IO_BASE for PCMCIA; other defines are required as well. */
} +
} +#define _IO_BASE SUBZERO_BEECH_PCMCIA_IO_BASE
} +#define _ISA_MEM_BASE 0
} +#define PCI_DRAM_OFFSET 0
} +
} +void *beech_sram_alloc(size_t size);
} +int beech_sram_free(void *p);
} +
} +void subzero_core_ebc_setup(void);
} +
} +#endif /* !__ASSEMBLY__ */
} +#endif /* __ASM_SUBZERO_CORE_H__ */
} +#endif /* __KERNEL__ */
} diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/include/asm-ppc/ibm4xx.h linux-bartholomew/include/asm-ppc/ibm4xx.h
} --- /home/dgibson/kernel/linuxppc_2_4_devel/include/asm-ppc/ibm4xx.h	2002-08-05 10:37:17.000000000 +1000
} +++ linux-bartholomew/include/asm-ppc/ibm4xx.h	2002-12-12 15:50:48.000000000 +1100
} @@ -109,6 +109,10 @@
}  #include <platforms/beech.h>
}  #endif
}
} +#if defined(CONFIG_ARCTIC2)
} +#include <platforms/arctic2.h>
} +#endif
} +
}  #if defined(CONFIG_SYCAMORE)
}  #include <platforms/sycamore.h>
}  #endif
}
}
} --
} David Gibson			| For every complex problem there is a
} david@gibson.dropbear.id.au	| solution which is simple, neat and
} 				| wrong.
} http://www.ozlabs.org/people/dgibson
}

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply

* [PATCH] Add CONFIG_ACPI_RELAXED_AML option
From: NoZizzing OrDripping @ 2002-12-13  4:48 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 839 bytes --]

The patch adds a new configuration option,
CONFIG_ACPI_RELAXED_AML.  When turned on,
the ACPI code will become forgiving of minor
errors in the AML code.

For this first cut, the patch and option will ignore
region size errors.  An off-by-one error is often
found in the AML shipped with Toshiba laptops,
even new models. This minor error prevents the
AC module from operating without this patch.

I urge the adoption of this patch (or something
similar) into the ACPI code.  This will make it
much easier to install and proliferate Linux on
a large category of laptops.

Rick Richardson
rickr-EySxSuIQeMUAvxtiuMwx3w@public.gmane.org
[Sorry, have to use my Yahoo account to post to this list)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

[-- Attachment #2: relaxed-aml.diff --]
[-- Type: application/octet-stream, Size: 2169 bytes --]

diff -u -r linux-2.4.20+acpi-20021205/Documentation/Configure.help linux-2.4.20+acpi-20021205+rick/Documentation/Configure.help
--- linux-2.4.20+acpi-20021205/Documentation/Configure.help	2002-12-12 14:25:15.000000000 -0600
+++ linux-2.4.20+acpi-20021205+rick/Documentation/Configure.help	2002-12-12 13:42:40.000000000 -0600
@@ -18406,6 +18406,14 @@
   of verbosity. Saying Y enables these statements. This will increase
   your kernel size by around 50K.
 
+ACPI Relaxed AML Checking
+CONFIG_ACPI_RELAXED_AML
+  If you say `Y' here, the ACPI interpreter will relax its checking
+  for valid AML and will ignore some AML mistakes, such as off-by-one
+  errors in region sizes.  Some laptps may require this option.  In
+  particular, many Toshiba laptops require this for correct operation
+  of the AC module.
+
 ACPI Bus Manager
 CONFIG_ACPI_BUSMGR
   The ACPI Bus Manager enumerates devices in the ACPI namespace, and
diff -u -r linux-2.4.20+acpi-20021205/drivers/acpi/Config.in linux-2.4.20+acpi-20021205+rick/drivers/acpi/Config.in
--- linux-2.4.20+acpi-20021205/drivers/acpi/Config.in	2002-12-07 08:11:29.000000000 -0600
+++ linux-2.4.20+acpi-20021205+rick/drivers/acpi/Config.in	2002-12-12 13:31:23.000000000 -0600
@@ -36,6 +36,7 @@
       fi
       tristate     '  Toshiba Laptop Extras'	CONFIG_ACPI_TOSHIBA
       bool         '  Debug Statements'	CONFIG_ACPI_DEBUG
+      bool         '  Relaxed AML Checking'	CONFIG_ACPI_RELAXED_AML
     fi
   fi
 
diff -u -r linux-2.4.20+acpi-20021205/drivers/acpi/executer/exfldio.c linux-2.4.20+acpi-20021205+rick/drivers/acpi/executer/exfldio.c
--- linux-2.4.20+acpi-20021205/drivers/acpi/executer/exfldio.c	2002-12-07 08:11:30.000000000 -0600
+++ linux-2.4.20+acpi-20021205+rick/drivers/acpi/executer/exfldio.c	2002-12-12 14:04:49.000000000 -0600
@@ -121,7 +121,11 @@
 			field_datum_byte_offset, obj_desc->common_field.access_byte_width,
 			rgn_desc->region.node->name.ascii, rgn_desc->region.length));
 
-		return_ACPI_STATUS (AE_AML_REGION_LIMIT);
+		#ifdef CONFIG_ACPI_RELAXED_AML
+			return_ACPI_STATUS (AE_OK);
+		#else
+			return_ACPI_STATUS (AE_AML_REGION_LIMIT);
+		#endif
 	}
 
 	return_ACPI_STATUS (AE_OK);

^ permalink raw reply

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - parisc
From: Stephen Rothwell @ 2002-12-13  4:51 UTC (permalink / raw)
  To: willy; +Cc: linux-kernel
In-Reply-To: <20021213153439.1f3e466e.sfr@canb.auug.org.au>

Hi Willy,

Here is the parisc part of the patch.  Unfortunately, I realise this
breaks on parisc (there is an assumption that the compatibility
syscall routine names start with sys32_).  I will fix this in the
next patch (hopefully).
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/parisc/kernel/ioctl32.c 2.5.51-32bit.2/arch/parisc/kernel/ioctl32.c
--- 2.5.51-32bit.1/arch/parisc/kernel/ioctl32.c	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/parisc/kernel/ioctl32.c	2002-12-12 14:05:05.000000000 +1100
@@ -1366,9 +1366,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
@@ -1577,7 +1577,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+		err = put_user(kuid, (compat_uid_t *)arg);
 
 	return err;
 }
@@ -1864,7 +1864,7 @@
 } lv_status_byindex_req32_t;
 
 typedef struct {
-	__kernel_dev_t32 dev;
+	compat_dev_t dev;
 	u32   lv;
 } lv_status_bydev_req32_t;
 
@@ -3628,7 +3628,7 @@
 HANDLE_IOCTL(EXT2_IOC32_SETVERSION, do_ext2_ioctl)
 #if 0
 /* One SMB ioctl needs translations. */
-#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
+#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
 #endif
 HANDLE_IOCTL(ATM_GETLINKRATE32, do_atm_ioctl)
diff -ruN 2.5.51-32bit.1/arch/parisc/kernel/sys_parisc32.c 2.5.51-32bit.2/arch/parisc/kernel/sys_parisc32.c
--- 2.5.51-32bit.1/arch/parisc/kernel/sys_parisc32.c	2002-12-10 17:03:26.000000000 +1100
+++ 2.5.51-32bit.2/arch/parisc/kernel/sys_parisc32.c	2002-12-12 17:23:57.000000000 +1100
@@ -389,9 +389,9 @@
 struct flock32 {
 	short l_type;
 	short l_whence;
-	__kernel_off_t32 l_start;
-	__kernel_off_t32 l_len;
-	__kernel_pid_t32 l_pid;
+	compat_off_t l_start;
+	compat_off_t l_len;
+	compat_pid_t l_pid;
 };
 
 
@@ -674,7 +674,7 @@
 }
 
 asmlinkage int
-sys32_wait4(__kernel_pid_t32 pid, unsigned int * stat_addr, int options,
+sys32_wait4(compat_pid_t pid, unsigned int * stat_addr, int options,
 	    struct rusage32 * ru)
 {
 	if (!ru)
@@ -692,41 +692,13 @@
 	}
 }
 
-struct stat32 {
-	__kernel_dev_t32		st_dev;		/* dev_t is 32 bits on parisc */
-	__kernel_ino_t32		st_ino;		/* 32 bits */
-	__kernel_mode_t32	st_mode;	/* 16 bits */
-	__kernel_nlink_t32		st_nlink;	/* 16 bits */
-	unsigned short	st_reserved1;	/* old st_uid */
-	unsigned short	st_reserved2;	/* old st_gid */
-	__kernel_dev_t32		st_rdev;
-	__kernel_off_t32		st_size;
-	compat_time_t	st_atime;
-	unsigned int	st_spare1;
-	compat_time_t	st_mtime;
-	unsigned int	st_spare2;
-	compat_time_t	st_ctime;
-	unsigned int	st_spare3;
-	int		st_blksize;
-	int		st_blocks;
-	unsigned int	__unused1;	/* ACL stuff */
-	__kernel_dev_t32		__unused2;	/* network */
-	__kernel_ino_t32		__unused3;	/* network */
-	unsigned int	__unused4;	/* cnodes */
-	unsigned short	__unused5;	/* netsite */
-	short		st_fstype;
-	__kernel_dev_t32		st_realdev;
-	unsigned short	st_basemode;
-	unsigned short	st_spareshort;
-	__kernel_uid_t32		st_uid;
-	__kernel_gid_t32		st_gid;
-	unsigned int	st_spare4[3];
-};
-
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
 
+	if (stat->size > MAX_NON_LFS)
+		return -EOVERFLOW;
+
 	err  = put_user(stat->dev, &statbuf->st_dev);
 	err |= put_user(stat->ino, &statbuf->st_ino);
 	err |= put_user(stat->mode, &statbuf->st_mode);
@@ -734,8 +706,6 @@
 	err |= put_user(0, &statbuf->st_reserved1);
 	err |= put_user(0, &statbuf->st_reserved2);
 	err |= put_user(stat->rdev, &statbuf->st_rdev);
-	if (stat->size > MAX_NON_LFS)
-		return -EOVERFLOW;
 	err |= put_user(stat->size, &statbuf->st_size);
 	err |= put_user(stat->atime, &statbuf->st_atime);
 	err |= put_user(0, &statbuf->st_spare1);
@@ -763,42 +733,9 @@
 	return err;
 }
 
-asmlinkage long sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-
-	if (!error) 
-		error = cp_new_stat32(&stat, statbuf);
-	
-	return error;
-}
-
-asmlinkage long sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage long sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 struct linux32_dirent {
 	u32	d_ino;
-	__kernel_off_t32	d_off;
+	compat_off_t	d_off;
 	u16	d_reclen;
 	char	d_name[1];
 };
@@ -2619,7 +2556,7 @@
 	char			ex_client[NFSCLNT_IDMAX+1];
 	char			ex_path[NFS_MAXPATHLEN+1];
 	__kernel_dev_t		ex_dev;
-	__kernel_ino_t32	ex_ino;
+	compat_ino_t	ex_ino;
 	int			ex_flags;
 	__kernel_uid_t		ex_anon_uid;
 	__kernel_gid_t		ex_anon_gid;
@@ -2629,7 +2566,7 @@
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf_addr;
 	__kernel_dev_t		gf_dev;
-	__kernel_ino_t32	gf_ino;
+	compat_ino_t	gf_ino;
 	int			gf_version;
 };
 
diff -ruN 2.5.51-32bit.1/include/asm-parisc/compat.h 2.5.51-32bit.2/include/asm-parisc/compat.h
--- 2.5.51-32bit.1/include/asm-parisc/compat.h	2002-12-10 16:38:08.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-parisc/compat.h	2002-12-12 16:14:20.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u32		compat_uid_t;
+typedef u32		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u32		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,35 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;		/* dev_t is 32 bits on parisc */
+	compat_ino_t	st_ino;		/* 32 bits */
+	compat_mode_t	st_mode;	/* 16 bits */
+	compat_nlink_t	st_nlink;	/* 16 bits */
+	u16		st_reserved1;	/* old st_uid */
+	u16		st_reserved2;	/* old st_gid */
+	compat_dev_t	st_rdev;
+	compat_off_t	st_size;
+	compat_time_t	st_atime;
+	u32		st_spare1;
+	compat_time_t	st_mtime;
+	u32		st_spare2;
+	compat_time_t	st_ctime;
+	u32		st_spare3;
+	s32		st_blksize;
+	s32		st_blocks;
+	u32		__unused1;	/* ACL stuff */
+	compat_dev_t	__unused2;	/* network */
+	compat_ino_t	__unused3;	/* network */
+	u32		__unused4;	/* cnodes */
+	u16		__unused5;	/* netsite */
+	short		st_fstype;
+	compat_dev_t	st_realdev;
+	u16		st_basemode;
+	u16		st_spareshort;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	u32		st_spare4[3];
+};
+
 #endif /* _ASM_PARISC_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-parisc/posix_types.h 2.5.51-32bit.2/include/asm-parisc/posix_types.h
--- 2.5.51-32bit.1/include/asm-parisc/posix_types.h	2002-12-10 15:42:51.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-parisc/posix_types.h	2002-12-12 15:57:18.000000000 +1100
@@ -57,15 +57,7 @@
 
 #if defined(__KERNEL__) && defined(__LP64__)
 /* Now 32bit compatibility types */
-typedef unsigned int		__kernel_dev_t32;
-typedef unsigned int		__kernel_ino_t32;
-typedef unsigned short		__kernel_mode_t32;
-typedef unsigned short		__kernel_nlink_t32;
-typedef int			__kernel_off_t32;
-typedef int			__kernel_pid_t32;
 typedef unsigned short		__kernel_ipc_pid_t32;
-typedef unsigned int		__kernel_uid_t32;
-typedef unsigned int		__kernel_gid_t32;
 typedef int			__kernel_daddr_t32;
 typedef unsigned int		__kernel_caddr_t32;
 #endif

^ permalink raw reply

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - mips64
From: Stephen Rothwell @ 2002-12-13  4:48 UTC (permalink / raw)
  To: ralf; +Cc: linux-kernel
In-Reply-To: <20021213153439.1f3e466e.sfr@canb.auug.org.au>

Hi Ralf,

Here is the mips64 part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/mips64/kernel/linux32.c 2.5.51-32bit.2/arch/mips64/kernel/linux32.c
--- 2.5.51-32bit.1/arch/mips64/kernel/linux32.c	2002-12-10 17:00:58.000000000 +1100
+++ 2.5.51-32bit.2/arch/mips64/kernel/linux32.c	2002-12-12 17:23:21.000000000 +1100
@@ -40,9 +40,9 @@
  * Revalidate the inode. This is required for proper NFS attribute caching.
  */
 
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
-	struct stat32 tmp;
+	struct compat_stat tmp;
 
 	memset(&tmp, 0, sizeof(tmp));
 	tmp.st_dev = stat->dev;
@@ -61,39 +61,6 @@
 	return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
 }
 
-asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage long sys32_newfstat(unsigned int fd, struct stat32 * statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 asmlinkage int sys_mmap2(void) {return 0;}
 
 asmlinkage long sys_truncate(const char * path, unsigned long length);
@@ -479,7 +446,7 @@
 }
 
 asmlinkage int
-sys32_wait4(__kernel_pid_t32 pid, unsigned int * stat_addr, int options,
+sys32_wait4(compat_pid_t pid, unsigned int * stat_addr, int options,
 	    struct rusage32 * ru)
 {
 	if (!ru)
@@ -501,7 +468,7 @@
 }
 
 asmlinkage int
-sys32_waitpid(__kernel_pid_t32 pid, unsigned int *stat_addr, int options)
+sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
 {
 	return sys32_wait4(pid, stat_addr, options, NULL);
 }
@@ -1109,7 +1076,7 @@
 						struct timespec *interval);
 
 asmlinkage int
-sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct compat_timespec *interval)
+sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
 {
 	struct timespec t;
 	int ret;
@@ -1170,9 +1137,9 @@
 struct flock32 {
 	short l_type;
 	short l_whence;
-	__kernel_off_t32 l_start;
-	__kernel_off_t32 l_len;
-	__kernel_pid_t32 l_pid;
+	compat_off_t l_start;
+	compat_off_t l_len;
+	compat_pid_t l_pid;
 	short __unused;
 };
 
@@ -1249,11 +1216,11 @@
 struct ipc_perm32
 {
 	key_t    	  key;
-        __kernel_uid_t32  uid;
-        __kernel_gid_t32  gid;
-        __kernel_uid_t32  cuid;
-        __kernel_gid_t32  cgid;
-        __kernel_mode_t32 mode;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
         unsigned short  seq;
 };
 
diff -ruN 2.5.51-32bit.1/arch/mips64/kernel/scall_o32.S 2.5.51-32bit.2/arch/mips64/kernel/scall_o32.S
--- 2.5.51-32bit.1/arch/mips64/kernel/scall_o32.S	2002-12-10 17:02:02.000000000 +1100
+++ 2.5.51-32bit.2/arch/mips64/kernel/scall_o32.S	2002-12-13 14:54:29.000000000 +1100
@@ -339,9 +339,9 @@
 	sys	sys_syslog	3
 	sys	compat_sys_setitimer	3
 	sys	compat_sys_getitimer	2			/* 4105 */
-	sys	sys32_newstat	2
-	sys	sys32_newlstat	2
-	sys	sys32_newfstat	2
+	sys	compat_sys_newstat	2
+	sys	compat_sys_newlstat	2
+	sys	compat_sys_newfstat	2
 	sys	sys_ni_syscall	0	/* was sys_uname */
 	sys	sys_ni_syscall	0	/* sys_ioperm  *//* 4110 */
 	sys	sys_vhangup	0
diff -ruN 2.5.51-32bit.1/include/asm-mips64/compat.h 2.5.51-32bit.2/include/asm-mips64/compat.h
--- 2.5.51-32bit.1/include/asm-mips64/compat.h	2002-12-10 16:37:59.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-mips64/compat.h	2002-12-12 15:52:11.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef s32		compat_uid_t;
+typedef s32		compat_gid_t;
+typedef u32		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u32		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u32		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,27 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	s32		st_pad1[3];
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	s32		st_pad2[2];
+	compat_off_t	st_size;
+	s32		st_pad3;
+	compat_time_t	st_atime;
+	s32		reserved0;
+	compat_time_t	st_mtime;
+	s32		reserved1;
+	compat_time_t	st_ctime;
+	s32		reserved2;
+	s32		st_blksize;
+	s32		st_blocks;
+	s32		st_pad4[14];
+};
+
 #endif /* _ASM_MIPS64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-mips64/posix_types.h 2.5.51-32bit.2/include/asm-mips64/posix_types.h
--- 2.5.51-32bit.1/include/asm-mips64/posix_types.h	2002-12-10 15:42:41.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-mips64/posix_types.h	2002-12-12 15:52:36.000000000 +1100
@@ -49,15 +49,7 @@
 } __kernel_fsid_t;
 
 /* Now 32bit compatibility types */
-typedef unsigned int	__kernel_dev_t32;
-typedef unsigned int	__kernel_ino_t32;
-typedef unsigned int	__kernel_mode_t32;
-typedef unsigned int	__kernel_nlink_t32;
-typedef int		__kernel_off_t32;
-typedef int		__kernel_pid_t32;
 typedef int		__kernel_ipc_pid_t32;
-typedef int		__kernel_uid_t32;
-typedef int		__kernel_gid_t32;
 typedef int		__kernel_daddr_t32;
 typedef unsigned int	__kernel_caddr_t32;
 typedef __kernel_fsid_t	__kernel_fsid_t32;
diff -ruN 2.5.51-32bit.1/include/asm-mips64/stat.h 2.5.51-32bit.2/include/asm-mips64/stat.h
--- 2.5.51-32bit.1/include/asm-mips64/stat.h	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-mips64/stat.h	2002-12-12 15:20:36.000000000 +1100
@@ -10,7 +10,6 @@
 #define _ASM_STAT_H
 
 #include <linux/types.h>
-#include <linux/compat.h>
 
 struct __old_kernel_stat {
 	unsigned int	st_dev;
@@ -29,29 +28,6 @@
 	unsigned int	st_unused[2];
 };
 
-struct stat32 {
-	__kernel_dev_t32    st_dev;
-	int		    st_pad1[3];
-	__kernel_ino_t32    st_ino;
-	__kernel_mode_t32   st_mode;
-	__kernel_nlink_t32  st_nlink;
-	__kernel_uid_t32    st_uid;
-	__kernel_gid_t32    st_gid;
-	__kernel_dev_t32    st_rdev;
-	int		    st_pad2[2];
-	__kernel_off_t32    st_size;
-	int		    st_pad3;
-	compat_time_t     st_atime;
-	int		    reserved0;
-	compat_time_t     st_mtime;
-	int		    reserved1;
-	compat_time_t     st_ctime;
-	int		    reserved2;
-	int		    st_blksize;
-	int		    st_blocks;
-	int		    st_pad4[14];
-};
-
 /* The memory layout is the same as of struct stat64 of the 32-bit kernel.  */
 struct stat {
 	dev_t		st_dev;

^ permalink raw reply

* Re: R: Kernel bug handling TCP_RTO_MAX?
From: Nivedita Singhvi @ 2002-12-13  4:45 UTC (permalink / raw)
  To: Matti Aarnio
  Cc: Alan Cox, Andreani Stefano, David S. Miller,
	Linux Kernel Mailing List, linux-net
In-Reply-To: <20021213033928.GK32122@mea-ext.zmailer.org>

Matti Aarnio wrote:

> > Assuming you are on a local lan, your round trip
> > times are going to be much less than 200 ms, and
> > so using the TCP_RTO_MIN of 200ms ("The algorithm
> > ensures that the rto cant go below that").
> 
>   The RTO steps in only when there is a need to RETRANSMIT.
>   For that reason, it makes no sense to place its start
>   any shorter.

Not sure I understood your point clearly here - that things
are going to be broken, so dont kick it off too early?

For the most part, dropped packets are recovered by fast 
retransmit getting triggered. So when the retransmission 
timer goes off, I'd agree things are in all likelihood 
messed up. BUT..the default TCP_TIMEOUT_INIT = 300ms, which
is what the timeout calculation engine is fed to begin
with. After that, the actual measured round trip times
smooth out and help make the retransmit timeout accurate.

TCP_RTO_MIN is the lower bound for the rto. On fast
lans, though, if measured round trip times are say .01ms, 
and our MIN is 200ms, thats a thousand times the value - which 
means that we are reacting to events  too far back in time
on the fast lan scale.  If there was congestion
way back then, does that reflect conditions now?? 


> > So the minimum total time to time out a tcp connection
> > (barring application close) would be ~13 minutes in the
> > default case and 66 seconds with a modified TCP_RTO_MAX
> > of 6*HZ.
> 
>   You can have this by doing carefull non-blocking socket
>   coding, and protocol traffic monitoring along with
>   protocol level keepalive ping-pong packets to have
>   something flying around  (like NJE ping-pong, not
>   that every IBM person knows what that is/was..)

Er, this IBMer is unfortunately rather underinformed on that
subject ;) I'll look it up, but I can guestimate what you are 
referring to..True, but for the most part, getting every 
application to be performant and knowledgeable about 
network conditions and program accordingly is hard :). And 
if by protocol level you mean transport level, then we're back to 
altering the protocol. Wouldnt pingpongs just add to the
traffic under all conditions (I admit this is a rather lame point :)).

>   We try not to kill overloaded network routers while they
>   are trying to compensate some line breakage and doing
>   large-scale network topology re-routing.

Good point! :). I have little experience with Internet router traffic
snarls, and am certainly not arguing for a major alteration to
TCP exponential backoff :). See below..(the environment I was
thinking of..)

> > Particularly since we also retransmit 15 times, cant we conclude
> > "Its dead, Jim" earlier??
> 
>   No.  I have had LAN spanning-tree flaps taking 60 seconds
>   (actually a bit over 30 seconds), and years ago Linux's
>   TCP code timed out in that.  It was most annoying to
>   use some remote system thru such a network...

Urgh. Bletch. OK. But minor nit here - how often does that 
happen? Whats the right thing to do in that situation?
Which situation should we optimize our settings for?
I accept, though, that we need that kind of time frame..

>   When things _fail_ in the lan, what would be sensible value ?
>   How long will such abnormality last ?

Hmm, good questions, but ones I'm going to handwave at :).

One, my assumption that the ratio of the (say) ave expected
round trip times to the rto value should be around the same -
i.e why not be as conservative/aggressive as the normal default:

our default init rto is 300, so currently we're going to timeout
on anything thats a 100ms over the min of 200. that is far
less conservative than setting an rto of 200 when your round
trip time is a thousand or 10,000 times less..does that make sense?
 
The other assumption that I'm operating under is that when
things fail talking to a directly attached host - its because
that host has died (even if its only the app or the NIC, whatever).
i.e. the situation is that your connection is going to break,
except you are going to futilely retransmit 15 times and
wait an interminably long time before you do..hence the 
advantage of learning whats happening quickly..
 
>   In overload, resending quickly won't help a bit, just raise
>   the backoff (and prolong overload.)

See above..

>   Loosing a packet sometimes, and that way needing to retransmit
>   is the gray area I can't define quickly.  If it is rare, it
>   really does not matter.  If it happens often, there could be
>   so serious trouble that having quicker retransmit will only
>   aggreviate the trouble more.

Thats true..

>   You are looking for "STP" perhaps ?
>   It has a feature of waking all streams retransmits, in between
>   particular machines, when at least one STP frame travels in between
>   the hosts.
> 
>   I can't find it now from my RFC collection.  Odd at that..
>   Neither as a draft.  has it been abandoned ?

Learn something new every day :). Thanks for the ptr. I'll
look it up..

> > It would be wonderful if we could tune TCP on a per-interface or a
> > per-route basis (everything public, for a start, considered the
> > internet, and non-routable networks (10, etc), could be configured
> > suitably for its environment. (TCP over private LAN - rfc?). Trusting
> > users would be a big issue..
> >
> > Any thoughts? How stupid is this? Old hat??
> 
>   More and more of STP ..

thanks,
Nivedita

^ permalink raw reply

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - s390x
From: Stephen Rothwell @ 2002-12-13  4:46 UTC (permalink / raw)
  To: schwidefsky; +Cc: linux-kernel
In-Reply-To: <20021213153439.1f3e466e.sfr@canb.auug.org.au>

Hi Martin,

This is the s390x part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/entry.S 2.5.51-32bit.2/arch/s390x/kernel/entry.S
--- 2.5.51-32bit.1/arch/s390x/kernel/entry.S	2002-12-10 17:05:19.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/entry.S	2002-12-13 14:55:35.000000000 +1100
@@ -482,9 +482,9 @@
         .long  SYSCALL(sys_syslog,sys32_syslog_wrapper)
         .long  SYSCALL(sys_setitimer,compat_sys_setitimer_wrapper)
         .long  SYSCALL(sys_getitimer,compat_sys_getitimer_wrapper)   /* 105 */
-        .long  SYSCALL(sys_newstat,sys32_newstat_wrapper)
-        .long  SYSCALL(sys_newlstat,sys32_newlstat_wrapper)
-        .long  SYSCALL(sys_newfstat,sys32_newfstat_wrapper)
+        .long  SYSCALL(sys_newstat,compat_sys_newstat_wrapper)
+        .long  SYSCALL(sys_newlstat,compat_sys_newlstat_wrapper)
+        .long  SYSCALL(sys_newfstat,compat_sys_newfstat_wrapper)
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old uname syscall */
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* iopl for i386 */
         .long  SYSCALL(sys_vhangup,sys_vhangup)
diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/ioctl32.c 2.5.51-32bit.2/arch/s390x/kernel/ioctl32.c
--- 2.5.51-32bit.1/arch/s390x/kernel/ioctl32.c	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/ioctl32.c	2002-12-12 14:05:42.000000000 +1100
@@ -12,6 +12,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/compat.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/sched.h>
@@ -378,9 +379,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/linux32.c 2.5.51-32bit.2/arch/s390x/kernel/linux32.c
--- 2.5.51-32bit.1/arch/s390x/kernel/linux32.c	2002-12-10 17:05:51.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/linux32.c	2002-12-13 14:44:28.000000000 +1100
@@ -268,7 +268,7 @@
         __kernel_gid32_t        gid;
         __kernel_uid32_t        cuid;
         __kernel_gid32_t        cgid;
-        __kernel_mode_t32       mode;
+        compat_mode_t       mode;
         unsigned short          __pad1;
         unsigned short          seq;
         unsigned short          __pad2;
@@ -279,11 +279,11 @@
 struct ipc_perm32
 {
 	key_t    	  key;
-        __kernel_uid_t32  uid;
-        __kernel_gid_t32  gid;
-        __kernel_uid_t32  cuid;
-        __kernel_gid_t32  cgid;
-        __kernel_mode_t32 mode;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
         unsigned short  seq;
 };
 
@@ -337,8 +337,8 @@
 	unsigned int  msg_cbytes;
 	unsigned int  msg_qnum;
 	unsigned int  msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int  __unused1;
 	unsigned int  __unused2;
 };
@@ -364,8 +364,8 @@
 	unsigned int		__unused2;
 	compat_time_t  	shm_ctime;
 	unsigned int		__unused3;
-	__kernel_pid_t32	shm_cpid;
-	__kernel_pid_t32	shm_lpid;
+	compat_pid_t	shm_cpid;
+	compat_pid_t	shm_lpid;
 	unsigned int		shm_nattch;
 	unsigned int		__unused4;
 	unsigned int		__unused5;
@@ -1393,7 +1393,7 @@
 	return ret;
 }
 
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
 
@@ -1420,39 +1420,6 @@
 	return err;
 }
 
-asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2);
 
 asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2)
@@ -1463,16 +1430,16 @@
 struct ncp_mount_data32 {
         int version;
         unsigned int ncp_fd;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_pid_t32 wdog_pid;
+        compat_uid_t mounted_uid;
+        compat_pid_t wdog_pid;
         unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
         unsigned int time_out;
         unsigned int retry_count;
         unsigned int flags;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 static void *do_ncp_super_data_conv(void *raw_data)
@@ -1492,11 +1459,11 @@
 
 struct smb_mount_data32 {
         int version;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t mounted_uid;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 static void *do_smb_super_data_conv(void *raw_data)
@@ -1655,7 +1622,7 @@
 	return err;
 }
 
-asmlinkage int sys32_wait4(__kernel_pid_t32 pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
+asmlinkage int sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
 {
 	if (!ru)
 		return sys_wait4(pid, stat_addr, options, NULL);
@@ -1717,7 +1684,7 @@
 
 extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
 
-asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid,
+asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
 		struct compat_timespec *interval)
 {
 	struct timespec t;
@@ -3253,27 +3220,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_uid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_uid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -3402,7 +3369,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_uid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -3416,7 +3383,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return err;
 }
@@ -3680,7 +3647,7 @@
 
 extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
 
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count)
+asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -4147,7 +4114,7 @@
 extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
@@ -4171,7 +4138,7 @@
 extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_getaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/linux32.h 2.5.51-32bit.2/arch/s390x/kernel/linux32.h
--- 2.5.51-32bit.1/arch/s390x/kernel/linux32.h	2002-12-10 15:40:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/linux32.h	2002-12-12 16:11:15.000000000 +1100
@@ -16,17 +16,9 @@
 	((unsigned long)(__x))
 
 /* Now 32bit compatibility types */
-typedef int                    __kernel_pid_t32;
 typedef unsigned short         __kernel_ipc_pid_t32;
-typedef unsigned short         __kernel_uid_t32;
-typedef unsigned short         __kernel_gid_t32;
-typedef unsigned short         __kernel_dev_t32;
-typedef unsigned int           __kernel_ino_t32;
-typedef unsigned short         __kernel_mode_t32;
 typedef unsigned short         __kernel_umode_t32;
-typedef short                  __kernel_nlink_t32;
 typedef int                    __kernel_daddr_t32;
-typedef int                    __kernel_off_t32;
 typedef unsigned int           __kernel_caddr_t32;
 typedef long                   __kernel_loff_t32;
 typedef __kernel_fsid_t        __kernel_fsid_t32;  
@@ -43,35 +35,12 @@
 struct flock32 {
         short l_type;
         short l_whence;
-        __kernel_off_t32 l_start;
-        __kernel_off_t32 l_len;
-        __kernel_pid_t32 l_pid;
+        compat_off_t l_start;
+        compat_off_t l_len;
+        compat_pid_t l_pid;
         short __unused;
 }; 
 
-struct stat32 {
-	unsigned short	st_dev;
-	unsigned short	__pad1;
-	__u32		st_ino;
-	unsigned short	st_mode;
-	unsigned short	st_nlink;
-	unsigned short	st_uid;
-	unsigned short	st_gid;
-	unsigned short	st_rdev;
-	unsigned short	__pad2;
-	__u32		st_size;
-	__u32		st_blksize;
-	__u32		st_blocks;
-	__u32		st_atime;
-	__u32		__unused1;
-	__u32		st_mtime;
-	__u32		__unused2;
-	__u32		st_ctime;
-	__u32		__unused3;
-	__u32		__unused4;
-	__u32		__unused5;
-};
-
 struct statfs32 {
 	__s32			f_type;
 	__s32			f_bsize;
diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/wrapper32.S 2.5.51-32bit.2/arch/s390x/kernel/wrapper32.S
--- 2.5.51-32bit.1/arch/s390x/kernel/wrapper32.S	2002-12-10 17:04:36.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/wrapper32.S	2002-12-13 14:55:15.000000000 +1100
@@ -470,31 +470,31 @@
 	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# struct itimerval_emu31 *
 	llgtr	%r4,%r4			# struct itimerval_emu31 *
-	jg	compat_sys_setitimer		# branch to system call
+	jg	compat_sys_setitimer	# branch to system call
 
 	.globl  compat_sys_getitimer_wrapper 
 compat_sys_getitimer_wrapper:
 	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# struct itimerval_emu31 *
-	jg	compat_sys_getitimer		# branch to system call
+	jg	compat_sys_getitimer	# branch to system call
 
-	.globl  sys32_newstat_wrapper 
-sys32_newstat_wrapper:
+	.globl  compat_sys_newstat_wrapper 
+compat_sys_newstat_wrapper:
 	llgtr	%r2,%r2			# char *
 	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	sys32_newstat		# branch to system call
+	jg	compat_sys_newstat	# branch to system call
 
-	.globl  sys32_newlstat_wrapper 
-sys32_newlstat_wrapper:
+	.globl  compat_sys_newlstat_wrapper 
+compat_sys_newlstat_wrapper:
 	llgtr	%r2,%r2			# char *
 	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	sys32_newlstat		# branch to system call
+	jg	compat_sys_newlstat	# branch to system call
 
-	.globl  sys32_newfstat_wrapper 
-sys32_newfstat_wrapper:
+	.globl  compat_sys_newfstat_wrapper 
+compat_sys_newfstat_wrapper:
 	llgfr	%r2,%r2			# unsigned int
 	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	sys32_newfstat		# branch to system call
+	jg	compat_sys_newfstat	# branch to system call
 
 #sys32_vhangup_wrapper			# void 
 
diff -ruN 2.5.51-32bit.1/include/asm-s390x/compat.h 2.5.51-32bit.2/include/asm-s390x/compat.h
--- 2.5.51-32bit.1/include/asm-s390x/compat.h	2002-12-10 16:38:17.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-s390x/compat.h	2002-12-12 16:14:04.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,27 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	u16		__pad1;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	u16		__pad2;
+	u32		st_size;
+	u32		st_blksize;
+	u32		st_blocks;
+	u32		st_atime;
+	u32		__unused1;
+	u32		st_mtime;
+	u32		__unused2;
+	u32		st_ctime;
+	u32		__unused3;
+	u32		__unused4;
+	u32		__unused5;
+};
+
 #endif /* _ASM_S390X_COMPAT_H */

^ permalink raw reply

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - ia64
From: Stephen Rothwell @ 2002-12-13  4:44 UTC (permalink / raw)
  To: davidm; +Cc: linux-kernel
In-Reply-To: <20021213153439.1f3e466e.sfr@canb.auug.org.au>

Hi David,

This is the ia64 part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/ia64/ia32/ia32_entry.S 2.5.51-32bit.2/arch/ia64/ia32/ia32_entry.S
--- 2.5.51-32bit.1/arch/ia64/ia32/ia32_entry.S	2002-12-10 17:00:17.000000000 +1100
+++ 2.5.51-32bit.2/arch/ia64/ia32/ia32_entry.S	2002-12-13 14:54:13.000000000 +1100
@@ -297,9 +297,9 @@
 	data8 sys_syslog
 	data8 compat_sys_setitimer
 	data8 compat_sys_getitimer	  /* 105 */
-	data8 sys32_newstat
-	data8 sys32_newlstat
-	data8 sys32_newfstat
+	data8 compat_sys_newstat
+	data8 compat_sys_newlstat
+	data8 compat_sys_newfstat
 	data8 sys32_ni_syscall
 	data8 sys32_iopl		  /* 110 */
 	data8 sys_vhangup
diff -ruN 2.5.51-32bit.1/arch/ia64/ia32/sys_ia32.c 2.5.51-32bit.2/arch/ia64/ia32/sys_ia32.c
--- 2.5.51-32bit.1/arch/ia64/ia32/sys_ia32.c	2002-12-10 16:58:43.000000000 +1100
+++ 2.5.51-32bit.2/arch/ia64/ia32/sys_ia32.c	2002-12-12 17:22:58.000000000 +1100
@@ -175,8 +175,7 @@
 	return r;
 }
 
-static inline int
-putstat (struct stat32 *ubuf, struct kstat *stat)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *ubuf)
 {
 	int err;
 
@@ -202,42 +201,6 @@
 	return err;
 }
 
-asmlinkage long
-sys32_newstat (char *filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int ret = vfs_stat(filename, &stat);
-
-	if (!ret)
-		ret = putstat(statbuf, &stat);
-
-	return ret;
-}
-
-asmlinkage long
-sys32_newlstat (char *filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int ret = vfs_lstat(filename, &stat);
-
-	if (!ret)
-		ret = putstat(statbuf, &stat);
-
-	return ret;
-}
-
-asmlinkage long
-sys32_newfstat (unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int ret = vfs_fstat(fd, &stat);
-
-	if (!ret)
-		ret = putstat(statbuf, &stat);
-
-	return ret;
-}
-
 #if PAGE_SHIFT > IA32_PAGE_SHIFT
 
 
@@ -1872,11 +1835,11 @@
 
 struct ipc_perm32 {
 	key_t key;
-	__kernel_uid_t32 uid;
-	__kernel_gid_t32 gid;
-	__kernel_uid_t32 cuid;
-	__kernel_gid_t32 cgid;
-	__kernel_mode_t32 mode;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_uid_t cuid;
+	compat_gid_t cgid;
+	compat_mode_t mode;
 	unsigned short seq;
 };
 
@@ -1886,7 +1849,7 @@
 	__kernel_gid32_t32 gid;
 	__kernel_uid32_t32 cuid;
 	__kernel_gid32_t32 cgid;
-	__kernel_mode_t32 mode;
+	compat_mode_t mode;
 	unsigned short __pad1;
 	unsigned short seq;
 	unsigned short __pad2;
@@ -1943,8 +1906,8 @@
 	unsigned int msg_cbytes;
 	unsigned int msg_qnum;
 	unsigned int msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int __unused4;
 	unsigned int __unused5;
 };
@@ -1969,8 +1932,8 @@
 	unsigned int __unused2;
 	compat_time_t   shm_ctime;
 	unsigned int __unused3;
-	__kernel_pid_t32 shm_cpid;
-	__kernel_pid_t32 shm_lpid;
+	compat_pid_t shm_cpid;
+	compat_pid_t shm_lpid;
 	unsigned int shm_nattch;
 	unsigned int __unused4;
 	unsigned int __unused5;
@@ -3552,16 +3515,16 @@
 struct ncp_mount_data32 {
 	int version;
 	unsigned int ncp_fd;
-	__kernel_uid_t32 mounted_uid;
+	compat_uid_t mounted_uid;
 	int wdog_pid;
 	unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
 	unsigned int time_out;
 	unsigned int retry_count;
 	unsigned int flags;
-	__kernel_uid_t32 uid;
-	__kernel_gid_t32 gid;
-	__kernel_mode_t32 file_mode;
-	__kernel_mode_t32 dir_mode;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_mode_t file_mode;
+	compat_mode_t dir_mode;
 };
 
 static void *
@@ -3583,11 +3546,11 @@
 
 struct smb_mount_data32 {
 	int version;
-	__kernel_uid_t32 mounted_uid;
-	__kernel_uid_t32 uid;
-	__kernel_gid_t32 gid;
-	__kernel_mode_t32 file_mode;
-	__kernel_mode_t32 dir_mode;
+	compat_uid_t mounted_uid;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_mode_t file_mode;
+	compat_mode_t dir_mode;
 };
 
 static void *
@@ -3705,52 +3668,52 @@
 
 extern asmlinkage long sys_setreuid(uid_t ruid, uid_t euid);
 
-asmlinkage long sys32_setreuid(__kernel_uid_t32 ruid, __kernel_uid_t32 euid)
+asmlinkage long sys32_setreuid(compat_uid_t ruid, compat_uid_t euid)
 {
 	uid_t sruid, seuid;
 
-	sruid = (ruid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)ruid);
-	seuid = (euid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)euid);
+	sruid = (ruid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)ruid);
+	seuid = (euid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)euid);
 	return sys_setreuid(sruid, seuid);
 }
 
 extern asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid);
 
 asmlinkage long
-sys32_setresuid(__kernel_uid_t32 ruid, __kernel_uid_t32 euid,
-		__kernel_uid_t32 suid)
+sys32_setresuid(compat_uid_t ruid, compat_uid_t euid,
+		compat_uid_t suid)
 {
 	uid_t sruid, seuid, ssuid;
 
-	sruid = (ruid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)ruid);
-	seuid = (euid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)euid);
-	ssuid = (suid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)suid);
+	sruid = (ruid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)ruid);
+	seuid = (euid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)euid);
+	ssuid = (suid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)suid);
 	return sys_setresuid(sruid, seuid, ssuid);
 }
 
 extern asmlinkage long sys_setregid(gid_t rgid, gid_t egid);
 
 asmlinkage long
-sys32_setregid(__kernel_gid_t32 rgid, __kernel_gid_t32 egid)
+sys32_setregid(compat_gid_t rgid, compat_gid_t egid)
 {
 	gid_t srgid, segid;
 
-	srgid = (rgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)rgid);
-	segid = (egid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)egid);
+	srgid = (rgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)rgid);
+	segid = (egid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)egid);
 	return sys_setregid(srgid, segid);
 }
 
 extern asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid);
 
 asmlinkage long
-sys32_setresgid(__kernel_gid_t32 rgid, __kernel_gid_t32 egid,
-		__kernel_gid_t32 sgid)
+sys32_setresgid(compat_gid_t rgid, compat_gid_t egid,
+		compat_gid_t sgid)
 {
 	gid_t srgid, segid, ssgid;
 
-	srgid = (rgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)rgid);
-	segid = (egid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)egid);
-	ssgid = (sgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)sgid);
+	srgid = (rgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)rgid);
+	segid = (egid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)egid);
+	ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid);
 	return sys_setresgid(srgid, segid, ssgid);
 }
 
@@ -3772,27 +3735,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_uid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_uid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -3912,7 +3875,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_uid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -3927,7 +3890,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return err;
 }
diff -ruN 2.5.51-32bit.1/include/asm-ia64/compat.h 2.5.51-32bit.2/include/asm-ia64/compat.h
--- 2.5.51-32bit.1/include/asm-ia64/compat.h	2002-12-10 16:37:41.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-ia64/compat.h	2002-12-12 16:59:16.000000000 +1100
@@ -3,7 +3,6 @@
 /*
  * Architecture specific compatibility types
  */
-
 #include <linux/types.h>
 
 #define COMPAT_USER_HZ	100
@@ -12,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -23,4 +30,27 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	u16		__pad1;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compay_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	u16		__pad2;
+	u32		st_size;
+	u32		st_blksize;
+	u32		st_blocks;
+	u32		st_atime;
+	u32		__unused1;
+	u32		st_mtime;
+	u32		__unused2;
+	u32		st_ctime;
+	u32		__unused3;
+	u32		__unused4;
+	u32		__unused5;
+};
+
 #endif /* _ASM_IA64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-ia64/ia32.h 2.5.51-32bit.2/include/asm-ia64/ia32.h
--- 2.5.51-32bit.1/include/asm-ia64/ia32.h	2002-12-10 16:59:04.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-ia64/ia32.h	2002-12-12 15:08:44.000000000 +1100
@@ -13,19 +13,12 @@
  */
 
 /* 32bit compatibility types */
-typedef int		__kernel_pid_t32;
 typedef unsigned short	__kernel_ipc_pid_t32;
-typedef unsigned short	__kernel_uid_t32;
 typedef unsigned int	__kernel_uid32_t32;
-typedef unsigned short	__kernel_gid_t32;
 typedef unsigned int	__kernel_gid32_t32;
-typedef unsigned short	__kernel_dev_t32;
-typedef unsigned int	__kernel_ino_t32;
-typedef unsigned short	__kernel_mode_t32;
 typedef unsigned short	__kernel_umode_t32;
 typedef short		__kernel_nlink_t32;
 typedef int		__kernel_daddr_t32;
-typedef int		__kernel_off_t32;
 typedef unsigned int	__kernel_caddr_t32;
 typedef long		__kernel_loff_t32;
 typedef __kernel_fsid_t	__kernel_fsid_t32;
@@ -40,9 +33,9 @@
 struct flock32 {
        short l_type;
        short l_whence;
-       __kernel_off_t32 l_start;
-       __kernel_off_t32 l_len;
-       __kernel_pid_t32 l_pid;
+       compat_off_t l_start;
+       compat_off_t l_len;
+       compat_pid_t l_pid;
 };
 
 #define F_GETLK64	12
@@ -167,29 +160,6 @@
 	sigset_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
-struct stat32 {
-       unsigned short st_dev;
-       unsigned short __pad1;
-       unsigned int st_ino;
-       unsigned short st_mode;
-       unsigned short st_nlink;
-       unsigned short st_uid;
-       unsigned short st_gid;
-       unsigned short st_rdev;
-       unsigned short __pad2;
-       unsigned int  st_size;
-       unsigned int  st_blksize;
-       unsigned int  st_blocks;
-       unsigned int  st_atime;
-       unsigned int  __unused1;
-       unsigned int  st_mtime;
-       unsigned int  __unused2;
-       unsigned int  st_ctime;
-       unsigned int  __unused3;
-       unsigned int  __unused4;
-       unsigned int  __unused5;
-};
-
 struct stat64 {
 	unsigned short	st_dev;
 	unsigned char	__pad0[10];

^ permalink raw reply

* Support for Arctic platform (405LP based)
From: David Gibson @ 2002-12-13  4:36 UTC (permalink / raw)
  To: linuxppc-embedded


The patch below adds support for IBM's Arctic-II development system,
based on the 405LP processor.  For now this is just the core support,
more drivers coming soon.  Are there any objections, or suggestions
for doing things better before I commit this to linuxppc_2_4_devel?

In particular, I'd welcome comments on the handling of the bootstrap
for Arctic:  the normal bootloader is PIBS, which is quite different
from IBM OpenBIOS, but uses the same image format.  For now I'm *not*
defining CONFIG_IBM_OPENBIOS, but duplicating the targets in the
arch/ppc/boot/simple/Makefile so that we get a treeboot image.

diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/boot/simple/Makefile linux-bartholomew/arch/ppc/boot/simple/Makefile
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/boot/simple/Makefile	2002-10-03 12:09:32.000000000 +1000
+++ linux-bartholomew/arch/ppc/boot/simple/Makefile	2002-12-12 14:32:18.000000000 +1100
@@ -19,6 +19,12 @@
 # Normally, we use the 'misc-simple.c' file for decompress_kernel and
 # whatnot.  Sometimes we need to override this however.
 MISC				:= ../common/misc-simple.o
+ifeq ($(CONFIG_ARCTIC2),y)
+ZIMAGE				:= zImage-TREE
+ZIMAGEINITRD			:= zImage.initrd-TREE
+TFTPIMAGE			:= /tftpboot/zImage.embedded
+MISC				:= misc-embedded.o
+endif
 ifeq ($(CONFIG_IBM_OPENBIOS),y)
 ZIMAGE				:= zImage-TREE
 ZIMAGEINITRD			:= zImage.initrd-TREE
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/boot/simple/embed_config.c linux-bartholomew/arch/ppc/boot/simple/embed_config.c
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/boot/simple/embed_config.c	2002-12-04 10:44:50.000000000 +1100
+++ linux-bartholomew/arch/ppc/boot/simple/embed_config.c	2002-12-12 14:32:27.000000000 +1100
@@ -941,6 +941,68 @@
 #endif /* CONFIG_BEECH */
 #endif /* CONFIG_IBM_OPENBIOS */

+#ifdef CONFIG_ARCTIC2
+/* Several bootloaders have been used on the Arctic.  We assume either
+ * SSX or PIBS */
+
+#define SSX_BIOS_ADDR 		0xFFFF0000
+#define SSX_BIOS_GET_BOARD_INFO 0
+#define	PIBS_BOARD_INFO_VECTOR	0xFFF62004
+
+struct ssx_bios_id {
+	unsigned int boot_branch;	/* Branch to bootcode */
+	char ssx_bios[8];		/* "SSX BIOS" (no \0) */
+	void (*bios_entry_point)(unsigned int, bd_t *); /* Call bios_entry_point(cmd, &data) */
+};
+
+extern int memcmp(const void *s1, const void *s2, size_t n);
+
+static void get_board_info(bd_t **bdp)
+{
+	struct ssx_bios_id *ssx = (struct ssx_bios_id *)SSX_BIOS_ADDR;
+
+	/* Check for SSX signature */
+
+	if (memcmp(&ssx->ssx_bios, "SSX BIOS", 8) == 0) {
+		ssx->bios_entry_point(SSX_BIOS_GET_BOARD_INFO, *bdp);
+	} else {
+		/* It's not SSX, so assume PIBS */
+		typedef void (*PFV)(bd_t *bd);
+		((PFV)(*(unsigned long *)PIBS_BOARD_INFO_VECTOR))(*bdp);
+	}
+}
+
+void embed_config(bd_t **bdp)
+{
+        *bdp = &bdinfo;
+	get_board_info(bdp);
+	/* HACK! PIBS seems to get the UART clock wrong at the moment */
+	mtdcr(DCRN_CPC0_CGCR0, (mfdcr(DCRN_CPC0_CGCR0) & ~0x003e0000) | 0x00160000);
+#if 0
+	/* Enable RefClk/4 mode for both UARTs */
+	mtdcr(DCRN_CPC0_CR0, mfdcr(DCRN_CPC0_CR0) | 0x30000000);
+#endif
+}
+
+#endif
+
+#ifdef CONFIG_BEECH
+static void
+get_board_info(bd_t **bdp)
+{
+	typedef void (*PFV)(bd_t *bd);
+	((PFV)(*(unsigned long *)BOARD_INFO_VECTOR))(*bdp);
+	return;
+}
+
+void
+embed_config(bd_t **bdp)
+{
+        *bdp = &bdinfo;
+	get_board_info(bdp);
+}
+#endif
+
 #ifdef CONFIG_EP405
 #include <linux/serial_reg.h>

diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/config.in linux-bartholomew/arch/ppc/config.in
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/config.in	2002-10-03 12:09:32.000000000 +1000
+++ linux-bartholomew/arch/ppc/config.in	2002-12-11 16:17:18.000000000 +1100
@@ -73,7 +73,8 @@

 if [ "$CONFIG_40x" = "y" ]; then
     choice 'Machine Type'			\
-	"Ash		CONFIG_ASH		\
+	"Arctic-II	CONFIG_ARCTIC2		\
+	 Ash		CONFIG_ASH		\
 	 Ceder		CONFIG_CEDER		\
 	 Beech		CONFIG_BEECH		\
 	 CPCI405	CONFIG_CPCI405 		\
@@ -309,10 +310,14 @@
     define_bool CONFIG_IBM405_ERR77 y
     define_bool CONFIG_IBM_OCP y
   fi
+  if [ "$CONFIG_ARCTIC2" = "y" ]; then
+    define_bool CONFIG_405LP y
+    define_bool CONFIG_IBM405_ERR77 y
+    define_bool CONFIG_IBM_OCP y
+  fi
   if [ "$CONFIG_SYCAMORE" = "y" ]; then
     define_bool CONFIG_405GPR y
     define_bool CONFIG_BIOS_FIXUP y
-    define_bool CONFIG_IBM_OPENBIOS y
     define_bool CONFIG_IBM405_ERR77 y
     define_bool CONFIG_IBM_OCP y
   fi
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/Makefile linux-bartholomew/arch/ppc/platforms/Makefile
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/Makefile	2002-08-08 15:04:56.000000000 +1000
+++ linux-bartholomew/arch/ppc/platforms/Makefile	2002-12-11 16:00:06.000000000 +1100
@@ -40,6 +40,7 @@
 obj-$(CONFIG_RAINIER)		+= rainier.o ibmnp4gs.o
 obj-$(CONFIG_APUS)		+= apus_setup.o
 obj-$(CONFIG_BEECH)		+= beech.o ibm405lp.o
+obj-$(CONFIG_ARCTIC2)		+= arctic2.o subzero.o ibm405lp.o
 obj-$(CONFIG_SYCAMORE)		+= sycamore.o ibm405gpr.o

 obj-$(CONFIG_EBONY)		+= ebony.o ibm440gp.o
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.c linux-bartholomew/arch/ppc/platforms/arctic2.c
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.c	Thu Jan 01 10:00:00 1970
+++ linux-bartholomew/arch/ppc/platforms/arctic2.c	Thu Dec 12 17:14:44 2002
@@ -0,0 +1,113 @@
+/*
+ * arch/ppc/platforms/arctic2.c  Platform setup for the IBM Arctic-2 reference platform
+ *					with the Subzero core card and Beech personality card
+ * 				      Based on beech.c by Bishop Brock
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2002, International Business Machines Corporation
+ * All Rights Reserved.
+ *
+ * Ken Inoue
+ * IBM Thomas J. Watson Research Center
+ * keninoue@us.ibm.com
+ *
+ * David Gibson
+ * IBM Ozlabs, Canberra, Australia
+ * arctic@gibson.dropbear.id.au
+ */
+
+#include <linux/blk.h>
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/param.h>
+#include <linux/rtc.h>
+#include <linux/string.h>
+
+#include <asm/delay.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/page.h>
+#include <asm/processor.h>
+#include <asm/system.h>
+#include <asm/time.h>
+
+#include <platforms/arctic2.h>
+
+void __init
+board_setup_arch(void)
+{
+}
+
+/* All Arctic-2 core physical memory resources are direct-mapped at boot time.
+*  Need to change that. */
+
+void __init
+board_io_mapping(void)
+{
+	/* FIXME: yuck.  Need to get rid of these */
+	io_block_mapping(ARCTIC2_FPGA8_VADDR, ARCTIC2_FPGA8_PADDR,
+			 ARCTIC2_FPGA8_SIZE, _PAGE_IO);
+	io_block_mapping(ARCTIC2_FPGA16_VADDR, ARCTIC2_FPGA16_PADDR,
+			 ARCTIC2_FPGA16_SIZE, _PAGE_IO);
+	io_block_mapping(SUBZERO_BEECH_PCMCIA_VADDR, SUBZERO_BEECH_PCMCIA_PADDR,
+			 SUBZERO_BEECH_PCMCIA_SIZE, _PAGE_IO);
+}
+
+void __init
+board_setup_irq(void)
+{
+}
+
+void __init
+board_init(void)
+{
+#ifdef CONFIG_PPC_RTC
+	ppc_md.time_init = ibm405lp_time_init;
+	ppc_md.set_rtc_time = ibm405lp_set_rtc_time;
+	ppc_md.get_rtc_time = ibm405lp_get_rtc_time;
+#endif
+
+	/* Set up the EBC, then Disable the LCD controller, which may have been
+	   left on by the BIOS. */
+
+	subzero_core_ebc_setup();
+
+	/* Configure the Arctic-II specific EBC banks */
+
+	/* Bank 1: 16-bit FPGA peripherals (ethernet data, SDIO, USB, DOC)
+	 * 1MB, RW, 16-bit at 0xf1000000-0xf10fffff */
+	/* The access parameters are programmed assuming a 33Mhz EBC
+	   clock, which is true for nearly all the operating points we
+	   have defined:
+	   	BME=0, TWT=5, CSN=0, OEN=1, WBN=1, WBF=1 TH=4
+		RE=1, SOR=0, BEM=0, PEN=0
+	 */
+	mtdcri(DCRN_EBC0, BnAP(1), 0x02815900);
+	mtdcri(DCRN_EBC0, BnCR(1), ARCTIC2_FPGA16_PADDR | 0x1a000);
+
+	/* Bank 2: 8-bit FPGA peripherals (switch/control, ethernet regs, TCPA)
+	 * 1MB, RW, 8-bit at 0xf8000000-0xf80fffff */
+	mtdcri(DCRN_EBC0, BnAP(2), 0x02815580);
+	mtdcri(DCRN_EBC0, BnCR(2), ARCTIC2_FPGA8_PADDR | 0x18000);
+
+	mtdcri(DCRN_LCD0, DER, 0);
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End: */
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.h linux-bartholomew/arch/ppc/platforms/arctic2.h
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.h	Thu Jan 01 10:00:00 1970
+++ linux-bartholomew/arch/ppc/platforms/arctic2.h	Thu Dec 12 16:52:42 2002
@@ -0,0 +1,63 @@
+/*
+ * arch/ppc/platforms/arctic2.h   Platform definitions for the IBM Arctic-II
+ *				based on beech.h by Bishop Brock
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2002, International Business Machines Corporation
+ * All Rights Reserved.
+ *
+ * Ken Inoue
+ * IBM Thomas J. Watson Research Center
+ * keninoue@us.ibm.com
+ *
+ * David Gibson
+ * IBM Ozlabs, Canberra, Australia
+ * arctic@gibson.dropbear.id.au
+ *
+ */
+
+#ifdef __KERNEL__
+#ifndef __ASM_ARCTIC2_H__
+#define __ASM_ARCTIC2_H__
+
+#include <platforms/subzero.h>
+
+#ifndef __ASSEMBLY__
+
+#define ARCTIC2_FPGA8_PADDR	(0xf8000000)
+#define ARCTIC2_FPGA8_VADDR	ARCTIC2_FPGA8_PADDR
+#define ARCTIC2_FPGA8_SIZE	(768*1024)
+
+#define ARCTIC2_FPGA16_PADDR	(0xf9000000)
+#define ARCTIC2_FPGA16_VADDR	ARCTIC2_FPGA16_PADDR
+#define ARCTIC2_FPGA16_SIZE	(1024*1024)
+
+/* Arctic II uses the internal clock for UART. Note that the OPB
+   frequency must be more than 2x the UART clock frequency. At OPB
+   frequencies less than this the serial port will not function due to
+   the way that SerClk is sampled.  We use 11.1111MHz as the frequency
+   because it can be generated from a wide range of OPB frequencies we
+   want to use. */
+
+#define PPC4xx_SERCLK_FREQ 11111111
+
+#define BASE_BAUD (PPC4xx_SERCLK_FREQ / 16)
+
+#define PPC4xx_MACHINE_NAME	"IBM Arctic II"
+
+#endif /* !__ASSEMBLY__ */
+#endif /* __ASM_ARCTIC2_H__ */
+#endif /* __KERNEL__ */
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.c linux-bartholomew/arch/ppc/platforms/subzero.c
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.c	Thu Jan 01 10:00:00 1970
+++ linux-bartholomew/arch/ppc/platforms/subzero.c	Thu Dec 12 14:57:18 2002
@@ -0,0 +1,96 @@
+/*
+ * arch/ppc/platforms/subzero.c  Platform setup for the IBM Subzero CPU core card.
+ *
+ *				Based on arctic1.c by Ken Inoue, which
+ *				was based on beech.c by Bishop Brock
+ *
+ * The source code contained herein is licensed under the IBM Public License
+ * Version 1.0, which has been approved by the Open Source Initiative.
+ * Copyright (C) 2002, International Business Machines Corporation
+ * All Rights Reserved.
+ *
+ * David Gibson
+ * IBM OzLabs, Canberra, Australia
+ * <dwg@au1.ibm.com>
+ */
+
+#include <linux/blk.h>
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/param.h>
+#include <linux/rtc.h>
+#include <linux/string.h>
+
+#include <asm/delay.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/page.h>
+#include <asm/processor.h>
+#include <asm/system.h>
+#include <asm/time.h>
+
+/*
+   Subzero core card physical memory map:
+
+   Main Memory (Initialized by the BIOS)
+   =======================================================================
+
+   SDRAM (32 MB)     0x00000000 - 0x02000000
+
+   OPB Space: (Mapped virtual = physical in ppc4xx_setup.c)
+   =======================================================================
+
+   UART0               	      0xEF600300
+   UART1               	      0xEF600400
+   IIC                 	      0xEF600500
+   OPB Arbiter         	      0xEF600600
+   GPIO Controller     	      0xEF600700
+   CODEC Interface            0xEF600900
+   Touch Panel Controller     0xEF600A00
+   DES Controller             0xEF600B00
+
+
+   EBC Space: (Mapped virtual = physical in board_io_mapping())
+	      (EBC setup for personality cards left to individual card setups)
+   Space             EBC Bank    Physical Addresses  EBC Base Address
+   =========================================================================
+   Boot/Linux Flash      0       FF000000 - FFFFFFFF  FF000000 (16MB)
+
+*/
+
+
+/****************************************************************************
+ * EBC Setup
+ ****************************************************************************/
+
+/* The EBC is set up for Arctic1.  This may simply replicate the setup already
+   done by the IBM BIOS for Arctic1 (possibly with some address map changes), or
+   may be the first initialization if the board is booting from another BIOS.
+   Virtually all that is required to boot Linux on Subzero is that the BIOS
+   enable the memory controller, load a Linux image from flash, and run it.
+
+   For optimal dynamic frequency scaling the EBC settings will also vary as the
+   frequency varies.
+*/
+
+void __init
+subzero_core_ebc_setup(void)
+{
+	ebc0_bnap_t ap;
+
+	/* Set EBC bank 0 for the boot/data flash.
+
+	   Access parameters assume 150ns Intel flash @ 66.66 MHz maximum bus
+	   speed = 10 cycle access with 2 turnaround cycles (30 ns).
+
+	   NB: IBM BIOS sets this bank to burst, however bursting will never
+	   happen in Linux because this region is mapped non-cacheable and
+	   guarded, so it is set non-burst here. */
+	ap.reg = mfdcri(DCRN_EBC0, BnAP(0)) & EBC0_BnAP_MASK;
+	ap.fields.twt = 10;
+	ap.fields.th = 2;
+	mtdcri(DCRN_EBC0, BnAP(0), ap.reg);
+
+}
+
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.h linux-bartholomew/arch/ppc/platforms/subzero.h
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.h	Thu Jan 01 10:00:00 1970
+++ linux-bartholomew/arch/ppc/platforms/subzero.h	Thu Dec 12 15:22:30 2002
@@ -0,0 +1,114 @@
+/*
+ * arch/ppc/platforms/subzero.h   Platform definitions for the IBM
+ *				Subzero card, based on beech.h by Bishop Brock
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2002, International Business Machines Corporation
+ * All Rights Reserved.
+ *
+ * David Gibson
+ * IBM OzLabs, Canberra, Australia
+ * <arctic@gibson.dropbear.id.au>
+ *
+ * Ken Inoue
+ * IBM Thomas J. Watson Research Center
+ * <keninoue@us.ibm.com>
+ *
+ */
+
+#ifdef __KERNEL__
+#ifndef __ASM_SUBZERO_CORE_H__
+#define __ASM_SUBZERO_CORE_H__
+
+#include <platforms/ibm405lp.h>
+
+#ifndef __ASSEMBLY__
+
+#include <linux/types.h>
+
+/*
+ * Data structure defining board information maintained by the standard boot
+ * ROM on the IBM Subzero card. An effort has been made to
+ * keep the field names consistent with the 8xx 'bd_t' board info
+ * structures.
+ *
+ * Original Beech BIOS Definition:
+ *
+ * typedef struct board_cfg_data {
+ *    unsigned char     usr_config_ver[4];
+ *    unsigned long     timerclk_freq;
+ *    unsigned char     rom_sw_ver[30];
+ *    unsigned int      mem_size;
+ *    unsigned long     sysclock_period;
+ *    unsigned long     sys_speed;
+ *    unsigned long     cpu_speed;
+ *    unsigned long     vco_speed;
+ *    unsigned long     plb_speed;
+ *    unsigned long     opb_speed;
+ *    unsigned long     ebc_speed;
+ *  } bd_t;
+ */
+
+typedef struct board_info {
+	unsigned char     bi_s_version[4];  /* Version of this structure */
+	unsigned long     bi_tbfreq;        /* Frequency of SysTmrClk */
+	unsigned char     bi_r_version[30]; /* Version of the IBM ROM */
+	unsigned int      bi_memsize;       /* DRAM installed, in bytes */
+	unsigned long     sysclock_period;  /* SysClk period in ns */
+	unsigned long     sys_speed;        /* SysCLk frequency in Hz */
+	unsigned long     bi_intfreq;       /* Processor speed, in Hz */
+	unsigned long     vco_speed;        /* PLL VCO speed, in Hz */
+	unsigned long     bi_busfreq;       /* PLB Bus speed, in Hz */
+	unsigned long     opb_speed;        /* OPB Bus speed, in Hz */
+	unsigned long     ebc_speed;        /* EBC Bus speed, in Hz */
+
+} bd_t;
+
+/* EBC Bank 0 controls the boot flash
+ *
+ * FIXME? these values assume that there is 16MB of flash on the
+ * personality card, in addition to the 16MB on the subzero card
+ * itself */
+#define SUBZERO_BANK0_PADDR      ((uint)0xfe000000)
+#define SUBZERO_BANK0_EBC_SIZE   EBC0_BnCR_BS_32MB
+
+#define SUBZERO_BOOTFLASH_PADDR  (SUBZERO_BANK0_PADDR)
+#define SUBZERO_BOOTFLASH_SIZE   ((uint)(32 * 1024 * 1024))
+
+/* The PCMCIA controller driver 4xx_pccf.c is responsible for the EBC setup of
+   PCMCIA.  Externally, EBC bank selects 3..7 take on PCMCIA functions when
+   PCMCIA is enabled. */
+
+#define SUBZERO_BEECH_PCMCIA_PADDR     ((uint)0xf0000000)
+#define SUBZERO_BEECH_PCMCIA_VADDR     SUBZERO_BEECH_PCMCIA_PADDR
+#define SUBZERO_BEECH_PCMCIA_SIZE      ((uint)(32 * 1024 * 1024))
+
+#define SUBZERO_BEECH_PCMCIA_IO_BASE (SUBZERO_BEECH_PCMCIA_VADDR + 0x01800000)
+
+/* Define _IO_BASE for PCMCIA; other defines are required as well. */
+
+#define _IO_BASE SUBZERO_BEECH_PCMCIA_IO_BASE
+#define _ISA_MEM_BASE 0
+#define PCI_DRAM_OFFSET 0
+
+void *beech_sram_alloc(size_t size);
+int beech_sram_free(void *p);
+
+void subzero_core_ebc_setup(void);
+
+#endif /* !__ASSEMBLY__ */
+#endif /* __ASM_SUBZERO_CORE_H__ */
+#endif /* __KERNEL__ */
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/include/asm-ppc/ibm4xx.h linux-bartholomew/include/asm-ppc/ibm4xx.h
--- /home/dgibson/kernel/linuxppc_2_4_devel/include/asm-ppc/ibm4xx.h	2002-08-05 10:37:17.000000000 +1000
+++ linux-bartholomew/include/asm-ppc/ibm4xx.h	2002-12-12 15:50:48.000000000 +1100
@@ -109,6 +109,10 @@
 #include <platforms/beech.h>
 #endif

+#if defined(CONFIG_ARCTIC2)
+#include <platforms/arctic2.h>
+#endif
+
 #if defined(CONFIG_SYCAMORE)
 #include <platforms/sycamore.h>
 #endif


--
David Gibson			| For every complex problem there is a
david@gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - x86_64
From: Stephen Rothwell @ 2002-12-13  4:43 UTC (permalink / raw)
  To: ak; +Cc: linux-kernel
In-Reply-To: <20021213153439.1f3e466e.sfr@canb.auug.org.au>

Hi Andi,

Here is the x86_64 part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/x86_64/ia32/ia32_ioctl.c 2.5.51-32bit.2/arch/x86_64/ia32/ia32_ioctl.c
--- 2.5.51-32bit.1/arch/x86_64/ia32/ia32_ioctl.c	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/x86_64/ia32/ia32_ioctl.c	2002-12-13 14:44:57.000000000 +1100
@@ -1909,9 +1909,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
@@ -2116,7 +2116,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+		err = put_user(kuid, (compat_pid_t *)arg);
 
 	return err;
 }
@@ -3487,7 +3487,7 @@
 
 struct dirent32 {
 	unsigned int		d_ino;
-	__kernel_off_t32	d_off;
+	compat_off_t	d_off;
 	unsigned short	d_reclen;
 	char		d_name[256]; /* We must not include limits.h! */
 };
@@ -4937,7 +4937,7 @@
 HANDLE_IOCTL(VIDIOCGFREQ32, do_video_ioctl)
 HANDLE_IOCTL(VIDIOCSFREQ32, do_video_ioctl)
 /* One SMB ioctl needs translations. */
-#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
+#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_pid_t)
 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
 HANDLE_IOCTL(ATM_GETLINKRATE32, do_atm_ioctl)
 HANDLE_IOCTL(ATM_GETNAMES32, do_atm_ioctl)
diff -ruN 2.5.51-32bit.1/arch/x86_64/ia32/ia32entry.S 2.5.51-32bit.2/arch/x86_64/ia32/ia32entry.S
--- 2.5.51-32bit.1/arch/x86_64/ia32/ia32entry.S	2002-12-10 17:07:24.000000000 +1100
+++ 2.5.51-32bit.2/arch/x86_64/ia32/ia32entry.S	2002-12-13 14:57:15.000000000 +1100
@@ -227,9 +227,9 @@
 	.quad sys_syslog
 	.quad compat_sys_setitimer
 	.quad compat_sys_getitimer	/* 105 */
-	.quad sys32_newstat
-	.quad sys32_newlstat
-	.quad sys32_newfstat
+	.quad compat_sys_newstat
+	.quad compat_sys_newlstat
+	.quad compat_sys_newfstat
 	.quad sys32_uname
 	.quad stub32_iopl		/* 110 */
 	.quad sys_vhangup
diff -ruN 2.5.51-32bit.1/arch/x86_64/ia32/ipc32.c 2.5.51-32bit.2/arch/x86_64/ia32/ipc32.c
--- 2.5.51-32bit.1/arch/x86_64/ia32/ipc32.c	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/x86_64/ia32/ipc32.c	2002-12-12 13:43:57.000000000 +1100
@@ -30,10 +30,10 @@
 
 struct ipc_perm32 {
 	int key;
-	__kernel_uid_t32 uid;
-	__kernel_gid_t32 gid;
-	__kernel_uid_t32 cuid;
-	__kernel_gid_t32 cgid;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_uid_t cuid;
+	compat_gid_t cgid;
 	unsigned short mode;
 	unsigned short seq;
 };
@@ -101,8 +101,8 @@
 	unsigned int msg_cbytes;
 	unsigned int msg_qnum;
 	unsigned int msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int __unused4;
 	unsigned int __unused5;
 };
@@ -127,8 +127,8 @@
 	unsigned int __unused2;
 	compat_time_t shm_ctime;
 	unsigned int __unused3;
-	__kernel_pid_t32 shm_cpid;
-	__kernel_pid_t32 shm_lpid;
+	compat_pid_t shm_cpid;
+	compat_pid_t shm_lpid;
 	unsigned int shm_nattch;
 	unsigned int __unused4;
 	unsigned int __unused5;
diff -ruN 2.5.51-32bit.1/arch/x86_64/ia32/sys_ia32.c 2.5.51-32bit.2/arch/x86_64/ia32/sys_ia32.c
--- 2.5.51-32bit.1/arch/x86_64/ia32/sys_ia32.c	2002-12-10 17:07:52.000000000 +1100
+++ 2.5.51-32bit.2/arch/x86_64/ia32/sys_ia32.c	2002-12-13 14:45:03.000000000 +1100
@@ -86,10 +86,9 @@
 extern int overflowuid,overflowgid; 
 
 
-static int
-putstat(struct stat32 *ubuf, struct stat *kbuf)
+int cp_compat_stat(struct kstat *kbuf, struct compat_stat *ubuf)
 {
-	if (verify_area(VERIFY_WRITE, ubuf, sizeof(struct stat32)) ||
+	if (verify_area(VERIFY_WRITE, ubuf, sizeof(struct compat_stat)) ||
 	    __put_user (kbuf->st_dev, &ubuf->st_dev) ||
 	    __put_user (kbuf->st_ino, &ubuf->st_ino) ||
 	    __put_user (kbuf->st_mode, &ubuf->st_mode) ||
@@ -107,57 +106,6 @@
 	return 0;
 }
 
-extern asmlinkage long sys_newstat(char * filename, struct stat * statbuf);
-
-asmlinkage long
-sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	int ret;
-	struct stat s;
-	mm_segment_t old_fs = get_fs();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_newstat(filename, &s);
-	set_fs (old_fs);
-	if (putstat (statbuf, &s))
-		return -EFAULT;
-	return ret;
-}
-
-extern asmlinkage long sys_newlstat(char * filename, struct stat * statbuf);
-
-asmlinkage long
-sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	int ret;
-	struct stat s;
-	mm_segment_t old_fs = get_fs();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_newlstat(filename, &s);
-	set_fs (old_fs);
-	if (putstat (statbuf, &s))
-		return -EFAULT;
-	return ret;
-}
-
-extern asmlinkage long sys_newfstat(unsigned int fd, struct stat * statbuf);
-
-asmlinkage long
-sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	int ret;
-	struct stat s;
-	mm_segment_t old_fs = get_fs();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_newfstat(fd, &s);
-	set_fs (old_fs);
-	if (putstat (statbuf, &s))
-		return -EFAULT;
-	return ret;
-}
-
 /* Another set for IA32/LFS -- x86_64 struct stat is different due to 
    support for 64bit inode numbers. */
 
@@ -1062,7 +1010,7 @@
 				int options, struct rusage * ru);
 
 asmlinkage long
-sys32_wait4(__kernel_pid_t32 pid, unsigned int *stat_addr, int options,
+sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options,
 	    struct rusage32 *ru)
 {
 	if (!ru)
@@ -1084,7 +1032,7 @@
 }
 
 asmlinkage long
-sys32_waitpid(__kernel_pid_t32 pid, unsigned int *stat_addr, int options)
+sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
 {
 	return sys32_wait4(pid, stat_addr, options, NULL);
 }
@@ -1326,7 +1274,7 @@
 						struct timespec *interval);
 
 asmlinkage long
-sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct compat_timespec *interval)
+sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
 {
 	struct timespec t;
 	int ret;
@@ -1686,7 +1634,7 @@
 				       size_t count); 
 
 asmlinkage long
-sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count)
+sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -2030,27 +1978,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_pid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_pid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_pid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -2179,7 +2127,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_pid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -2193,7 +2141,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return err;
 }
diff -ruN 2.5.51-32bit.1/include/asm-x86_64/compat.h 2.5.51-32bit.2/include/asm-x86_64/compat.h
--- 2.5.51-32bit.1/include/asm-x86_64/compat.h	2002-12-10 16:38:26.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-x86_64/compat.h	2002-12-12 16:52:38.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,27 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	u16		__pad1;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	u16		__pad2;
+	u32		st_size;
+	u32		st_blksize;
+	u32		st_blocks;
+	u32		st_atime;
+	u32		__unused1;
+	u32		st_mtime;
+	u32		__unused2;
+	u32		st_ctime;
+	u32		__unused3;
+	u32		__unused4;
+	u32		__unused5;
+};
+
 #endif /* _ASM_X86_64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-x86_64/ia32.h 2.5.51-32bit.2/include/asm-x86_64/ia32.h
--- 2.5.51-32bit.1/include/asm-x86_64/ia32.h	2002-12-10 15:44:49.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-x86_64/ia32.h	2002-12-12 16:51:29.000000000 +1100
@@ -5,26 +5,18 @@
 
 #ifdef CONFIG_IA32_EMULATION
 
-#include <compat.h>
+#include <linux/compat.h>
 
 /*
  * 32 bit structures for IA32 support.
  */
 
 /* 32bit compatibility types */
-typedef int		       __kernel_pid_t32;
 typedef unsigned short	       __kernel_ipc_pid_t32;
-typedef unsigned short	       __kernel_uid_t32;
 typedef unsigned 				__kernel_uid32_t32;
-typedef unsigned short	       __kernel_gid_t32;
 typedef unsigned 				__kernel_gid32_t32;
-typedef unsigned short	       __kernel_dev_t32;
-typedef unsigned int	       __kernel_ino_t32;
-typedef unsigned short	       __kernel_mode_t32;
 typedef unsigned short	       __kernel_umode_t32;
-typedef short		       __kernel_nlink_t32;
 typedef int		       __kernel_daddr_t32;
-typedef int		       __kernel_off_t32;
 typedef unsigned int	       __kernel_caddr_t32;
 typedef long		       __kernel_loff_t32;
 typedef __kernel_fsid_t	       __kernel_fsid_t32;
@@ -34,9 +26,9 @@
 struct flock32 {
        short l_type;
        short l_whence;
-       __kernel_off_t32 l_start;
-       __kernel_off_t32 l_len;
-       __kernel_pid_t32 l_pid;
+       compat_off_t l_start;
+       compat_off_t l_len;
+       compat_pid_t l_pid;
 };
 
 
@@ -95,30 +87,6 @@
 	sigset32_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
-struct stat32 {
-       unsigned short st_dev;
-       unsigned short __pad1;
-       unsigned int st_ino;
-       unsigned short st_mode;
-       unsigned short st_nlink;
-       unsigned short st_uid;
-       unsigned short st_gid;
-       unsigned short st_rdev;
-       unsigned short __pad2;
-       unsigned int  st_size;
-       unsigned int  st_blksize;
-       unsigned int  st_blocks;
-       unsigned int  st_atime;
-       unsigned int  __unused1;
-       unsigned int  st_mtime;
-       unsigned int  __unused2;
-       unsigned int  st_ctime;
-       unsigned int  __unused3;
-       unsigned int  __unused4;
-       unsigned int  __unused5;
-};
-
-
 /* This matches struct stat64 in glibc2.2, hence the absolutely
  * insane amounts of padding around dev_t's.
  */
@@ -221,7 +189,7 @@
 
 struct ustat32 {
 	__u32	f_tfree;
-	__kernel_ino_t32		f_tinode;
+	compat_ino_t		f_tinode;
 	char			f_fname[6];
 	char			f_fpack[6];
 };

^ permalink raw reply

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - sparc64
From: Stephen Rothwell @ 2002-12-13  4:39 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel
In-Reply-To: <20021213153439.1f3e466e.sfr@canb.auug.org.au>

Hi Dave,

This is the sparc64 part if the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/sparc64/kernel/ioctl32.c 2.5.51-32bit.2/arch/sparc64/kernel/ioctl32.c
--- 2.5.51-32bit.1/arch/sparc64/kernel/ioctl32.c	2002-12-10 15:10:17.000000000 +1100
+++ 2.5.51-32bit.2/arch/sparc64/kernel/ioctl32.c	2002-12-13 14:44:35.000000000 +1100
@@ -2041,9 +2041,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
@@ -2248,7 +2248,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+		err = put_user(kuid, (compat_uid_t *)arg);
 
 	return err;
 }
@@ -2835,7 +2835,7 @@
 } lv_status_byindex_req32_t;
 
 typedef struct {
-	__kernel_dev_t32 dev;
+	compat_dev_t dev;
 	u32   lv;
 } lv_status_bydev_req32_t;
 
@@ -5133,7 +5133,7 @@
 HANDLE_IOCTL(VIDIOCGFREQ32, do_video_ioctl)
 HANDLE_IOCTL(VIDIOCSFREQ32, do_video_ioctl)
 /* One SMB ioctl needs translations. */
-#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
+#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
 /* NCPFS */
 HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
diff -ruN 2.5.51-32bit.1/arch/sparc64/kernel/sys_sparc32.c 2.5.51-32bit.2/arch/sparc64/kernel/sys_sparc32.c
--- 2.5.51-32bit.1/arch/sparc64/kernel/sys_sparc32.c	2002-12-10 17:06:24.000000000 +1100
+++ 2.5.51-32bit.2/arch/sparc64/kernel/sys_sparc32.c	2002-12-13 14:44:40.000000000 +1100
@@ -289,11 +289,11 @@
 struct ipc_perm32
 {
 	key_t    	  key;
-        __kernel_uid_t32  uid;
-        __kernel_gid_t32  gid;
-        __kernel_uid_t32  cuid;
-        __kernel_gid_t32  cgid;
-        __kernel_mode_t32 mode;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
         unsigned short  seq;
 };
 
@@ -347,8 +347,8 @@
 	unsigned int  msg_cbytes;
 	unsigned int  msg_qnum;
 	unsigned int  msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int  __unused1;
 	unsigned int  __unused2;
 };
@@ -374,8 +374,8 @@
 	unsigned int		__pad3;
 	compat_time_t  	shm_ctime;
 	compat_size_t	shm_segsz;
-	__kernel_pid_t32	shm_cpid;
-	__kernel_pid_t32	shm_lpid;
+	compat_pid_t	shm_cpid;
+	compat_pid_t	shm_lpid;
 	unsigned int		shm_nattch;
 	unsigned int		__unused1;
 	unsigned int		__unused2;
@@ -1397,10 +1397,13 @@
 	return ret;
 }
 
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
 
+	if (stat->size > MAX_NON_LFS)
+		return -EOVERFLOW;
+
 	err  = put_user(stat->dev, &statbuf->st_dev);
 	err |= put_user(stat->ino, &statbuf->st_ino);
 	err |= put_user(stat->mode, &statbuf->st_mode);
@@ -1408,8 +1411,6 @@
 	err |= put_user(high2lowuid(stat->uid), &statbuf->st_uid);
 	err |= put_user(high2lowgid(stat->gid), &statbuf->st_gid);
 	err |= put_user(stat->rdev, &statbuf->st_rdev);
-	if (stat->size > MAX_NON_LFS)
-		return -EOVERFLOW;
 	err |= put_user(stat->size, &statbuf->st_size);
 	err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
 	err |= put_user(0, &statbuf->__unused1);
@@ -1425,39 +1426,6 @@
 	return err;
 }
 
-asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2);
 
 asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2)
@@ -1468,16 +1436,16 @@
 struct ncp_mount_data32_v3 {
         int version;
         unsigned int ncp_fd;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_pid_t32 wdog_pid;
+        compat_uid_t mounted_uid;
+        compat_pid_t wdog_pid;
         unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
         unsigned int time_out;
         unsigned int retry_count;
         unsigned int flags;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 struct ncp_mount_data32_v4 {
@@ -1548,11 +1516,11 @@
 
 struct smb_mount_data32 {
         int version;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t mounted_uid;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 static void *do_smb_super_data_conv(void *raw_data)
@@ -1712,7 +1680,7 @@
 	return err;
 }
 
-asmlinkage int sys32_wait4(__kernel_pid_t32 pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
+asmlinkage int sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
 {
 	if (!ru)
 		return sys_wait4(pid, stat_addr, options, NULL);
@@ -1774,7 +1742,7 @@
 
 extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
 
-asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct compat_timespec *interval)
+asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
 {
 	struct timespec t;
 	int ret;
@@ -3083,27 +3051,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_uid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_uid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -3232,7 +3200,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_uid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -3246,7 +3214,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return (err ? -EFAULT : 0);
 }
@@ -3540,7 +3508,7 @@
 
 extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
 
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count)
+asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -3795,7 +3763,7 @@
 extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
@@ -3819,7 +3787,7 @@
 extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_getaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
diff -ruN 2.5.51-32bit.1/arch/sparc64/kernel/sys_sunos32.c 2.5.51-32bit.2/arch/sparc64/kernel/sys_sunos32.c
--- 2.5.51-32bit.1/arch/sparc64/kernel/sys_sunos32.c	2002-12-10 15:10:17.000000000 +1100
+++ 2.5.51-32bit.2/arch/sparc64/kernel/sys_sunos32.c	2002-12-12 13:53:26.000000000 +1100
@@ -798,14 +798,14 @@
 }
 
 /* So stupid... */
-extern asmlinkage int sys32_wait4(__kernel_pid_t32 pid,
+extern asmlinkage int sys32_wait4(compat_pid_t pid,
 				  u32 stat_addr, int options, u32 ru);
 
-asmlinkage int sunos_wait4(__kernel_pid_t32 pid, u32 stat_addr, int options, u32 ru)
+asmlinkage int sunos_wait4(compat_pid_t pid, u32 stat_addr, int options, u32 ru)
 {
 	int ret;
 
-	ret = sys32_wait4((pid ? pid : ((__kernel_pid_t32)-1)),
+	ret = sys32_wait4((pid ? pid : ((compat_pid_t)-1)),
 			  stat_addr, options, ru);
 	return ret;
 }
@@ -931,11 +931,11 @@
 struct ipc_perm32
 {
 	key_t    	  key;
-        __kernel_uid_t32  uid;
-        __kernel_gid_t32  gid;
-        __kernel_uid_t32  cuid;
-        __kernel_gid_t32  cgid;
-        __kernel_mode_t32 mode;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
         unsigned short  seq;
 };
 
diff -ruN 2.5.51-32bit.1/arch/sparc64/kernel/systbls.S 2.5.51-32bit.2/arch/sparc64/kernel/systbls.S
--- 2.5.51-32bit.1/arch/sparc64/kernel/systbls.S	2002-12-10 17:06:07.000000000 +1100
+++ 2.5.51-32bit.2/arch/sparc64/kernel/systbls.S	2002-12-13 14:56:51.000000000 +1100
@@ -26,12 +26,12 @@
 /*20*/	.word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
 /*25*/	.word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
 /*30*/	.word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
-	.word sys_chown, sys_sync, sys_kill, sys32_newstat, sys32_sendfile
-/*40*/	.word sys32_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
+	.word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile
+/*40*/	.word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
 	.word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16
 /*50*/	.word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl
 	.word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve
-/*60*/	.word sys_umask, sys_chroot, sys32_newfstat, sys_fstat64, sys_getpagesize
+/*60*/	.word sys_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize
 	.word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
 /*70*/	.word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect
 	.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
@@ -150,8 +150,8 @@
 	.word sunos_nosys, sunos_nosys, sunos_nosys
 	.word sunos_nosys, sunos_nosys, sunos_nosys
 	.word sys_access, sunos_nosys, sunos_nosys
-	.word sys_sync, sys_kill, sys32_newstat
-	.word sunos_nosys, sys32_newlstat, sys_dup
+	.word sys_sync, sys_kill, compat_sys_newstat
+	.word sunos_nosys, compat_sys_newlstat, sys_dup
 	.word sys_pipe, sunos_nosys, sunos_nosys
 	.word sunos_nosys, sunos_nosys, sunos_getgid
 	.word sunos_nosys, sunos_nosys
@@ -159,7 +159,7 @@
 	.word sunos_mctl, sunos_ioctl, sys_reboot
 	.word sunos_nosys, sys_symlink, sys_readlink
 	.word sys32_execve, sys_umask, sys_chroot
-	.word sys32_newfstat, sunos_nosys, sys_getpagesize
+	.word compat_sys_newfstat, sunos_nosys, sys_getpagesize
 	.word sys_msync, sys_vfork, sunos_nosys
 	.word sunos_nosys, sunos_sbrk, sunos_sstk
 	.word sunos_mmap, sunos_vadvise, sys_munmap
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/compat.h 2.5.51-32bit.2/include/asm-sparc64/compat.h
--- 2.5.51-32bit.1/include/asm-sparc64/compat.h	2002-12-10 16:38:22.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-sparc64/compat.h	2002-12-12 16:17:41.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef s16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,24 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	compat_off_t	st_size;
+	compat_time_t	st_atime;
+	u32		__unused1;
+	compat_time_t	st_mtime;
+	u32		__unused2;
+	compat_time_t	st_ctime;
+	u32		__unused3;
+	compat_off_t	st_blksize;
+	compat_off_t	st_blocks;
+	u32		__unused4[2];
+};
+
 #endif /* _ASM_SPARC64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/fcntl.h 2.5.51-32bit.2/include/asm-sparc64/fcntl.h
--- 2.5.51-32bit.1/include/asm-sparc64/fcntl.h	2001-09-21 07:11:58.000000000 +1000
+++ 2.5.51-32bit.2/include/asm-sparc64/fcntl.h	2002-12-12 14:48:45.000000000 +1100
@@ -79,12 +79,14 @@
 };
 
 #ifdef __KERNEL__
+#include <linux/compat.h>
+
 struct flock32 {
 	short l_type;
 	short l_whence;
-	__kernel_off_t32 l_start;
-	__kernel_off_t32 l_len;
-	__kernel_pid_t32 l_pid;
+	compat_off_t l_start;
+	compat_off_t l_len;
+	compat_pid_t l_pid;
 	short __unused;
 };
 #endif
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/posix_types.h 2.5.51-32bit.2/include/asm-sparc64/posix_types.h
--- 2.5.51-32bit.1/include/asm-sparc64/posix_types.h	2002-12-10 15:42:57.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-sparc64/posix_types.h	2002-12-12 16:15:40.000000000 +1100
@@ -48,17 +48,9 @@
 } __kernel_fsid_t;
 
 /* Now 32bit compatibility types */
-typedef int                    __kernel_pid_t32;
 typedef unsigned short         __kernel_ipc_pid_t32;
-typedef unsigned short         __kernel_uid_t32;
-typedef unsigned short         __kernel_gid_t32;
-typedef unsigned short         __kernel_dev_t32;
-typedef unsigned int           __kernel_ino_t32;
-typedef unsigned short         __kernel_mode_t32;
 typedef unsigned short         __kernel_umode_t32;
-typedef short                  __kernel_nlink_t32;
 typedef int                    __kernel_daddr_t32;
-typedef int                    __kernel_off_t32;
 typedef unsigned int           __kernel_caddr_t32;
 typedef long		       __kernel_loff_t32;
 typedef __kernel_fsid_t        __kernel_fsid_t32;
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/siginfo.h 2.5.51-32bit.2/include/asm-sparc64/siginfo.h
--- 2.5.51-32bit.1/include/asm-sparc64/siginfo.h	2002-12-10 15:43:53.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-sparc64/siginfo.h	2002-12-12 11:28:48.000000000 +1100
@@ -30,7 +30,7 @@
 
 		/* kill() */
 		struct {
-			__kernel_pid_t32 _pid;		/* sender's pid */
+			compat_pid_t _pid;		/* sender's pid */
 			unsigned int _uid;		/* sender's uid */
 		} _kill;
 
@@ -42,14 +42,14 @@
 
 		/* POSIX.1b signals */
 		struct {
-			__kernel_pid_t32 _pid;		/* sender's pid */
+			compat_pid_t _pid;		/* sender's pid */
 			unsigned int _uid;		/* sender's uid */
 			sigval_t32 _sigval;
 		} _rt;
 
 		/* SIGCHLD */
 		struct {
-			__kernel_pid_t32 _pid;		/* which child */
+			compat_pid_t _pid;		/* which child */
 			unsigned int _uid;		/* sender's uid */
 			int _status;			/* exit code */
 			compat_clock_t _utime;
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/stat.h 2.5.51-32bit.2/include/asm-sparc64/stat.h
--- 2.5.51-32bit.1/include/asm-sparc64/stat.h	2002-12-10 15:10:40.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-sparc64/stat.h	2002-12-12 15:22:10.000000000 +1100
@@ -3,29 +3,8 @@
 #define _SPARC64_STAT_H
 
 #include <linux/types.h>
-#include <linux/compat.h>
 #include <linux/time.h>
 
-struct stat32 {
-	__kernel_dev_t32   st_dev;
-	__kernel_ino_t32   st_ino;
-	__kernel_mode_t32  st_mode;
-	short   	   st_nlink;
-	__kernel_uid_t32   st_uid;
-	__kernel_gid_t32   st_gid;
-	__kernel_dev_t32   st_rdev;
-	__kernel_off_t32   st_size;
-	compat_time_t    st_atime;
-	unsigned int       __unused1;
-	compat_time_t    st_mtime;
-	unsigned int       __unused2;
-	compat_time_t    st_ctime;
-	unsigned int       __unused3;
-	__kernel_off_t32   st_blksize;
-	__kernel_off_t32   st_blocks;
-	unsigned int  __unused4[2];
-};
-
 struct stat {
 	dev_t   st_dev;
 	ino_t   st_ino;

^ permalink raw reply

* autodetect RAID
From: Anuradha Vaidyanathan @ 2002-12-13  4:29 UTC (permalink / raw)
  To: linux-raid

hello, where can one obtain the patch for autodetecting and which versions
of the kernel does this work on??

thanks
-a


^ permalink raw reply

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - ppc64
From: Stephen Rothwell @ 2002-12-13  4:37 UTC (permalink / raw)
  To: anton; +Cc: linux-kernel
In-Reply-To: <20021213153439.1f3e466e.sfr@canb.auug.org.au>

Hi Anton,

Here is the ppc64 part of this patch.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/ppc64/kernel/ioctl32.c 2.5.51-32bit.2/arch/ppc64/kernel/ioctl32.c
--- 2.5.51-32bit.1/arch/ppc64/kernel/ioctl32.c	2002-12-10 15:10:16.000000000 +1100
+++ 2.5.51-32bit.2/arch/ppc64/kernel/ioctl32.c	2002-12-13 15:18:39.000000000 +1100
@@ -1722,9 +1722,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
@@ -2054,7 +2054,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+		err = put_user(kuid, (compat_uid_t *)arg);
 
 	return err;
 }
@@ -3656,7 +3656,7 @@
 #define HANDLE_IOCTL(cmd,handler) { cmd, (unsigned long)handler, 0 }
 
 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
-#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
+#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
 
 static struct ioctl_trans ioctl_translations[] = {
     /* List here explicitly which ioctl's need translation,
diff -ruN 2.5.51-32bit.1/arch/ppc64/kernel/misc.S 2.5.51-32bit.2/arch/ppc64/kernel/misc.S
--- 2.5.51-32bit.1/arch/ppc64/kernel/misc.S	2002-12-10 17:06:50.000000000 +1100
+++ 2.5.51-32bit.2/arch/ppc64/kernel/misc.S	2002-12-13 14:57:05.000000000 +1100
@@ -614,9 +614,9 @@
 	.llong .sys32_syslog
 	.llong .compat_sys_setitimer
 	.llong .compat_sys_getitimer		/* 105 */
-	.llong .sys32_newstat
-	.llong .sys32_newlstat
-	.llong .sys32_newfstat
+	.llong .compat_sys_newstat
+	.llong .compat_sys_newlstat
+	.llong .compat_sys_newfstat
 	.llong .sys_uname
 	.llong .sys_ni_syscall		/* 110 old iopl syscall */
 	.llong .sys_vhangup
diff -ruN 2.5.51-32bit.1/arch/ppc64/kernel/sys_ppc32.c 2.5.51-32bit.2/arch/ppc64/kernel/sys_ppc32.c
--- 2.5.51-32bit.1/arch/ppc64/kernel/sys_ppc32.c	2002-12-10 17:07:08.000000000 +1100
+++ 2.5.51-32bit.2/arch/ppc64/kernel/sys_ppc32.c	2002-12-13 14:44:53.000000000 +1100
@@ -300,16 +300,16 @@
 struct ncp_mount_data32_v3 {
         int version;
         unsigned int ncp_fd;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_pid_t32 wdog_pid;
+        compat_uid_t mounted_uid;
+        compat_pid_t wdog_pid;
         unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
         unsigned int time_out;
         unsigned int retry_count;
         unsigned int flags;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 struct ncp_mount_data32_v4 {
@@ -380,11 +380,11 @@
 
 struct smb_mount_data32 {
         int version;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t mounted_uid;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 static void *do_smb_super_data_conv(void *raw_data)
@@ -802,10 +802,13 @@
 	return sys32_select((int)n, inp, outp, exp, tvp_x);
 }
 
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
 
+	if (stat->size > MAX_NON_LFS)
+		return -EOVERFLOW;
+
 	err  = put_user(stat->dev, &statbuf->st_dev);
 	err |= put_user(stat->ino, &statbuf->st_ino);
 	err |= put_user(stat->mode, &statbuf->st_mode);
@@ -813,8 +816,6 @@
 	err |= put_user(stat->uid, &statbuf->st_uid);
 	err |= put_user(stat->gid, &statbuf->st_gid);
 	err |= put_user(stat->rdev, &statbuf->st_rdev);
-	if (stat->size > MAX_NON_LFS)
-		return -EOVERFLOW;
 	err |= put_user(stat->size, &statbuf->st_size);
 	err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
 	err |= put_user(0, &statbuf->__unused1);
@@ -830,39 +831,6 @@
 	return err;
 }
 
-asmlinkage long sys32_newstat(char* filename, struct stat32* statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-	
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage long sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-	
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage long sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-	
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 static inline int put_statfs (struct statfs32 *ubuf, struct statfs *kbuf)
 {
 	int err;
@@ -1492,27 +1460,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_uid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_uid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -1645,7 +1613,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_uid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -1659,7 +1627,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return err;
 }
@@ -2128,8 +2096,8 @@
 	unsigned int msg_cbytes;
 	unsigned int msg_qnum;
 	unsigned int msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int __unused4;
 	unsigned int __unused5;
 };
@@ -2158,8 +2126,8 @@
 	compat_time_t shm_ctime;
 	unsigned int __unused4;
 	compat_size_t shm_segsz;
-	__kernel_pid_t32 shm_cpid;
-	__kernel_pid_t32 shm_lpid;
+	compat_pid_t shm_cpid;
+	compat_pid_t shm_lpid;
 	unsigned int shm_nattch;
 	unsigned int __unused5;
 	unsigned int __unused6;
@@ -2681,7 +2649,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd, __kernel_off_t32* offset, u32 count)
+asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd, compat_off_t* offset, u32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -4265,7 +4233,7 @@
 extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
@@ -4289,7 +4257,7 @@
 extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_getaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
diff -ruN 2.5.51-32bit.1/include/asm-ppc64/compat.h 2.5.51-32bit.2/include/asm-ppc64/compat.h
--- 2.5.51-32bit.1/include/asm-ppc64/compat.h	2002-12-10 16:38:13.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-ppc64/compat.h	2002-12-12 16:14:11.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u32		compat_uid_t;
+typedef u32		compat_gid_t;
+typedef u32		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u32		compat_dev_t;
+typedef s32		compat_off_t;
+typedef s16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,24 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;	
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	compat_off_t	st_size;
+	compat_off_t	st_blksize;
+	compat_off_t	st_blocks;
+	compat_time_t	st_atime;
+	u32		__unused1;
+	compat_time_t	st_mtime;
+	u32		__unused2;
+	compat_time_t	st_ctime;
+	u32		__unused3;
+	u32		__unused4[2];
+};
+
 #endif /* _ASM_PPC64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-ppc64/ppc32.h 2.5.51-32bit.2/include/asm-ppc64/ppc32.h
--- 2.5.51-32bit.1/include/asm-ppc64/ppc32.h	2002-12-10 15:44:11.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-ppc64/ppc32.h	2002-12-12 16:01:09.000000000 +1100
@@ -44,17 +44,9 @@
 })
 
 /* These are here to support 32-bit syscalls on a 64-bit kernel. */
-typedef int		__kernel_pid_t32;
 typedef unsigned short	__kernel_ipc_pid_t32;
-typedef unsigned int	__kernel_uid_t32;
-typedef unsigned int	__kernel_gid_t32;
-typedef unsigned int	__kernel_dev_t32;
-typedef unsigned int	__kernel_ino_t32;
-typedef unsigned int	__kernel_mode_t32;
 typedef unsigned int	__kernel_umode_t32;
-typedef short		__kernel_nlink_t32;
 typedef int		__kernel_daddr_t32;
-typedef int		__kernel_off_t32;
 typedef unsigned int	__kernel_caddr_t32;
 typedef int		__kernel_loff_t32;
 
@@ -86,8 +78,8 @@
 
 		/* kill() */
 		struct {
-			__kernel_pid_t32 _pid;		/* sender's pid */
-			__kernel_uid_t32 _uid;		/* sender's uid */
+			compat_pid_t _pid;		/* sender's pid */
+			compat_uid_t _uid;		/* sender's uid */
 		} _kill;
 
 		/* POSIX.1b timers */
@@ -98,15 +90,15 @@
 
 		/* POSIX.1b signals */
 		struct {
-			__kernel_pid_t32 _pid;		/* sender's pid */
-			__kernel_uid_t32 _uid;		/* sender's uid */
+			compat_pid_t _pid;		/* sender's pid */
+			compat_uid_t _uid;		/* sender's uid */
 			sigval_t32 _sigval;
 		} _rt;
 
 		/* SIGCHLD */
 		struct {
-			__kernel_pid_t32 _pid;		/* which child */
-			__kernel_uid_t32 _uid;		/* sender's uid */
+			compat_pid_t _pid;		/* which child */
+			compat_uid_t _uid;		/* sender's uid */
 			int _status;			/* exit code */
 			compat_clock_t _utime;
 			compat_clock_t _stime;
@@ -162,32 +154,12 @@
 struct flock32 {
 	short l_type;
 	short l_whence;
-	__kernel_off_t32 l_start;
-	__kernel_off_t32 l_len;
-	__kernel_pid_t32 l_pid;
+	compat_off_t l_start;
+	compat_off_t l_len;
+	compat_pid_t l_pid;
 	short __unused;
 };
 
-struct stat32 {
-	__kernel_dev_t32   st_dev; /* 2 */
-	__kernel_ino_t32   st_ino; /* 4  */
-	__kernel_mode_t32  st_mode; /* 2  */
-	short   	   st_nlink; /* 2 */
-	__kernel_uid_t32   st_uid; /* 2 */
-	__kernel_gid_t32   st_gid; /* 2 */
-	__kernel_dev_t32   st_rdev; /* 2 */
-	__kernel_off_t32   st_size; /* 4 */
-	__kernel_off_t32   st_blksize; /* 4 */
-	__kernel_off_t32   st_blocks; /* 4 */
-	compat_time_t    st_atime; /* 4 */
-	unsigned int       __unused1; /* 4 */
-	compat_time_t    st_mtime; /* 4 */
-	unsigned int       __unused2; /* 4 */
-	compat_time_t    st_ctime; /* 4 */
-	unsigned int       __unused3; /* 4 */
-	unsigned int  __unused4[2]; /* 2*4 */
-};
-
 struct sigcontext32 {
 	unsigned int	_unused[4];
 	int		signal;

^ permalink raw reply

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent
From: Stephen Rothwell @ 2002-12-13  4:34 UTC (permalink / raw)
  To: Linus; +Cc: LKML, anton, David S. Miller, ak, davidm, schwidefsky, ralf,
	willy

Hi Linus,

Another in the COMPAT series.  This build on the previous patches.

This patch renames more types and moves them into asm/compat.h and
also consolidates sys32_new{stat,fstat,lstat}.

Across all the architectures, the diffstat looks like this:
 arch/ia64/ia32/ia32_entry.S       |    6 -
 arch/ia64/ia32/sys_ia32.c         |  131 +++++++++++++-------------------------
 arch/mips64/kernel/linux32.c      |   59 +++--------------
 arch/mips64/kernel/scall_o32.S    |    6 -
 arch/parisc/kernel/ioctl32.c      |   10 +-
 arch/parisc/kernel/sys_parisc32.c |   85 +++---------------------
 arch/ppc64/kernel/ioctl32.c       |    8 +-
 arch/ppc64/kernel/misc.S          |    6 -
 arch/ppc64/kernel/sys_ppc32.c     |   96 +++++++++------------------
 arch/s390x/kernel/entry.S         |    6 -
 arch/s390x/kernel/ioctl32.c       |    5 -
 arch/s390x/kernel/linux32.c       |  107 ++++++++++---------------------
 arch/s390x/kernel/linux32.h       |   37 ----------
 arch/s390x/kernel/wrapper32.S     |   22 +++---
 arch/sparc64/kernel/ioctl32.c     |   10 +-
 arch/sparc64/kernel/sys_sparc32.c |  110 +++++++++++--------------------
 arch/sparc64/kernel/sys_sunos32.c |   16 ++--
 arch/sparc64/kernel/systbls.S     |   12 +--
 arch/x86_64/ia32/ia32_ioctl.c     |   10 +-
 arch/x86_64/ia32/ia32entry.S      |    6 -
 arch/x86_64/ia32/ipc32.c          |   16 ++--
 arch/x86_64/ia32/sys_ia32.c       |   84 ++++--------------------
 fs/Makefile                       |    2 
 fs/compat.c                       |   72 ++++++++++++++++++++
 include/asm-ia64/compat.h         |   32 ++++++++-
 include/asm-ia64/ia32.h           |   36 ----------
 include/asm-mips64/compat.h       |   31 ++++++++
 include/asm-mips64/posix_types.h  |    8 --
 include/asm-mips64/stat.h         |   24 ------
 include/asm-parisc/compat.h       |   39 +++++++++++
 include/asm-parisc/posix_types.h  |    8 --
 include/asm-ppc64/compat.h        |   28 ++++++++
 include/asm-ppc64/ppc32.h         |   46 ++-----------
 include/asm-s390x/compat.h        |   31 ++++++++
 include/asm-sparc64/compat.h      |   28 ++++++++
 include/asm-sparc64/fcntl.h       |    8 +-
 include/asm-sparc64/posix_types.h |    8 --
 include/asm-sparc64/siginfo.h     |    6 -
 include/asm-sparc64/stat.h        |   21 ------
 include/asm-x86_64/compat.h       |   31 ++++++++
 include/asm-x86_64/ia32.h         |   42 +-----------
 include/linux/compat.h            |    3 
 kernel/compat.c                   |   19 -----
 43 files changed, 589 insertions(+), 782 deletions(-)

This is just the architecture independent part of the patch.  I have
built this on PPC64 only.

Please apply.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/fs/Makefile 2.5.51-32bit.2/fs/Makefile
--- 2.5.51-32bit.1/fs/Makefile	2002-11-28 10:34:54.000000000 +1100
+++ 2.5.51-32bit.2/fs/Makefile	2002-12-12 17:18:35.000000000 +1100
@@ -15,6 +15,8 @@
 		filesystems.o namespace.o seq_file.o xattr.o libfs.o \
 		fs-writeback.o mpage.o direct-io.o aio.o eventpoll.o
 
+obj-$(CONFIG_COMPAT) += compat.o
+
 ifneq ($(CONFIG_NFSD),n)
 ifneq ($(CONFIG_NFSD),)
 obj-y += nfsctl.o
diff -ruN 2.5.51-32bit.1/fs/compat.c 2.5.51-32bit.2/fs/compat.c
--- 2.5.51-32bit.1/fs/compat.c	1970-01-01 10:00:00.000000000 +1000
+++ 2.5.51-32bit.2/fs/compat.c	2002-12-13 15:11:15.000000000 +1100
@@ -0,0 +1,72 @@
+/*
+ *  linux/fs/compat.c
+ *
+ *  Kernel compatibililty routines for e.g. 32 bit syscall support
+ *  on 64 bit kernels.
+ *
+ *  Copyright (C) 2002 Stephen Rothwell, IBM Corporation
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/linkage.h>
+#include <linux/compat.h>
+#include <linux/errno.h>
+#include <linux/time.h>
+#include <linux/fs.h>
+
+#include <asm/uaccess.h>
+
+/*
+ * Not all architectures have sys_utime, so implement this in terms
+ * of sys_utimes.
+ */
+asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t)
+{
+	struct timeval tv[2];
+
+	if (t) {
+		if (get_user(tv[0].tv_sec, &t->actime) ||
+		    get_user(tv[1].tv_sec, &t->modtime))
+			return -EFAULT;
+		tv[0].tv_usec = 0;
+		tv[1].tv_usec = 0;
+	}
+	return do_utimes(filename, t ? tv : NULL);
+}
+
+
+asmlinkage long compat_sys_newstat(char * filename,
+		struct compat_stat *statbuf)
+{
+	struct kstat stat;
+	int error = vfs_stat(filename, &stat);
+
+	if (!error)
+		error = cp_compat_stat(&stat, statbuf);
+	return error;
+}
+
+asmlinkage long compat_sys_newlstat(char * filename,
+		struct compat_stat *statbuf)
+{
+	struct kstat stat;
+	int error = vfs_lstat(filename, &stat);
+
+	if (!error)
+		error = cp_compat_stat(&stat, statbuf);
+	return error;
+}
+
+asmlinkage long compat_sys_newfstat(unsigned int fd,
+		struct compat_stat * statbuf)
+{
+	struct kstat stat;
+	int error = vfs_fstat(fd, &stat);
+
+	if (!error)
+		error = cp_compat_stat(&stat, statbuf);
+	return error;
+}
diff -ruN 2.5.51-32bit.1/include/linux/compat.h 2.5.51-32bit.2/include/linux/compat.h
--- 2.5.51-32bit.1/include/linux/compat.h	2002-12-10 17:32:48.000000000 +1100
+++ 2.5.51-32bit.2/include/linux/compat.h	2002-12-13 14:49:21.000000000 +1100
@@ -8,6 +8,7 @@
 
 #ifdef CONFIG_COMPAT
 
+#include <linux/stat.h>
 #include <asm/compat.h>
 
 #define compat_jiffies_to_clock_t(x)	((x) / (HZ / COMPAT_USER_HZ))
@@ -29,5 +30,7 @@
 	compat_clock_t		tms_cstime;
 };
 
+extern int cp_compat_stat(struct kstat *, struct compat_stat *);
+
 #endif /* CONFIG_COMPAT */
 #endif /* _LINUX_COMPAT_H */
diff -ruN 2.5.51-32bit.1/kernel/compat.c 2.5.51-32bit.2/kernel/compat.c
--- 2.5.51-32bit.1/kernel/compat.c	2002-12-10 16:45:09.000000000 +1100
+++ 2.5.51-32bit.2/kernel/compat.c	2002-12-12 17:19:15.000000000 +1100
@@ -88,25 +88,6 @@
 	return ret;
 }
 
-/*
- * Not all architectures have sys_utime, so implement this in terms
- * of sys_utimes.
- */
-asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t)
-{
-	struct timeval tv[2];
-
-	if (t) {
-		if (get_user(tv[0].tv_sec, &t->actime) ||
-		    get_user(tv[1].tv_sec, &t->modtime))
-			return -EFAULT;
-		tv[0].tv_usec = 0;
-		tv[1].tv_usec = 0;
-	}
-	return do_utimes(filename, t ? tv : NULL);
-}
-
-
 static inline long get_compat_itimerval(struct itimerval *o,
 		struct compat_itimerval *i)
 {

^ permalink raw reply

* Re: 2.5 Changes doc update.
From: SL Baur @ 2002-12-13  4:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Dave Jones

In lkml Dave Jones writes:

 ...
> Input layer.
> ~~~~~~~~~~~~
 ...
> - Users of multimedia keys without X will see changes in how the kernel 
>   handles those keys. People who customize keymaps or keycodes in 2.4 
>   may need to make some changes in 2.5

Could you elaborate on this, or put in a pointer describing the
differences?  I use a jp106 keyboard and the Yen/Backslash - Bar key
(keycode 133, keysyms 0x5c and 0x7c) has disappeared.  It's most
inconvenient not being able to type a pipeline on the console.


^ permalink raw reply

* Re: 2.5.5[01]]: Xircom Cardbus broken (PCI resource collisions)
From: Valdis.Kletnieks @ 2002-12-13  4:22 UTC (permalink / raw)
  To: Greg KH; +Cc: Alessandro Suardi, linux-kernel
In-Reply-To: <20021213004330.GG23509@kroah.com>

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

On Thu, 12 Dec 2002 16:43:30 PST, Greg KH said:
> On Thu, Dec 12, 2002 at 05:47:17PM -0500, Valdis.Kletnieks@vt.edu wrote:
> > > PCI: Device 02:00.0 not available because of resource collisions
> > > PCI: Device 02:00.1 not available because of resource collisions
> > 
> > Been there. Done that. Does the attached patch help? It did for me.
> 
> Fixes the problem for me :)

Glad to hear it.  I'm pretty sure I merely backed out a broken change, but
two decades have left me for a healthy respect for "Mel the Real Programmer"
stories ;)

/Valdis

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply

* RE: Is the preemptive kernel patch unsafe for 8xx/PPC?
From: acurtis @ 2002-12-13  4:12 UTC (permalink / raw)
  To: Joakim Tjernlund, Eugene Surovegin; +Cc: linuxppc-dev
In-Reply-To: <001901c2a21d$f3f4e760$0200a8c0@jockeXP>


The patch did not apply cleanly for me using linuxppc_2_4_devel, BK label
2.4.19 final.
The following files got rejected:
	include/asm-ppc/dma.h
	include/asm-ppc/pgtable.h

It was very straight forward to apply the patches by hand. The line numbers
were a bit off.

>
> Was that the 2.4.19-2 patch? What were the bugs and have you fixed them?
>
> According to the message Robert posted on lkm is the 2.4.20-1 patch only a
> rediff of the latest 2.4.19 patch.
>
> BTW, I am on the 2_4_devel branch.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply

* 자비출판 안내[시집,수필,소설,경제,경영,처세 기타][광고]
From: 줄판안내 @ 2002-12-13  4:11 UTC (permalink / raw)
  To: nfs

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]

원고중개, 자비출판, 자서전, 기획출판 등 출판서비스 전문회사  자비출판 안내(시집,수필,소설,경제,경영,처세,기타)    
nfs님께  행복이 함께하시기를 빕니다.
귀하의  메일주소는 웹서핑중에서 알게 된것이며, E-Mail 주소 외에, 다른  정보는 갖고 있지 않습니다. 본 메일은 정보통신망 이용촉진 및 정보보호  등에 관한 법률 제 50조에 의거한[광고] 메일입니다

 
수신거부를 원하시면 여기를 클릭하기만 하세요~ 
 
 
  [자비출판의  자세한 내용]
  저작권사항
  저자의  사상과 철학을 담아 품위있는 책으로 만들어  드립니다.  출판등록과  국제 문헌번호(ISBN)를 부여해 드립니다.  
 국립중앙도서관에  납본하여 언제라도 열람하실 수 있습니다.  
 저작권을  철저하게 보장합니다.    제작방법
  노련한  운영으로 제작비를 최대한 절약하여 저렴한  비용이 듭니다. 
 철저하게  저자의 의도를 100% 반영합니다.
 본문과  표지의 교정지를 최소한 두 번 이상 보내드립니다.  
 저자의  OK사인이 나야만 제작에 들어갑니다. 
 공격적인  경영으로 거래서점을 하루도 빠지지 않고  방문하여 도서의 진열상태를 수시로 점검하고,  더욱 좋은 자리에 진열될 수 있도록 최선을  다합니다.      인세  계약방식
  처음  제작비의 일부를 저자가 부담하는 것 외에  일반 출판물과 동일한 계약 추가비용  전혀 없으며 책이 잘 팔리면 저자에게  인세를 지속적으로 지급 10%  선인세   
자세한  사항은 도서출판 작은숲에서  살펴보시기 바랍니다.

     도서출판 작은숲 
 

 

[-- Attachment #2: Type: text/html, Size: 8495 bytes --]

^ permalink raw reply

* RE: Is the preemptive kernel patch unsafe for 8xx/PPC?
From: acurtis @ 2002-12-13  4:08 UTC (permalink / raw)
  To: Eugene Surovegin, joakim.tjernlund; +Cc: linuxppc-dev
In-Reply-To: <5.1.0.14.2.20021212102609.02d48730@pop.prodigy.net>


Can you be more specific about the "bugs". I just installed the patch. The
patch did not apply cleanly. Is this what you are referring to? It was
simple to fix the rejects.

THX

> -----Original Message-----
> From: owner-linuxppc-dev@lists.linuxppc.org
> [mailto:owner-linuxppc-dev@lists.linuxppc.org]On Behalf Of Eugene
> Surovegin
> Sent: Thursday, December 12, 2002 10:28 AM
> To: joakim.tjernlund@lumentis.se
> Cc: linuxppc-dev@lists.linuxppc.org
> Subject: Re: Is the preemptive kernel patch unsafe for 8xx/PPC?
>
>
>
> At 04:56 AM 12/12/2002, you wrote:
> >I am testing the latest(2.4.20-1) preemtive kernel patch from
> Robert Love and
> >I wonder if anybody know if it's unsafe/not working for 8xx or
> PPC in general?
>
> I haven't tested patch for 2.4.20 but patch for 2.4.19 contained
> some bugs.
>
>
>   Eugene Surovegin <mailto:ebs@innocent.com>
>
>
>
>
>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply

* Re: [2.5.51] Failure to mount ext3 root when ext2 compiled in
From: Andrew Morton @ 2002-12-13  4:09 UTC (permalink / raw)
  To: Rusty Russell; +Cc: viro, linux-kernel
In-Reply-To: <20021213035016.339092C24F@lists.samba.org>

Rusty Russell wrote:
> 
> Just noticed this (usually ext2 is compiled as a module, but was
> testing a patch with CONFIG_MODULES=n).  Reverted to plain 2.5.51, and
> it's still there:
> 
>         VFS: Cannot open root device "301" or 03:01
>         Please append a correct "root=" boot option
>         Kernel panic: VFS: Unable to mount root fs on 03:01
> 
> Now, I have an ext3 root, but when CONFIG_EXT3_FS=y and
> CONFIG_EXT2_FS=y, I get this failure.  Turning off CONFIG_EXT2_FS
> "fixes" it.
> 

In the past year I've booted about 1,000,000,000 kernels with
CONFIG_EXT2_FS=y and CONFIG_EXT3_FS=y.  Across that period, 
maybe five or ten times I have seen this problem.

As soon as I get down to debug it it goes away.  I once traced it
as far as seeing ext3_fill_super() return failure, then I lost it.

Rebuilding the kernel, even if you "didn't change anything" makes
it go away.

I assume that in your case a `make clean' will not fix it.   You
lucky duck.   Can you stick a printk right at the end of
ext3_fill_super()?

^ permalink raw reply

* [PATCH] module_param() primitive (3/3)
From: Rusty Russell @ 2002-12-13  3:56 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Linus, please apply.

This is the backwards compat wedge for MODULE_PARM() declarations.

It's complicated by the fact that many modules place MODULE_PARM()
before the declaration (some do MODULE_PARM() for non-existant
variables, too).  To avoid breaking them, we have to do the name
lookups at load time, rather than just storing a pointer 8(

CONFIG_OBSOLETE_MODPARM is set to y without prompting: it's a useful
marker for deprecating in 2.7.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: MODULE_PARM support for older modules
Author: Rusty Russell
Status: Tested on 2.5.50
Depends: Module/param-modules.patch.gz

D: This is the backwards compatibility code for MODULE_PARM, and moves
D: __MODULE_STRING() down to the graveyard at the bottom of module.h.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .3259-linux-2.5-bk/include/linux/module.h .3259-linux-2.5-bk.updated/include/linux/module.h
--- .3259-linux-2.5-bk/include/linux/module.h	2002-12-02 17:35:54.000000000 +1100
+++ .3259-linux-2.5-bk.updated/include/linux/module.h	2002-12-02 17:44:43.000000000 +1100
@@ -20,10 +21,6 @@
 #include <asm/module.h>
 #include <asm/uaccess.h> /* For struct exception_table_entry */
 
-/* Indirect stringification */
-#define __MODULE_STRING_1(x)	#x
-#define __MODULE_STRING(x)	__MODULE_STRING_1(x)
-
 /* Not Yet Implemented */
 #define MODULE_LICENSE(name)
 #define MODULE_AUTHOR(name)
@@ -291,6 +288,21 @@ extern spinlock_t modlist_lock;
 #define __MOD_DEC_USE_COUNT(mod) module_put(mod)
 #define SET_MODULE_OWNER(dev) ((dev)->owner = THIS_MODULE)
 
+struct obsolete_modparm {
+	char name[64];
+	char type[64-sizeof(void *)];
+	void *addr;
+};
+#ifdef MODULE
+/* DEPRECATED: Do not use. */
+#define MODULE_PARM(var,type)						    \
+struct obsolete_modparm __parm_##var __attribute__((section("__obsparm"))) = \
+{ __stringify(var), type };
+
+#else
+#define MODULE_PARM(var,type)
+#endif
+
 /* People do this inside their init routines, when the module isn't
    "live" yet.  They should no longer be doing that, but
    meanwhile... */
@@ -303,11 +315,11 @@ extern spinlock_t modlist_lock;
 #endif
 #define MOD_DEC_USE_COUNT module_put(THIS_MODULE)
 #define try_inc_mod_count(mod) try_module_get(mod)
-#define MODULE_PARM(parm,string)
 #define EXPORT_NO_SYMBOLS
 extern int module_dummy_usage;
 #define GET_USE_COUNT(module) (module_dummy_usage)
 #define MOD_IN_USE 0
+#define __MODULE_STRING(x) __stringify(x)
 #define __mod_between(a_start, a_len, b_start, b_len)		\
 (((a_start) >= (b_start) && (a_start) <= (b_start)+(b_len))	\
  || ((a_start)+(a_len) >= (b_start)				\
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .3259-linux-2.5-bk/init/Kconfig .3259-linux-2.5-bk.updated/init/Kconfig
--- .3259-linux-2.5-bk/init/Kconfig	2002-11-19 09:58:52.000000000 +1100
+++ .3259-linux-2.5-bk.updated/init/Kconfig	2002-12-02 17:44:11.000000000 +1100
@@ -135,6 +135,15 @@ config MODULE_FORCE_UNLOAD
 	  rmmod).  This is mainly for kernel developers and desparate users.
 	  If unsure, say N.
 
+config OBSOLETE_MODPARM
+	bool
+	default y
+	depends on MODULES
+	help
+	  You need this option to use module parameters on modules which
+	  have not been converted to the new module parameter system yet.
+	  If unsure, say Y.
+
 config KMOD
 	bool "Kernel module loader"
 	depends on MODULES
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .3259-linux-2.5-bk/kernel/module.c .3259-linux-2.5-bk.updated/kernel/module.c
--- .3259-linux-2.5-bk/kernel/module.c	2002-12-02 17:43:47.000000000 +1100
+++ .3259-linux-2.5-bk.updated/kernel/module.c	2002-12-02 17:44:11.000000000 +1100
@@ -523,6 +523,134 @@ sys_delete_module(const char *name_user,
 
 #endif /* CONFIG_MODULE_UNLOAD */
 
+#ifdef CONFIG_OBSOLETE_MODPARM
+static int param_set_byte(const char *val, struct kernel_param *kp)  
+{
+	char *endp;
+	long l;
+
+	if (!val) return -EINVAL;
+	l = simple_strtol(val, &endp, 0);
+	if (endp == val || *endp || ((char)l != l))
+		return -EINVAL;
+	*((char *)kp->arg) = l;
+	return 0;
+}
+
+static int param_string(const char *name, const char *val,
+			unsigned int min, unsigned int max,
+			char *dest)
+{
+	if (strlen(val) < min || strlen(val) > max) {
+		printk(KERN_ERR
+		       "Parameter %s length must be %u-%u characters\n",
+		       name, min, max);
+		return -EINVAL;
+	}
+	strcpy(dest, val);
+	return 0;
+}
+
+extern int set_obsolete(const char *val, struct kernel_param *kp)
+{
+	unsigned int min, max;
+	char *p, *endp;
+	struct obsolete_modparm *obsparm = kp->arg;
+
+	if (!val) {
+		printk(KERN_ERR "Parameter %s needs an argument\n", kp->name);
+		return -EINVAL;
+	}
+
+	/* type is: [min[-max]]{b,h,i,l,s} */
+	p = obsparm->type;
+	min = simple_strtol(p, &endp, 10);
+	if (endp == obsparm->type)
+		min = max = 1;
+	else if (*endp == '-') {
+		p = endp+1;
+		max = simple_strtol(p, &endp, 10);
+	} else
+		max = min;
+	switch (*endp) {
+	case 'b':
+		return param_array(kp->name, val, min, max, obsparm->addr,
+				   1, param_set_byte);
+	case 'h':
+		return param_array(kp->name, val, min, max, obsparm->addr,
+				   sizeof(short), param_set_short);
+	case 'i':
+		return param_array(kp->name, val, min, max, obsparm->addr,
+				   sizeof(int), param_set_int);
+	case 'l':
+		return param_array(kp->name, val, min, max, obsparm->addr,
+				   sizeof(long), param_set_long);
+	case 's':
+		return param_string(kp->name, val, min, max, obsparm->addr);
+	}
+	printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type);
+	return -EINVAL;
+}
+
+static int obsolete_params(const char *name,
+			   char *args,
+			   struct obsolete_modparm obsparm[],
+			   unsigned int num,
+			   Elf_Shdr *sechdrs,
+			   unsigned int symindex,
+			   const char *strtab)
+{
+	struct kernel_param *kp;
+	unsigned int i;
+	int ret;
+
+	kp = kmalloc(sizeof(kp[0]) * num, GFP_KERNEL);
+	if (!kp)
+		return -ENOMEM;
+
+	DEBUGP("Module %s has %u obsolete params\n", name, num);
+	for (i = 0; i < num; i++)
+		DEBUGP("Param %i: %s type %s\n",
+		       num, obsparm[i].name, obsparm[i].type);
+
+	for (i = 0; i < num; i++) {
+		kp[i].name = obsparm[i].name;
+		kp[i].perm = 000;
+		kp[i].set = set_obsolete;
+		kp[i].get = NULL;
+		obsparm[i].addr
+			= (void *)find_local_symbol(sechdrs, symindex, strtab,
+						    obsparm[i].name);
+		if (!obsparm[i].addr) {
+			printk("%s: falsely claims to have parameter %s\n",
+			       name, obsparm[i].name);
+			ret = -EINVAL;
+			goto out;
+		}
+		kp[i].arg = &obsparm[i];
+	}
+
+	ret = parse_args(name, args, kp, num, NULL);
+ out:
+	kfree(kp);
+	return ret;
+}
+#else
+static int obsolete_params(const char *name,
+			   char *args,
+			   struct obsolete_modparm obsparm[],
+			   unsigned int num,
+			   Elf_Shdr *sechdrs,
+			   unsigned int symindex,
+			   const char *strtab)
+{
+	if (num != 0)
+		printk(KERN_WARNING "%s: Ignoring obsolete parameters\n",
+		       name);
+	return 0;
+}
+#endif /* CONFIG_OBSOLETE_MODPARM */
+
 /* Find an symbol for this module (ie. resolve internals first).
    It we find one, record usage.  Must be holding module_mutex. */
 unsigned long find_symbol_internal(Elf_Shdr *sechdrs,
@@ -819,7 +947,7 @@ static struct module *load_module(void *
 	Elf_Shdr *sechdrs;
 	char *secstrings;
 	unsigned int i, symindex, exportindex, strindex, setupindex, exindex,
-		modnameindex;
+		modnameindex, obsparmindex;
 	long arglen;
 	unsigned long common_length;
 	struct sizes sizes, used;
@@ -857,7 +985,7 @@ static struct module *load_module(void *
 
 	/* May not export symbols, or have setup params, so these may
            not exist */
-	exportindex = setupindex = 0;
+	exportindex = setupindex = obsparmindex = 0;
 
 	/* And these should exist, but gcc whinges if we don't init them */
 	symindex = strindex = exindex = modnameindex = 0;
@@ -893,6 +1021,11 @@ static struct module *load_module(void *
 			/* Exception table */
 			DEBUGP("Exception table found in section %u\n", i);
 			exindex = i;
+		} else if (strcmp(secstrings+sechdrs[i].sh_name, "__obsparm")
+			   == 0) {
+			/* Obsolete MODULE_PARM() table */
+			DEBUGP("Obsolete param found in section %u\n", i);
+			obsparmindex = i;
 		}
 #ifdef CONFIG_KALLSYMS
 		/* symbol and string tables for decoding later. */
@@ -1035,13 +1168,23 @@ static struct module *load_module(void *
 	if (err < 0)
 		goto cleanup;
 
-	/* Size of section 0 is 0, so this works well if no params */
-	err = parse_args(mod->args,
-			 (struct kernel_param *)
-			 sechdrs[setupindex].sh_offset,
-			 sechdrs[setupindex].sh_size
-			 / sizeof(struct kernel_param),
-			 NULL);
+	if (obsparmindex) {
+		err = obsolete_params(mod->name, mod->args,
+				      (struct obsolete_modparm *)
+				      sechdrs[obsparmindex].sh_offset,
+				      sechdrs[obsparmindex].sh_size
+				      / sizeof(struct obsolete_modparm),
+				      sechdrs, symindex,
+				      (char *)sechdrs[strindex].sh_offset);
+	} else {
+		/* Size of section 0 is 0, so this works well if no params */
+		err = parse_args(mod->name, mod->args,
+				 (struct kernel_param *)
+				 sechdrs[setupindex].sh_offset,
+				 sechdrs[setupindex].sh_size
+				 / sizeof(struct kernel_param),
+				 NULL);
+	}
 	if (err < 0)
 		goto cleanup;
 

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.