Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261845AbTFBUOO (ORCPT ); Mon, 2 Jun 2003 16:14:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261852AbTFBUOO (ORCPT ); Mon, 2 Jun 2003 16:14:14 -0400 Received: from h55p111.delphi.afb.lu.se ([130.235.187.184]:23956 "EHLO gagarin.0x63.nu") by vger.kernel.org with ESMTP id S261845AbTFBUN6 (ORCPT ); Mon, 2 Jun 2003 16:13:58 -0400 Date: Mon, 2 Jun 2003 22:27:14 +0200 To: linux-kernel@vger.kernel.org Subject: [RFC/PATCH] Support for mach-xbox Message-ID: <20030602202714.GD18786@h55p111.delphi.afb.lu.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i From: Anders Gustafsson X-Scanner: exiscan *19Mvti-0006yx-00*5fjhOsXZmbs*0x63.nu Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 31767 Lines: 713 Hi, Attached is a patch that adds a new subachitecture for the xbox gaming system. All it does outside the subarchitecture is adding posibility to blacklist pci-devices through an mach-hook. xbox-linux team -- Anders Gustafsson - andersg@0x63.nu - http://0x63.nu/ You can import this changeset into BK by piping this whole message to: '| bk receive [path to repository]' or apply the patch as usual. =================================================================== ChangeSet 1.1327 03/06/02 19:11:56 andersg@0x63.nu +10 -0 Added XBOX subarch include/asm-i386/mach-xbox/mach_pci_blacklist.h 1.1 03/06/02 19:11:46 andersg@0x63.nu +6 -0 include/asm-i386/mach-default/mach_pci_blacklist.h 1.1 03/06/02 19:11:46 andersg@0x63.nu +6 -0 arch/i386/mach-xbox/setup.c 1.1 03/06/02 19:11:46 andersg@0x63.nu +79 -0 include/asm-i386/mach-xbox/mach_pci_blacklist.h 1.0 03/06/02 19:11:46 andersg@0x63.nu +0 -0 BitKeeper file /data/dev/kernel/bk/xbox-2.5/include/asm-i386/mach-xbox/mach_pci_blacklist.h include/asm-i386/mach-default/mach_pci_blacklist.h 1.0 03/06/02 19:11:46 andersg@0x63.nu +0 -0 BitKeeper file /data/dev/kernel/bk/xbox-2.5/include/asm-i386/mach-default/mach_pci_blacklist.h arch/i386/mach-xbox/setup.c 1.0 03/06/02 19:11:46 andersg@0x63.nu +0 -0 BitKeeper file /data/dev/kernel/bk/xbox-2.5/arch/i386/mach-xbox/setup.c arch/i386/mach-xbox/reboot.c 1.1 03/06/02 19:11:45 andersg@0x63.nu +50 -0 arch/i386/mach-xbox/Makefile 1.1 03/06/02 19:11:45 andersg@0x63.nu +7 -0 include/asm-i386/timex.h 1.5 03/06/02 19:11:45 andersg@0x63.nu +9 -5 Added XBOX subarch arch/i386/pci/direct.c 1.15 03/06/02 19:11:45 andersg@0x63.nu +4 -0 Added XBOX subarch Added a mach-hook for blacklisting pci-devices. The xbox hangs solid if you touch some pci devices. arch/i386/mach-xbox/reboot.c 1.0 03/06/02 19:11:45 andersg@0x63.nu +0 -0 BitKeeper file /data/dev/kernel/bk/xbox-2.5/arch/i386/mach-xbox/reboot.c arch/i386/mach-xbox/Makefile 1.0 03/06/02 19:11:45 andersg@0x63.nu +0 -0 BitKeeper file /data/dev/kernel/bk/xbox-2.5/arch/i386/mach-xbox/Makefile arch/i386/boot/compressed/Makefile 1.17 03/06/02 19:11:45 andersg@0x63.nu +3 -0 Added XBOX subarch There is some strange interaction when paging is off, that makes 1.1 xboxen crash while decompressing kernel, unless decompressor is compiled without optimization. arch/i386/Makefile 1.52 03/06/02 19:11:44 andersg@0x63.nu +4 -0 Added XBOX subarch arch/i386/Kconfig 1.58 03/06/02 19:11:44 andersg@0x63.nu +19 -2 Added XBOX subarch arch/i386/Kconfig | 21 +++++ arch/i386/Makefile | 4 + arch/i386/boot/compressed/Makefile | 3 arch/i386/mach-xbox/Makefile | 7 + arch/i386/mach-xbox/reboot.c | 50 +++++++++++++ arch/i386/mach-xbox/setup.c | 79 +++++++++++++++++++++ arch/i386/pci/direct.c | 4 + include/asm-i386/mach-default/mach_pci_blacklist.h | 6 + include/asm-i386/mach-xbox/mach_pci_blacklist.h | 6 + include/asm-i386/timex.h | 14 ++- 10 files changed, 187 insertions(+), 7 deletions(-) diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig --- a/arch/i386/Kconfig Mon Jun 2 19:23:26 2003 +++ b/arch/i386/Kconfig Mon Jun 2 19:23:26 2003 @@ -43,6 +43,22 @@ help Choose this option if your computer is a standard PC or compatible. +config X86_XBOX + bool "XBox Gaming System" + help + This option is needed to make Linux boot on XBox Gaming Systems. + + The XBox can be considered as a standard PC with a Pentium III Celeron 733 MHz, + IDE harddrive, DVD, Ethernet, USB and graphics. + + To boot the kernel you need "_romwell", either used as a replacement BIOS (cromwell) + or as a bootloader. + + For more information see http://xbox-linux.sourceforge.net/ + + If you do not specifically need a kernel for XBOX machine, + say N here otherwise the kernel you build will not be bootable. + config X86_VOYAGER bool "Voyager (NCR)" help @@ -395,6 +411,7 @@ Otherwise, say N. config SMP + depends on !X86_XBOX bool "Symmetric multi-processing support" ---help--- This enables support for systems with more than one CPU. If you have @@ -1090,7 +1107,7 @@ config MCA bool "MCA support" - depends on !(X86_VISWS || X86_VOYAGER) + depends on !(X86_VISWS || X86_VOYAGER || X86_XBOX) help MicroChannel Architecture is found in some IBM PS/2 machines and laptops. It is a bus system similar to PCI or ISA. See @@ -1571,7 +1588,7 @@ config X86_BIOS_REBOOT bool - depends on !(X86_VISWS || X86_VOYAGER) + depends on !(X86_VISWS || X86_VOYAGER || X86_XBOX) default y config X86_TRAMPOLINE diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile --- a/arch/i386/Makefile Mon Jun 2 19:23:26 2003 +++ b/arch/i386/Makefile Mon Jun 2 19:23:26 2003 @@ -53,6 +53,10 @@ # Default subarch .c files mcore-y := mach-default +# Xbox subarch support +mflags-$(CONFIG_X86_XBOX) := -Iinclude/asm-i386/mach-xbox +mcore-$(CONFIG_X86_XBOX) := mach-xbox + # Voyager subarch support mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-i386/mach-voyager mcore-$(CONFIG_X86_VOYAGER) := mach-voyager diff -Nru a/arch/i386/boot/compressed/Makefile b/arch/i386/boot/compressed/Makefile --- a/arch/i386/boot/compressed/Makefile Mon Jun 2 19:23:26 2003 +++ b/arch/i386/boot/compressed/Makefile Mon Jun 2 19:23:26 2003 @@ -5,6 +5,9 @@ # targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o +ifeq ($(CONFIG_X86_XBOX),y) +CFLAGS_misc.o := -O0 +endif EXTRA_AFLAGS := -traditional LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32 diff -Nru a/arch/i386/mach-xbox/Makefile b/arch/i386/mach-xbox/Makefile --- /dev/null Wed Dec 31 16:00:00 1969 +++ b/arch/i386/mach-xbox/Makefile Mon Jun 2 19:23:26 2003 @@ -0,0 +1,7 @@ +# +# Makefile for the linux kernel. +# + +EXTRA_CFLAGS += -I../kernel + +obj-y := setup.o reboot.o diff -Nru a/arch/i386/mach-xbox/reboot.c b/arch/i386/mach-xbox/reboot.c --- /dev/null Wed Dec 31 16:00:00 1969 +++ b/arch/i386/mach-xbox/reboot.c Mon Jun 2 19:23:26 2003 @@ -0,0 +1,50 @@ +/* + * arch/i386/mach-xbox/reboot.c + * Olivier Fauchon + * Anders Gustafsson + * + */ + +#include + +/* we don't use any of those, but dmi_scan.c needs 'em */ +void (*pm_power_off)(void); +int reboot_thru_bios; + +#define XBOX_SMB_IO_BASE 0xC000 +#define XBOX_SMB_HOST_ADDRESS (0x4 + XBOX_SMB_IO_BASE) +#define XBOX_SMB_HOST_COMMAND (0x8 + XBOX_SMB_IO_BASE) +#define XBOX_SMB_HOST_DATA (0x6 + XBOX_SMB_IO_BASE) +#define XBOX_SMB_GLOBAL_ENABLE (0x2 + XBOX_SMB_IO_BASE) + +#define XBOX_PIC_ADDRESS 0x10 + +#define SMC_CMD_POWER 0x02 +#define SMC_SUBCMD_POWER_RESET 0x01 +#define SMC_SUBCMD_POWER_CYCLE 0x40 +#define SMC_SUBCMD_POWER_OFF 0x80 + + +static void xbox_pic_cmd(u8 command){ + outw_p(((XBOX_PIC_ADDRESS) << 1),XBOX_SMB_HOST_ADDRESS); + outb_p(SMC_CMD_POWER, XBOX_SMB_HOST_COMMAND); + outw_p(command, XBOX_SMB_HOST_DATA); + outw_p(inw(XBOX_SMB_IO_BASE),XBOX_SMB_IO_BASE); + outb_p(0x0a,XBOX_SMB_GLOBAL_ENABLE); +} + +void machine_restart(char * __unused) +{ + printk(KERN_INFO "Sending POWER_RESET to XBOX-PIC.\n"); + xbox_pic_cmd(SMC_SUBCMD_POWER_RESET); +} + +void machine_power_off(void) +{ + printk(KERN_INFO "Sending POWER_OFF to XBOX-PIC.\n"); + xbox_pic_cmd(SMC_SUBCMD_POWER_OFF); +} + +void machine_halt(void) +{ +} diff -Nru a/arch/i386/mach-xbox/setup.c b/arch/i386/mach-xbox/setup.c --- /dev/null Wed Dec 31 16:00:00 1969 +++ b/arch/i386/mach-xbox/setup.c Mon Jun 2 19:23:26 2003 @@ -0,0 +1,79 @@ +/* + * Machine specific setup for xbox + */ + +#include +#include +#include +#include +#include +#include + +/** + * pre_intr_init_hook - initialisation prior to setting up interrupt vectors + * + * Description: + * Perform any necessary interrupt initialisation prior to setting up + * the "ordinary" interrupt call gates. For legacy reasons, the ISA + * interrupts should be initialised here if the machine emulates a PC + * in any way. + **/ +void __init pre_intr_init_hook(void) +{ + init_ISA_irqs(); +} + +/** + * intr_init_hook - post gate setup interrupt initialisation + * + * Description: + * Fill in any interrupts that may have been left out by the general + * init_IRQ() routine. interrupts having to do with the machine rather + * than the devices on the I/O bus (like APIC interrupts in intel MP + * systems) are started here. + **/ +void __init intr_init_hook(void) +{ +#ifdef CONFIG_X86_LOCAL_APIC + apic_intr_init(); +#endif + +} + +/** + * pre_setup_arch_hook - hook called prior to any setup_arch() execution + * + * Description: + * generally used to activate any machine specific identification + * routines that may be needed before setup_arch() runs. On VISWS + * this is used to get the board revision and type. + **/ +void __init pre_setup_arch_hook(void) +{ +} + +/** + * trap_init_hook - initialise system specific traps + * + * Description: + * Called as the final act of trap_init(). Used in VISWS to initialise + * the various board specific APIC traps. + **/ +void __init trap_init_hook(void) +{ +} + +static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, 0, "timer", NULL, NULL}; + +/** + * time_init_hook - do any specific initialisations for the system timer. + * + * Description: + * Must plug the system timer interrupt source at HZ into the IRQ listed + * in irq_vectors.h:TIMER_IRQ + **/ +void __init time_init_hook(void) +{ + setup_irq(0, &irq0); +} + diff -Nru a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c --- a/arch/i386/pci/direct.c Mon Jun 2 19:23:26 2003 +++ b/arch/i386/pci/direct.c Mon Jun 2 19:23:26 2003 @@ -4,6 +4,7 @@ #include #include +#include "mach_pci_blacklist.h" #include "pci.h" /* @@ -20,6 +21,9 @@ if (!value || (bus > 255) || (dev > 31) || (fn > 7) || (reg > 255)) return -EINVAL; + if (mach_pci_is_blacklisted(bus,dev,fn)) + return -EINVAL; + spin_lock_irqsave(&pci_config_lock, flags); outl(PCI_CONF1_ADDRESS(bus, dev, fn, reg), 0xCF8); diff -Nru a/include/asm-i386/mach-default/mach_pci_blacklist.h b/include/asm-i386/mach-default/mach_pci_blacklist.h --- /dev/null Wed Dec 31 16:00:00 1969 +++ b/include/asm-i386/mach-default/mach_pci_blacklist.h Mon Jun 2 19:23:26 2003 @@ -0,0 +1,6 @@ +#ifndef __ASM_MACH_PCI_BLACKLIST_H +#define __ASM_MACH_PCI_BLACKLIST_H + +#define mach_pci_is_blacklisted(bus,dev,fn) 0 + +#endif diff -Nru a/include/asm-i386/mach-xbox/mach_pci_blacklist.h b/include/asm-i386/mach-xbox/mach_pci_blacklist.h --- /dev/null Wed Dec 31 16:00:00 1969 +++ b/include/asm-i386/mach-xbox/mach_pci_blacklist.h Mon Jun 2 19:23:26 2003 @@ -0,0 +1,6 @@ +#ifndef __ASM_MACH_PCI_BLACKLIST_H +#define __ASM_MACH_PCI_BLACKLIST_H + +#define mach_pci_is_blacklisted(bus,dev,fn) ( (bus>1) || (bus&&(dev||fn)) || ((bus==0 && dev==0) && ((fn==1)||(fn==2))) ) + +#endif diff -Nru a/include/asm-i386/timex.h b/include/asm-i386/timex.h --- a/include/asm-i386/timex.h Mon Jun 2 19:23:26 2003 +++ b/include/asm-i386/timex.h Mon Jun 2 19:23:26 2003 @@ -12,11 +12,15 @@ #ifdef CONFIG_X86_PC9800 extern int CLOCK_TICK_RATE; #else -#ifdef CONFIG_MELAN -# define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */ -#else -# define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ -#endif +# ifdef CONFIG_MELAN +# define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */ +# else +# ifdef CONFIG_X86_XBOX +# define CLOCK_TICK_RATE 1124998 /* so has the Xbox */ +# else +# define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ +# endif +# endif #endif #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ =================================================================== This BitKeeper patch contains the following changesets: + ## Wrapped with uu ## M(R!5&)O>"TR+C4*"B,@4&%T8V@@=F5R#8S+FYU M("LQ," M, I"('1O&)O>"]M86-H7W!C:5]B;&%C:VQI&)O>"]M86-H7W!C:5]B;&%C:VQI&)O>"]-86ME M9FEL97PR,# S,#8P,C$W,3$T-GPP-S(Q,@H^('1O#8S+FYU?&%R8V@O:3,X M-B]-86ME9FEL97PR,# S,#8P,C$W,3$T-'PR,C4Y- H^(&%N9&5R#8S+FYU?&%R8V@O:3,X-B]+8V]N9FEG?#(P,#,P-C R,3"YH?#(P,#(P,C U,3#8S+FYU?&EN8VQU9&4O87-M+6DS M.#8O=&EM97@N:'PR,# S,#8P,C$W,3$T-7PV,34V- H^(&%N9&5R#8S+FYU?&%R M8V@O:3,X-B]M86-H+7AB;W@O&)O>"]-86ME9FEL92 ]/0I.97<@9FEL93H@87)C:"]I M,S@V+VUA8V@M>&)O>"]-86ME9FEL90I6(#0*"F%N9&5R#8S+FYU("LP("TP"D(@=&]R=F%L M9'- 871H;&]N+G1R86YS;65T82YC;VU\0VAA;F=E4V5T?#(P,#(P,C U,3#8S+FYU?&%R8V@O:3,X-B]M86-H+7AB;W@O&)O>"]R96)O;W0N8R * M("H@3VQI=FEE#8@*R!80D]87U--0E])3U]"05-%*0HC9&5F:6YE(%A" M3UA?4TU"7T=,3T)!3%]%3D%"3$4@(" @(" @*#!X,B K(%A"3UA?4TU"7TE/ M7T)!4T4I"EP*(V1E9FEN92!80D]87U!)0U]!1$1215-3(#!X,3 *7 HC9&5F M:6YE(%--0U]#341?4$]715(@,'@P,@HC9&5F:6YE(%--0U]354)#341?4$]7 M15)?4D53150@,'@P,0HC9&5F:6YE(%--0U]354)#341?4$]715)?0UE#3$4@ M,'@T, HC9&5F:6YE(%--0U]354)#341?4$]715)?3T9&(#!X.# *7 I<"G-T M871I8R!V;VED('AB;WA?<&EC7V-M9"AU."!C;VUM86YD*7L*"6]U='=?<"@H M*%A"3UA?4$E#7T%$1%)%4U,I(#P\(#$I+%A"3UA?4TU"7TA/4U1?041$4D53 M4RD["B @(" @(" @;W5T8E]P*%--0U]#341?4$]715(L(%A"3UA?4TU"7TA/ M4U1?0T]-34%.1"D["B @(" @(" @;W5T=U]P*&-O;6UA;F0L(%A"3UA?4TU" M7TA/4U1?1$%402D["B @(" @(" @;W5T=U]P*&EN=RA80D]87U--0E])3U]" M05-%*2Q80D]87U--0E])3U]"05-%*3L*(" @(" @("!O=71B7W H,'@P82Q8 M0D]87U--0E]'3$]"04Q?14Y!0DQ%*3L*?0I<"G9O:60@;6%C:&EN95]R97-T M87)T*&-H87(@*B!?7W5N=7-E9"D*>PH)<')I;G1K*$M%4DY?24Y&3R B4V5N M9&EN9R!03U=%4E]215-%5"!T;R!80D]8+5!)0RY<;B(I.PH)>&)O>%]P:6-? M8VUD*%--0U]354)#341?4$]715)?4D53150I.R @"GT*7 IV;VED(&UA8VAI M;F5?<&]W97)?;V9F*'9O:60I"GL*"7!R:6YT:RA+15).7TE.1D\@(E-E;F1I M;F<@4$]715)?3T9&('1O(%A"3U@M4$E#+EQN(BD["@EX8F]X7W!I8U]C;60H M4TU#7U-50D--1%]03U=%4E]/1D8I.R @"GT*7 IV;VED(&UA8VAI;F5?:&%L M="AV;VED*0I["GT*"CT](&%R8V@O:3,X-B]M86-H+7AB;W@O&)O>"]S971U<"YC"E8@- H* M86YD97)S9T P>#8S+FYU?&%R8V@O:3,X-B]M86-H+7AB;W@O#8S+FYU("LP("TP"D(@ M=&]R=F%L9'- 871H;&]N+G1R86YS;65T82YC;VU\0VAA;F=E4V5T?#(P,#(P M,C U,3"]I;G1E2!I;G1E2X*("HJ+PIV;VED M(%]?:6YI="!PPH):6YI=%])4T%? M:7)Q2!S971U M<%]A2!B92!N965D960@ M8F5F;W)E('-E='5P7V%R8V@H*2!R=6YS+B @3VX@5DE35U,*("H)=&AI2!S M<&5C:69I8R!I;FET:6%L:7-A=&EO;G,@9F]R('1H92!S>7-T96T@=&EM97(N M"B J"B J($1E#8S+FYU?&EN8VQU9&4O M87-M+6DS.#8O;6%C:"UD969A=6QT+VUA8VA?<&-I7V)L86-K;&ES="YH?#(P M,#,P-C R,3#8S+FYU("LV("TP"D(@ M=&]R=F%L9'- 871H;&]N+G1R86YS;65T82YC;VU\0VAA;F=E4V5T?#(P,#(P M,C U,3&)O>"]M86-H7W!C:5]B;&%C:VQI&)O>"TR+C4O:6YC;'5D92]A&)O>"]M86-H7W!C:5]B;&%C:VQI#8S+FYU("LT("TP"D(@=&]R=F%L9'- 871H;&]N+G1R86YS;65T82YC;VU\ M0VAA;F=E4V5T?#(P,#(P,C U,36]U('1O=6-H('-O;64@<&-I(&1E=FEC97,N"DL@-30S M,3(*3R M#8S+FYU("LT("TP"D(@=&]R=F%L9'- 871H;&]N+G1R86YS M;65T82YC;VU\0VAA;F=E4V5T?#(P,#(P,C U,3"!S=6)A#8S+FYU("LS("TP"D(@=&]R=F%L9'- M871H;&]N+G1R86YS;65T82YC;VU\0VAA;F=E4V5T?#(P,#(P,C U,3"YH"BTM+2TM+2TM+2TM+2TM M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+0H*1#$U(#4*23$Y M(#D*(R @:69D968@0T].1DE'7TU%3$%."B,@(" @9&5F:6YE($-,3T-+7U1) M0TM?4D%412 Q,3@Y,C P("\J($%-1"!%;&%N(&AA"UM-CAK+F]R9UMT;W)V86QD7-T96TB"@EH96QP M"@D@(%1H:7,@;W!T:6]N(&ES(&YE961E9"!T;R!M86ME($QI;G5X(&)O;W0@ M;VX@6$)O>"!'86UI;F<@4WES=&5MBP*"2 @241%(&AA6]U(&YE960@(E]R;VUW96QL(BP@96ET:&5R('5S960@87,@ M82!R97!L86-E;65N="!"24]3("AC2!N965D(&$@:V5R;F5L(&9O2!.(&AE6]U M(&)U:6QD('=I;&P@;F]T(&)E(&)O;W1A8FQE+@I<"DDS.3<@,0H)9&5P96YD M