Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269617AbTGJRVP (ORCPT ); Thu, 10 Jul 2003 13:21:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269598AbTGJRUl (ORCPT ); Thu, 10 Jul 2003 13:20:41 -0400 Received: from h55p111.delphi.afb.lu.se ([130.235.187.184]:16295 "EHLO gagarin.0x63.nu") by vger.kernel.org with ESMTP id S266395AbTGJRNg (ORCPT ); Thu, 10 Jul 2003 13:13:36 -0400 Date: Thu, 10 Jul 2003 19:28:02 +0200 To: torvalds@osdl.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] add xbox subarchitecture Message-ID: <20030710172802.GB27744@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 *19afD8-0002m0-00*2QXqOb5JrOo*0x63.nu Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 31703 Lines: 703 Hi, please apply the following patch that adds the xbox subarchitecture. -- 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.1380 03/07/10 18:06:17 andersg@0x63.nu +10 -0 Added configure option for the XBox Gaming System subarchitecture. include/asm-i386/mach-xbox/mach_pci_blacklist.h 1.1 03/07/10 18:05:50 andersg@0x63.nu +6 -0 include/asm-i386/mach-xbox/mach_pci_blacklist.h 1.0 03/07/10 18:05:50 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.1 03/07/10 18:05:49 andersg@0x63.nu +6 -0 arch/i386/mach-xbox/setup.c 1.1 03/07/10 18:05:49 andersg@0x63.nu +79 -0 include/asm-i386/mach-default/mach_pci_blacklist.h 1.0 03/07/10 18:05:49 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/07/10 18:05:49 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/07/10 18:05:48 andersg@0x63.nu +51 -0 arch/i386/mach-xbox/reboot.c 1.0 03/07/10 18:05:48 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.1 03/07/10 18:05:44 andersg@0x63.nu +5 -0 include/asm-i386/timex.h 1.6 03/07/10 18:05:44 andersg@0x63.nu +5 -1 The xbox has a different CLOCK_TICK_RATE. arch/i386/pci/direct.c 1.19 03/07/10 18:05:44 andersg@0x63.nu +4 -0 Added a mach-hook for blacklisting pci-devices. The xbox uses this to prevent it from touching some devices that makes it ha ng solid. arch/i386/mach-xbox/Makefile 1.0 03/07/10 18:05:44 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/07/10 18:05:44 andersg@0x63.nu +5 -0 There is some strange interaction when paging is off, that makes 1.1 xboxen crash while decompressing kernel. Compiling the decompressor without optimization works around this problem. arch/i386/Makefile 1.53 03/07/10 18:05:44 andersg@0x63.nu +4 -0 Added XBox Gaming System subarchitecture. arch/i386/Kconfig 1.66 03/07/10 18:05:44 andersg@0x63.nu +19 -2 Added configure option for the XBox Gaming System subarchitecture. arch/i386/Kconfig | 21 +++++ arch/i386/Makefile | 4 + arch/i386/boot/compressed/Makefile | 5 + arch/i386/mach-xbox/Makefile | 5 + arch/i386/mach-xbox/reboot.c | 51 +++++++++++++ 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 | 6 + 10 files changed, 184 insertions(+), 3 deletions(-) diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig --- a/arch/i386/Kconfig Thu Jul 10 18:07:08 2003 +++ b/arch/i386/Kconfig Thu Jul 10 18:07:08 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 Coppermine-based 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 @@ -409,6 +425,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 @@ -1104,7 +1121,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 @@ -1410,7 +1427,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 Thu Jul 10 18:07:08 2003 +++ b/arch/i386/Makefile Thu Jul 10 18:07:08 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 Thu Jul 10 18:07:08 2003 +++ b/arch/i386/boot/compressed/Makefile Thu Jul 10 18:07:08 2003 @@ -5,6 +5,11 @@ # targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o +ifeq ($(CONFIG_X86_XBOX),y) +#XXX Compiling with optimization makes 1.1-xboxen +# crash while decompressing the kernel +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 Thu Jul 10 18:07:08 2003 @@ -0,0 +1,5 @@ +# +# Makefile for the linux 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 Thu Jul 10 18:07:08 2003 @@ -0,0 +1,51 @@ +/* + * 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 Thu Jul 10 18:07:08 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 Thu Jul 10 18:07:08 2003 +++ b/arch/i386/pci/direct.c Thu Jul 10 18:07:08 2003 @@ -4,6 +4,7 @@ #include #include +#include "mach_pci_blacklist.h" #include "pci.h" /* @@ -20,6 +21,9 @@ if (!value || (bus > 255) || (devfn > 255) || (reg > 255)) return -EINVAL; + if (mach_pci_is_blacklisted(bus,PCI_SLOT(devfn),PCI_FUNC(devfn))) + return -EINVAL; + spin_lock_irqsave(&pci_config_lock, flags); outl(PCI_CONF1_ADDRESS(bus, devfn, 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 Thu Jul 10 18:07:08 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 Thu Jul 10 18:07:08 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 Thu Jul 10 18:07:08 2003 +++ b/include/asm-i386/timex.h Thu Jul 10 18:07:08 2003 @@ -15,7 +15,11 @@ #ifdef CONFIG_MELAN # define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */ #else -# define CLOCK_TICK_RATE 1193182 /* Underlying HZ */ +# ifdef CONFIG_X86_XBOX +# define CLOCK_TICK_RATE 1124998 /* so has the Xbox */ +# else +# define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ +# endif #endif #endif =================================================================== This BitKeeper patch contains the following changesets: 1.1380 ## Wrapped with uu ## M(R!5&)O>"TR+C4*"B,@4&%T8V@@=F5R&)O M>"]-86ME9FEL97PR,# S,##8S+FYU?&%R8V@O:3,X-B]B;V]T+V-O;7!R97-S960O36%K969I;&5\ M,C P,S W,3 Q-C U-#1\,# R,CD*/B!T;W)V86QD#8S M+FYU?&%R8V@O:3,X-B]M86-H+7AB;W@O#8S+FYU?&%R8V@O:3,X-B]+8V]N9FEG?#(P,#,P-S$P,38P M-30T?# Y.#(R"CX@=&]R=F%L9'- 871H;&]N+G1R86YS;65T82YC;VU\:6YC M;'5D92]A"YH?#(P,#(P,C U,3#8S+FYU?&EN8VQU9&4O87-M+6DS M.#8O=&EM97@N:'PR,# S,##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%L9'- 871H;&]N M+G1R86YS;65T82YC;VU\0VAA;F=E4V5T?#(P,#(P,C U,3#8S+FYU M?&%R8V@O:3,X-B]M86-H+7AB;W@O36%K969I;&5\,C P,S W,3 Q-C U-#1\ M,3$P,C!\-3DQ,#ED,6,S8S$S-C1D8@I$(#$N,2 P,R\P-R\Q," Q.#HP-3HT M-"LP,CHP,"!A;F1E#8S M+FYU("LP("TP"D(@=&]R=F%L9'- 871H;&]N+G1R86YS;65T82YC;VU\0VAA M;F=E4V5T?#(P,#(P,C U,3#8S+FYU?&%R8V@O:3,X-B]M86-H+7AB M;W@O&)O>"]R96)O;W0N8R *("H@3VQI=FEE#8@*R!80D]87U--0E]) M3U]"05-%*0HC9&5F:6YE(%A"3UA?4TU"7T=,3T)!3%]%3D%"3$4@(" @(" H M,'@R("L@6$)/6%]334)?24]?0D%312D*7 HC9&5F:6YE(%A"3UA?4$E#7T%$ M1%)%4U,@,'@Q, I<"B-D969I;F4@4TU#7T--1%]03U=%4B P># R"B-D969I M;F4@4TU#7U-50D--1%]03U=%4E]215-%5" P># Q"B-D969I;F4@4TU#7U-5 M0D--1%]03U=%4E]#64-,12 P>#0P"B-D969I;F4@4TU#7U-50D--1%]03U=% M4E]/1D8@,'@X, I<"EP*&)O>%]P:6-?8VUD*'4X(&-O M;6UA;F0I"GL*"6]U='=?<"@H*%A"3UA?4$E#7T%$1%)%4U,I(#P\(#$I+%A" M3UA?4TU"7TA/4U1?041$4D534RD["@EO=71B7W H4TU#7T--1%]03U=%4BP@ M6$)/6%]334)?2$]35%]#3TU-04Y$*3L*"6]U='=?<"AC;VUM86YD+"!80D]8 M7U--0E](3U-47T1!5$$I.PH);W5T=U]P*&EN=RA80D]87U--0E])3U]"05-% M*2Q80D]87U--0E])3U]"05-%*3L*"6]U=&)?<"@P>#!A+%A"3UA?4TU"7T=, M3T)!3%]%3D%"3$4I.PI]"EP*=F]I9"!M86-H:6YE7W)EPH)<')I;G1K*$M%4DY?24Y&3R B4V5N9&EN9R!03U=%4E]/ M1D8@=&\@6$)/6"U024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