diff options
| author | jmcneill <jmcneill@NetBSD.org> | 2011-11-18 22:18:07 +0000 |
|---|---|---|
| committer | jmcneill <jmcneill@NetBSD.org> | 2011-11-18 22:18:07 +0000 |
| commit | 9ef3d86eaffc4de1c9c8cebfec0ef738968346d2 (patch) | |
| tree | d12ce4d8687536786aa163d8aab114348329686a | |
| parent | 8d1aaa9536e252a30d76be0fbc1edacd6495ef2e (diff) | |
remove Xbox support
| -rw-r--r-- | sys/arch/i386/conf/ALL | 13 | ||||
| -rw-r--r-- | sys/arch/i386/conf/XBOX | 282 | ||||
| -rw-r--r-- | sys/arch/i386/conf/files.i386 | 17 | ||||
| -rw-r--r-- | sys/arch/i386/i386/machdep.c | 53 | ||||
| -rw-r--r-- | sys/arch/i386/include/xbox.h | 98 | ||||
| -rw-r--r-- | sys/arch/i386/xbox/xbox.c | 122 | ||||
| -rw-r--r-- | sys/arch/i386/xbox/xboxfb.c | 576 | ||||
| -rw-r--r-- | sys/arch/i386/xbox/xboxlcd.c | 144 | ||||
| -rw-r--r-- | sys/arch/x86/pci/pci_machdep.c | 43 | ||||
| -rw-r--r-- | sys/arch/x86/x86/consinit.c | 23 | ||||
| -rw-r--r-- | sys/arch/xen/conf/files.compat | 5 | ||||
| -rw-r--r-- | sys/dev/i2c/files.i2c | 12 | ||||
| -rw-r--r-- | sys/dev/i2c/pic16lc.c | 290 | ||||
| -rw-r--r-- | sys/dev/i2c/xbseeprom.c | 171 |
14 files changed, 13 insertions, 1836 deletions
diff --git a/sys/arch/i386/conf/ALL b/sys/arch/i386/conf/ALL index 6fb070b71c8..4ebca2c2560 100644 --- a/sys/arch/i386/conf/ALL +++ b/sys/arch/i386/conf/ALL @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.325 2011/10/30 12:12:21 hannken Exp $ +# $NetBSD: ALL,v 1.326 2011/11/18 22:18:07 jmcneill Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.325 $" +#ident "ALL-$Revision: 1.326 $" maxusers 64 # estimated number of users @@ -39,9 +39,6 @@ powernow0 at cpu0 # AMD PowerNow! and Cool'n'Quiet (non-ACPI) viac7temp* at cpu? # VIA C7 temperature sensor vmt0 at cpu0 # VMware Tools -# XBOX support -options XBOX - options MTRR # memory-type range register syscall support # doesn't work with MP just yet.. options PERFCTRS # performance-monitoring counters support @@ -576,9 +573,6 @@ voodoofb* at pci? dev ? function ? wcfb* at pci? dev ? function ? wsdisplay* at wsemuldisplaydev? -# XBOX framebuffer console -xboxfb0 at pci? dev ? function ? - # DRI driver i915drm* at drm? # Intel i915, i945 DRM driver mach64drm* at drm? # mach64 (3D Rage Pro, Rage) DRM driver @@ -704,9 +698,6 @@ lm0 at iic? addr 0x2e flags 0x0 smscmon* at iic? addr 0x2c #smscmon* at iic? addr 0x2d # (alternate address) -pic16lc* at iic? addr 0x10 # XBOX PIC16LC -xbseeprom* at iic? addr 0x54 # XBOX serial EEPROM - # IBM Thinkpad Active Protection System aps0 at isa? port 0x1600 diff --git a/sys/arch/i386/conf/XBOX b/sys/arch/i386/conf/XBOX deleted file mode 100644 index 6945c405f1b..00000000000 --- a/sys/arch/i386/conf/XBOX +++ /dev/null @@ -1,282 +0,0 @@ -# $NetBSD: XBOX,v 1.27 2011/07/30 12:19:12 jmcneill Exp $ -# -# XBOX -- A basic Microsoft XBox kernel config file. -# - -include "arch/i386/conf/std.i386" - -maxusers 32 # estimated number of users - -options REALBASEMEM=639 # size of base memory (in KB) -options REALEXTMEM=60416 # size of extended memory (in KB) - -options MSGBUFSIZE=65536 # for PCI_CONFIG_DUMP space - -#options NFS_BOOT_RWSIZE=1024 # kue0 USB Ethernet has issues here - -options TIMER_FREQ=1125000 -options XBOX # kernel support for xbox - -# Standard system options -options INSECURE # disable kernel security levels - X needs this -options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT -options NTP # NTP phase/frequency locked loop -options KTRACE # system call tracing via ktrace(1) -options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel - -# Diagnostic/debugging support options -#options DIAGNOSTIC # expensive kernel consistency checks -#options DEBUG # expensive debugging checks/support -#options KMEMSTATS # kernel memory statistics (vmstat -m) -options DDB # in-kernel debugger -#options DDB_ONPANIC=1 # see also sysctl(8): `ddb.onpanic' -options DDB_HISTORY_SIZE=512 # enable history editing in DDB -#options KGDB # remote debugger -#options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600 -#makeoptions DEBUG="-g" # compile full symbol table - -# Compatibility options -options COMPAT_30 # NetBSD 3.0 -options COMPAT_40 # NetBSD 4.0 -options COMPAT_BSDPTY # /dev/[pt]ty?? ptys. - -# File systems -file-system FFS # UFS -file-system EXT2FS # second extended file system (linux) -file-system NFS # Network File System client -file-system CD9660 # ISO 9660 + Rock Ridge file system -file-system KERNFS # /kern -file-system PROCFS # /proc -file-system TMPFS # Efficient memory file-system -file-system UDF # OSTA UDF CD/DVD file-system - -# Networking options -options INET # IP + ICMP + TCP + UDP -#options INET6 # IPv6 - -# These options enable verbose messages for several subsystems. -# Warning, these may compile large string tables into the kernel! -#options MIIVERBOSE # verbose PHY autoconfig messages -#options PCIVERBOSE # verbose PCI device autoconfig messages -#options PCI_CONFIG_DUMP # verbosely dump PCI config space -options SCSIVERBOSE # human readable SCSI error messages -#options USBVERBOSE # verbose USB device autoconfig messages - -options NFS_BOOT_DHCP - -# -# wscons options -# -# builtin terminal emulations -options WSEMUL_VT100 # VT100 / VT220 emulation -options WSDISPLAY_COMPAT_RAWKBD -options WSDISPLAY_COMPAT_USL -# customization of console and kernel output - see dev/wscons/wsdisplayvar.h -options PCDISPLAY_SOFTCURSOR - -# Kernel root file system and dump configuration. -config netbsd root on ? type nfs -#config netbsd root on kue0 type nfs - -# -# Device configuration -# - -# Basic Bus Support - -# PCI bus support -pci* at mainbus? bus ? -pci* at pchb? bus ? -pci* at ppb? bus ? - -# PCI bridges -pchb* at pci? dev ? function ? # PCI-Host bridges -pcib* at pci? dev ? function ? # PCI-ISA bridges -ppb* at pci? dev ? function ? # PCI-PCI bridges - -agp* at pchb? - -# ISA bus support -isa0 at pcib? - -# Coprocessor Support -# Math Coprocessor support -npx0 at isa? port 0xf0 irq 13 # x86 math coprocessor - -# XBOX framebuffer console -xboxfb0 at pci? dev ? function ? -wsdisplay* at xboxfb? console ? - -# XBOX X3LCD console -#x3lcd0 at isa0 -#x3lcd0 at mainbus? -#wsdisplay* at x3lcd0 console ? - -# I2C/SMBus support -amdpm* at pci? dev ? function ? # RNG and SMBus 1.0 interface -iic* at amdpm? -pic16lc* at iic? addr 0x10 -xbseeprom* at iic? addr 0x54 - -#attimer0 at isa? - -# IDE and related devices -viaide* at pci? dev ? function ? # VIA/AMD/Nvidia IDE controllers -atabus* at ata? -wd* at atabus? drive ? flags 0x0000 -atapibus* at atapi? - -# ATAPI devices -# flags have the same meaning as for IDE drives. -cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives -sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives -uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown - -# Network Interfaces - -# PCI network interfaces -nfe* at pci? dev ? function ? # NVIDIA nForce Ethernet - -# MII/PHY support -acphy* at mii? phy ? # Altima AC101 and AMD Am79c874 PHYs -amhphy* at mii? phy ? # AMD 79c901 Ethernet PHYs -bmtphy* at mii? phy ? # Broadcom BCM5201 and BCM5202 PHYs -brgphy* at mii? phy ? # Broadcom BCM5400-family PHYs -ciphy* at mii? phy ? # Cicada CS8201 Gig-E PHYs -dmphy* at mii? phy ? # Davicom DM9101 PHYs -exphy* at mii? phy ? # 3Com internal PHYs -gentbi* at mii? phy ? # Generic Ten-Bit 1000BASE-[CLS]X PHYs -glxtphy* at mii? phy ? # Level One LXT-1000 PHYs -gphyter* at mii? phy ? # NS83861 Gig-E PHY -#icsphy* at mii? phy ? # Integrated Circuit Systems ICS189x -igphy* at mii? phy ? # Intel IGP01E1000 -ihphy* at mii? phy ? # Intel 82577 PHYs -ikphy* at mii? phy ? # Intel 82563 PHYs -inphy* at mii? phy ? # Intel 82555 PHYs -iophy* at mii? phy ? # Intel 82553 PHYs -lxtphy* at mii? phy ? # Level One LXT-970 PHYs -makphy* at mii? phy ? # Marvell Semiconductor 88E1000 PHYs -nsphy* at mii? phy ? # NS83840 PHYs -nsphyter* at mii? phy ? # NS83843 PHYs -pnaphy* at mii? phy ? # generic HomePNA PHYs -qsphy* at mii? phy ? # Quality Semiconductor QS6612 PHYs -rgephy* at mii? phy ? # Realtek 8169S/8110S internal PHYs -rlphy* at mii? phy ? # Realtek 8139/8201L PHYs -sqphy* at mii? phy ? # Seeq 80220/80221/80223 PHYs -tlphy* at mii? phy ? # ThunderLAN PHYs -tqphy* at mii? phy ? # TDK Semiconductor PHYs -#ukphy* at mii? phy ? # generic unknown PHYs -urlphy* at mii? phy ? # Realtek RTL8150L internal PHYs - -# USB Controller and Devices - -# PCI USB controllers -ohci* at pci? dev ? function ? # Open Host Controller - -# USB bus support -usb* at ohci? - -# USB Hubs -uhub* at usb? -uhub* at uhub? port ? - -# USB HID device -uhidev* at uhub? port ? configuration ? interface ? - -# USB Mice -ums* at uhidev? reportid ? -wsmouse* at ums? mux 0 - -# USB Keyboards -ukbd* at uhidev? reportid ? -wskbd* at ukbd? console ? mux 1 - -# USB serial adapter -ucycom* at uhidev? reportid ? - -# USB Generic HID devices -uhid* at uhidev? reportid ? - -# USB Printer -ulpt* at uhub? port ? configuration ? interface ? - -# USB Modem -umodem* at uhub? port ? configuration ? -ucom* at umodem? - -# Option N.V. Wireless WAN modems -uhso* at uhub? port ? configuration ? - -# USB Mass Storage -umass* at uhub? port ? configuration ? interface ? -wd* at umass? - -# USB audio -uaudio* at uhub? port ? configuration ? - -# USB MIDI -umidi* at uhub? port ? configuration ? - -# USB Ethernet adapters -aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters -cue* at uhub? port ? # CATC USB-EL1201A based adapters -kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters - -# Serial adapters -ubsa* at uhub? port ? # Belkin serial adapter -ucom* at ubsa? portno ? - -uftdi* at uhub? port ? # FTDI FT8U100AX serial adapter -ucom* at uftdi? portno ? - -umct* at uhub? port ? # MCT USB-RS232 serial adapter -ucom* at umct? portno ? - -uplcom* at uhub? port ? # I/O DATA USB-RSAQ2 serial adapter -ucom* at uplcom? portno ? - -uvscom* at uhub? port ? # SUNTAC Slipper U VS-10U serial adapter -ucom* at uvscom? portno ? - -# USB Generic driver -ugen* at uhub? port ? - - -# Audio Devices - -# PCI audio devices -auich* at pci? dev ? function ? # Intel ICH integrated AC'97 Audio - -# Audio support -audio* at audiobus? - - -# Pseudo-Devices - -pseudo-device crypto # /dev/crypto device -pseudo-device swcrypto # software crypto implementation - -# disk/mass storage pseudo-devices -#pseudo-device cgd 4 # cryptographic disk devices -#pseudo-device fss # file system snapshot device - -pseudo-device md # memory disk device (ramdisk) -pseudo-device vnd # disk-like interface to files -options VND_COMPRESSION # compressed vnd(4) - -# network pseudo-devices -pseudo-device bpfilter # Berkeley packet filter -#pseudo-device ipfilter # IP filter (firewall) and NAT -pseudo-device loop # network loopback -pseudo-device tap # virtual Ethernet -pseudo-device tun # network tunneling over tty - -# miscellaneous pseudo-devices -pseudo-device pty # pseudo-terminals -pseudo-device rnd # /dev/random and in-kernel generator -pseudo-device clockctl # user control of clock subsystem -pseudo-device ksyms # /dev/ksyms - -# wscons pseudo-devices -pseudo-device wsmux # mouse & keyboard multiplexor -pseudo-device wsfont diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index 5967caeab06..31b38c8a241 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $NetBSD: files.i386,v 1.361 2011/08/27 12:47:49 bouyer Exp $ +# $NetBSD: files.i386,v 1.362 2011/11/18 22:18:07 jmcneill Exp $ # # new style config file for i386 architecture # @@ -15,8 +15,8 @@ defparam opt_kernbase.h KERNBASE # delay before cpu_reset() for reboot. defparam CPURESET_DELAY -# Xbox support -defflag XBOX +# Obsolete Xbox support +obsolete defflag XBOX # VM86 emulation defflag VM86 @@ -328,17 +328,6 @@ attach apm at apmbus with apmbios: bioscall file arch/i386/i386/apmbios.c apmbios needs-flag file arch/i386/i386/apmcall.S apmbios -# XBox LED & system support -file arch/i386/xbox/xbox.c xbox - -# XBox X3LCD support (*very* rudimentary) -file arch/i386/xbox/xboxlcd.c xbox - -# XBox framebuffer support -device xboxfb: wsemuldisplaydev, rasops32, vcons -attach xboxfb at pci -file arch/i386/xbox/xboxfb.c xboxfb needs-flag - # # Compatibility modules # diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index ac9ef83792f..c7e1d8c8e1f 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.712 2011/11/10 00:12:04 jym Exp $ */ +/* $NetBSD: machdep.c,v 1.713 2011/11/18 22:18:08 jmcneill Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009 @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.712 2011/11/10 00:12:04 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.713 2011/11/18 22:18:08 jmcneill Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -86,7 +86,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.712 2011/11/10 00:12:04 jym Exp $"); #include "opt_realmem.h" #include "opt_user_ldt.h" #include "opt_vm86.h" -#include "opt_xbox.h" #include "opt_xen.h" #include "isa.h" #include "pci.h" @@ -179,13 +178,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.712 2011/11/10 00:12:04 jym Exp $"); #include <machine/vm86.h> #endif -#ifdef XBOX -#include <machine/xbox.h> - -int arch_i386_is_xbox = 0; -uint32_t arch_i386_xbox_memsize = 0; -#endif - #include "acpica.h" #include "apmbios.h" #include "bioscall.h" @@ -440,10 +432,6 @@ cpu_startup(void) */ consinit(); -#ifdef XBOX - xbox_startup(); -#endif - /* * Initialize error message buffer (et end of core). */ @@ -934,12 +922,6 @@ haltsys: HYPERVISOR_shutdown(); for (;;); #endif -#ifdef XBOX - if (arch_i386_is_xbox) { - xbox_poweroff(); - for (;;); - } -#endif #if NACPICA > 0 if (s != IPL_NONE) splx(s); @@ -1372,31 +1354,6 @@ init386(paddr_t first_avail) cpu_info_primary.ci_pae_l3_pdir = (pd_entry_t *)(rcr3() + KERNBASE); #endif /* PAE && !XEN */ -#ifdef XBOX - /* - * From Rink Springer @ FreeBSD: - * - * The following code queries the PCI ID of 0:0:0. For the XBOX, - * This should be 0x10de / 0x02a5. - * - * This is exactly what Linux does. - */ - outl(0xcf8, 0x80000000); - if (inl(0xcfc) == 0x02a510de) { - arch_i386_is_xbox = 1; - xbox_lcd_init(); - xbox_lcd_writetext("NetBSD/i386 "); - - /* - * We are an XBOX, but we may have either 64MB or 128MB of - * memory. The PCI host bridge should be programmed for this, - * so we just query it. - */ - outl(0xcf8, 0x80000084); - arch_i386_xbox_memsize = (inl(0xcfc) == 0x7FFFFFF) ? 128 : 64; - } -#endif /* XBOX */ - #if NISA > 0 || NPCI > 0 x86_bus_space_init(); #endif @@ -1685,12 +1642,6 @@ cpu_reset(void) struct region_descriptor region; x86_disable_intr(); -#ifdef XBOX - if (arch_i386_is_xbox) { - xbox_reboot(); - for (;;); - } -#endif /* * Ensure the NVRAM reset byte contains something vaguely sane. diff --git a/sys/arch/i386/include/xbox.h b/sys/arch/i386/include/xbox.h deleted file mode 100644 index 275539b5994..00000000000 --- a/sys/arch/i386/include/xbox.h +++ /dev/null @@ -1,98 +0,0 @@ -/* $NetBSD: xbox.h,v 1.3 2007/01/07 01:04:26 jmcneill Exp $ */ - -/*- - * Copyright (c) 2005 Rink Springer - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: /repoman/r/ncvs/src/sys/i386/include/xbox.h,v 1.3.2.1 2006/08/23 16:28:03 rink Exp $ - */ -#ifndef _MACHINE_XBOX_H_ -#define _MACHINE_XBOX_H_ - -#define XBOX_LED_GREEN 0x0f -#define XBOX_LED_RED 0xf0 -#define XBOX_LED_FLASHRED 0xa0 -#define XBOX_LED_FLASHGREEN 0x03 - -#define XBOX_RAM_SIZE (arch_i386_xbox_memsize * 1024 * 1024) -#define XBOX_FB_SIZE (0x400000) -#define XBOX_FB_START (0xf0000000 | (XBOX_RAM_SIZE - XBOX_FB_SIZE)) -#define XBOX_FB_START_PTR (0xFD600800) - -/* - * Defines for X3LCD controller - */ -#define X3LCD_O_LIGHT 0xF503 -#define X3LCD_O_DAT 0xF504 -#define X3LCD_O_CMD 0xF505 -#define X3LCD_O_DIR_DAT 0xF506 -#define X3LCD_O_DIR_CMD 0xF507 -#define X3LCD_O_CTR_TIME 2 -#define X3LCD_DISPCON_RS 0x01 -#define X3LCD_DISPCON_RW 0x02 -#define X3LCD_DISPCON_E 0x04 - -#define X3LCD_CMD 0x00 -#define X3LCD_INI 0x01 -#define X3LCD_DAT 0x02 - -#define X3LCD_CLEAR 0x01 -#define X3LCD_HOME 0x02 -#define X3LCD_ENTRY_MODE 0x04 -#define X3LCD_S_FLAG 0x01 -#define X3LCD_ID_FLAG 0x02 - -#define X3LCD_CONTROL 0x08 -#define X3LCD_D_FLAG 0x04 -#define X3LCD_C_FLAG 0x02 -#define X3LCD_B_FLAG 0x01 - -#define X3LCD_FUNC_SET 0x20 -#define X3LCD_DL_FLAG 0x10 -#define X3LCD_N_FLAG 0x08 -#define X3LCD_F_FLAG 0x04 - -#define X3LCD_DDRAM_SET 0x80 - -extern int arch_i386_is_xbox; -extern uint32_t arch_i386_xbox_memsize; /* Megabytes */ - -void xbox_setled(uint8_t); -void xbox_reboot(void); -void xbox_poweroff(void); -void xbox_startup(void); - -void xbox_lcd_init(void); -void xbox_lcd_output(unsigned char data, unsigned char command); -void xbox_lcd_setpos(unsigned int pos, unsigned int line); -void xbox_lcd_writestring(char *lcdstring); -void xbox_lcd_writetext(const char *lcdtext); -void xbox_lcd_putchar(unsigned char data); - -/* xboxfb related */ -int xboxfb_cnattach(void); - - -#endif /* !_MACHINE_XBOX_H_ */ diff --git a/sys/arch/i386/xbox/xbox.c b/sys/arch/i386/xbox/xbox.c deleted file mode 100644 index b7b420010cb..00000000000 --- a/sys/arch/i386/xbox/xbox.c +++ /dev/null @@ -1,122 +0,0 @@ -/* $NetBSD: xbox.c,v 1.6 2011/07/01 18:16:30 dyoung Exp $ */ - -/*- - * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Microsoft XBOX helper functions - */ - -#include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xbox.c,v 1.6 2011/07/01 18:16:30 dyoung Exp $"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <sys/bus.h> - -#include <arch/i386/include/xbox.h> - -#include "pic16lc.h" - -#if NPIC16LC > 0 -extern void pic16lc_setled(uint8_t); -extern void pic16lc_reboot(void); -extern void pic16lc_poweroff(void); -#endif - -#define XBOX_NFORCE_NIC 0xfef00000 - -void -xbox_startup(void) -{ - bus_space_handle_t h; - int rv; - - if (!arch_i386_is_xbox) - return; - - /* - * From Rink Springer @ FreeBSD: - * - * Some XBOX loaders, such as Cromwell, have a flaw which cause the - * nfe(4) driver to fail attaching to the NIC. - * - * This is because they leave the NIC running; this will cause the - * Nvidia driver to fail as the NIC does not return any sensible - * values and thus fails attaching (using an error 0x5, this means - * it cannot find a valid PHY) - * - * We bluntly tell the NIC to stop whatever it's doing; this makes - * nfe(4) attach correctly. As the NIC always resides at - * 0xfef00000-0xfef003ff on an XBOX, we simply hardcode this address. - */ - rv = bus_space_map(x86_bus_space_mem, XBOX_NFORCE_NIC, - 0x400, 0, &h); - if (!rv) { - bus_space_write_4(x86_bus_space_mem, h, 0x188, 0); - bus_space_unmap(x86_bus_space_mem, h, 0x400); - } - - -} - -void -xbox_setled(uint8_t val) -{ -#if NPIC16LC > 0 - pic16lc_setled(val); -#else - printf("xbox_setled: pic16lc driver missing from kernel!\n"); -#endif -} - -void -xbox_reboot(void) -{ -#if NPIC16LC > 0 - pic16lc_reboot(); -#else - printf("xbox_reboot: pic16lc driver missing from kernel!\n"); - printf("xbox_reboot: halting...\n"); - for (;;) - ; -#endif -} - -void -xbox_poweroff(void) -{ -#if NPIC16LC > 0 - pic16lc_poweroff(); -#else - printf("xbox_poweroff: pic16lc driver missing from kernel!\n"); - printf("xbox_poweroff: halting...\n"); - for (;;) - ; -#endif -} diff --git a/sys/arch/i386/xbox/xboxfb.c b/sys/arch/i386/xbox/xboxfb.c deleted file mode 100644 index 4e9b01101d4..00000000000 --- a/sys/arch/i386/xbox/xboxfb.c +++ /dev/null @@ -1,576 +0,0 @@ -/* $NetBSD: xboxfb.c,v 1.15 2011/07/01 18:16:30 dyoung Exp $ */ - -/* - * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca> - * Copyright (c) 2006 Andrew Gillham - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * A console driver for the Xbox. - */ - -#include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xboxfb.c,v 1.15 2011/07/01 18:16:30 dyoung Exp $"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/malloc.h> -#include <sys/callout.h> -#include <sys/lwp.h> -#include <sys/kauth.h> - -#include <uvm/uvm_extern.h> -/* #include <machine/autoconf.h> */ -#include <sys/bus.h> -#include <machine/xbox.h> - -#include <dev/pci/pcivar.h> -#include <dev/pci/pcireg.h> -#include <dev/pci/pcidevs.h> -#include <dev/pci/pciio.h> - -#include <dev/wscons/wsdisplayvar.h> -#include <dev/wscons/wsconsio.h> -#include <dev/wsfont/wsfont.h> -#include <dev/rasops/rasops.h> -#include <dev/wscons/wsdisplay_vconsvar.h> - -#include <dev/i2c/pic16lcreg.h> - -#include "opt_wsemul.h" - -MALLOC_DEFINE(M_XBOXFB, "xboxfb", "xboxfb shadow framebuffer"); - -#define SCREEN_WIDTH_SDTV 640 -#define SCREEN_HEIGHT_SDTV 480 -#define SCREEN_WIDTH_SDTVWS_CONEXANT 1024 -#define SCREEN_HEIGHT_SDTVWS_CONEXANT 576 -#define SCREEN_WIDTH_HDTV 720 -#define SCREEN_HEIGHT_HDTV 480 -#define SCREEN_WIDTH_VGA 800 -#define SCREEN_HEIGHT_VGA 600 -#define SCREEN_BPP 32 - -/* - * Define a safe area border for TV displays. - */ -#define XBOXFB_SAFE_AREA_SDTV_LEFT 40 -#define XBOXFB_SAFE_AREA_SDTV_TOP 40 -#define XBOXFB_SAFE_AREA_HDTV_LEFT 72 -#define XBOXFB_SAFE_AREA_HDTV_TOP 16 - -#define FONT_HEIGHT 16 -#define FONT_WIDTH 8 - -#define CHAR_HEIGHT 16 -#define CHAR_WIDTH 10 - -/* -#define XBOX_RAM_SIZE (arch_i386_xbox_memsize * 1024 * 1024) -#define XBOX_FB_SIZE (0x400000) -#define XBOX_FB_START (0xF0000000 | (XBOX_RAM_SIZE - XBOX_FB_SIZE)) -#define XBOX_FB_START_PTR (0xFD600800) -*/ - -struct xboxfb_softc { - struct vcons_data vd; - - bus_space_tag_t sc_memt; - bus_space_handle_t sc_memh; - - void *sc_ih; - - size_t memsize; - - int sc_mode; - uint32_t sc_bg; -}; - -static bus_space_handle_t xboxfb_console_memh; -static struct vcons_screen xboxfb_console_screen; -static uint8_t *xboxfb_console_bits; -static int xboxfb_console_width; -static int xboxfb_console_height; - -static int xboxfb_match(device_t, cfdata_t, void *); -static void xboxfb_attach(device_t, device_t, void *); - -static uint8_t xboxfb_get_avpack(void); -static void xboxfb_clear_fb(struct xboxfb_softc *); - -CFATTACH_DECL_NEW(xboxfb, sizeof(struct xboxfb_softc), xboxfb_match, - xboxfb_attach, NULL, NULL); - -/* static void xboxfb_init(struct xboxfb_softc *); */ - -/* static void xboxfb_cursor(void *, int, int, int); */ -/* static void xboxfb_copycols(void *, int, int, int, int); */ -/* static void xboxfb_erasecols(void *, int, int, int, long); */ -/* static void xboxfb_copyrows(void *, int, int, int); */ -/* static void xboxfb_eraserows(void *, int, int, long); */ - -struct wsscreen_descr xboxfb_defaultscreen = { - "default", - 0, 0, - NULL, - 8, 16, - WSSCREEN_WSCOLORS, - NULL, -}; - -const struct wsscreen_descr *_xboxfb_scrlist[] = { - &xboxfb_defaultscreen, -}; - -struct wsscreen_list xboxfb_screenlist = { - sizeof(_xboxfb_scrlist) / sizeof(struct wsscreen_descr *), - _xboxfb_scrlist -}; - -static int xboxfb_ioctl(void *, void *, u_long, void *, int, - struct lwp *); -static paddr_t xboxfb_mmap(void *, void *, off_t, int); -static void xboxfb_init_screen(void *, struct vcons_screen *, int, - long *); - -struct wsdisplay_accessops xboxfb_accessops = { - xboxfb_ioctl, - xboxfb_mmap, - NULL, /* alloc_screen */ - NULL, /* free_screen */ - NULL, /* show_screen */ - NULL, /* load_font */ - NULL, /* pollc */ - NULL, /* scroll */ -}; - -static int -xboxfb_match(device_t parent, cfdata_t match, void *aux) -{ - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - /* Don't match on non-Xbox i386 */ - if (!arch_i386_is_xbox) { - return (0); - } - - if (PCI_CLASS(pa->pa_class) != PCI_CLASS_DISPLAY || - PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_DISPLAY_VGA) - return 0; - if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_NVIDIA) && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NVIDIA_XBOXFB)) - return 100; - return 0; -}; - -static void -xboxfb_attach(device_t parent, device_t self, void *aux) -{ - struct xboxfb_softc *sc = device_private(self); - struct wsemuldisplaydev_attach_args aa; - struct rasops_info *ri; - int console; - ulong defattr = 0; - uint32_t bg, fg, ul; - - ri = &xboxfb_console_screen.scr_ri; - - sc->sc_memt = x86_bus_space_mem; - sc->sc_memh = xboxfb_console_memh; - sc->sc_mode = WSDISPLAYIO_MODE_EMUL; - - aprint_normal(": %dx%d, %d bit framebuffer console\n", - xboxfb_console_width, xboxfb_console_height, ri->ri_depth); - - vcons_init(&sc->vd, sc, &xboxfb_defaultscreen, &xboxfb_accessops); - sc->vd.init_screen = xboxfb_init_screen; - - /* yes, we're the console */ - console = 1; - - if (console) { - vcons_init_screen(&sc->vd, &xboxfb_console_screen, 1, - &defattr); - xboxfb_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; - } - - rasops_unpack_attr(defattr, &fg, &bg, &ul); - sc->sc_bg = ri->ri_devcmap[bg]; - - aa.console = console; - aa.scrdata = &xboxfb_screenlist; - aa.accessops = &xboxfb_accessops; - aa.accesscookie = &sc->vd; - - config_found(self, &aa, wsemuldisplaydevprint); -} - -/* - * respond to ioctl requests - */ - -static int -xboxfb_ioctl(void *v, void*vs, u_long cmd, void *data, int flag, - struct lwp *l) -{ - struct vcons_data *vd = v; - struct xboxfb_softc *sc = vd->cookie; - struct wsdisplay_fbinfo *wdf; - struct vcons_screen *ms = vd->active; - - switch (cmd) { - case WSDISPLAYIO_GTYPE: - *(u_int *)data = WSDISPLAY_TYPE_PCIMISC; - return 0; - - case WSDISPLAYIO_GINFO: - wdf = (void *)data; - wdf->height = xboxfb_console_height; - wdf->width = xboxfb_console_width; - wdf->depth = ms->scr_ri.ri_depth; - wdf->cmsize = 256; - return 0; - - case WSDISPLAYIO_GETCMAP: - return EINVAL; - - case WSDISPLAYIO_PUTCMAP: - return EINVAL; - - case WSDISPLAYIO_LINEBYTES: - *(u_int *)data = ms->scr_ri.ri_stride; - return 0; - - case WSDISPLAYIO_SMODE: { - int new_mode = *(int *)data; - if (new_mode != sc->sc_mode) { - sc->sc_mode = new_mode; - if (new_mode == WSDISPLAYIO_MODE_EMUL) { - xboxfb_clear_fb(sc); - vcons_redraw_screen(vd->active); - } - } - } - return 0; - } - return EPASSTHROUGH; -} - -static paddr_t -xboxfb_mmap(void *v, void *vs, off_t offset, int prot) -{ - struct vcons_data *vd; - struct xboxfb_softc *sc; - paddr_t pa; - - vd = (struct vcons_data *)v; - sc = (struct xboxfb_softc *)vd->cookie; - - if (offset >= 0 && offset < XBOX_FB_SIZE) { - pa = bus_space_mmap(x86_bus_space_mem, XBOX_FB_START, - offset, prot, BUS_SPACE_MAP_LINEAR); - return pa; - } - - return (-1); -} - -static void -xboxfb_init_screen(void *cookie, struct vcons_screen *scr, - int existing, long *defattr) -{ - /*struct xboxfb_softc *sc = cookie;*/ - struct rasops_info *ri = &scr->scr_ri; - struct rasops_info *console_ri; - - if (scr == &xboxfb_console_screen) - return; - console_ri = &xboxfb_console_screen.scr_ri; - - ri->ri_depth = console_ri->ri_depth; - ri->ri_width = console_ri->ri_width; - ri->ri_height = console_ri->ri_height; - ri->ri_stride = console_ri->ri_stride; - ri->ri_flg = 0; - - ri->ri_hwbits = console_ri->ri_hwbits; - ri->ri_bits = console_ri->ri_bits; - - if (existing) - ri->ri_flg |= RI_CLEAR; - - rasops_init(ri, ri->ri_height / 8, ri->ri_width / 8); - ri->ri_caps = WSSCREEN_WSCOLORS; - - rasops_reconfig(ri, ri->ri_height / ri->ri_font->fontheight, - ri->ri_width / ri->ri_font->fontwidth); - - ri->ri_hw = scr; -} - -static void -xboxfb_clear_fb(struct xboxfb_softc *sc) -{ - struct rasops_info *ri; - uint32_t fbsize; - - ri = &xboxfb_console_screen.scr_ri; - fbsize = ri->ri_height * ri->ri_stride; - - memset(xboxfb_console_bits, 0, fbsize); -} - -/* - * Gross hack to determine the display resolution based on the type of - * AV cable attached at boot. Since we don't have the capability of changing - * the display resolution yet, we need to rely on Cromwell/Xromwell to - * set this up for us. - */ -#define XBOX_SMBUS_BA 0xc000 -#define XBOX_PIC_ADDR 0x10 - -static uint8_t -xboxfb_smbus_read(bus_space_tag_t t, bus_space_handle_t h, uint8_t addr, - uint8_t cmd) -{ - uint8_t val; - - bus_space_write_1(t, h, 0x04, (addr << 1) | 1); - bus_space_write_1(t, h, 0x08, cmd); - bus_space_write_2(t, h, 0x00, bus_space_read_2(t, h, 0x00)); - bus_space_write_1(t, h, 0x02, 0x0a); - while (((val = bus_space_read_1(t, h, 0x00)) & 0x36) == 0) - ; - if (((val & 0x10) == 0) || (val & 0x24)) - return 0xff; - return bus_space_read_1(t, h, 0x06); -} - -static uint8_t -xboxfb_smbus_pic_read(bus_space_tag_t t, bus_space_handle_t h, uint8_t cmd) -{ - return xboxfb_smbus_read(t, h, XBOX_PIC_ADDR, cmd); -} - -/* - * Detect the TV encoder type; used to help determine which mode has been - * setup by the bootloader. - */ -#define XBOXFB_ENCODER_CONEXANT 1 -#define XBOXFB_ENCODER_FOCUS 2 -#define XBOXFB_ENCODER_XCALIBUR 3 - -static uint8_t -xboxfb_get_encoder(void) -{ - bus_space_tag_t t = x86_bus_space_io; - bus_space_handle_t h; - uint8_t rv; - - rv = bus_space_map(t, XBOX_SMBUS_BA, 16, 0, &h); - if (rv) - return XBOXFB_ENCODER_XCALIBUR; /* shouldn't happen */ - - if (xboxfb_smbus_read(t, h, 0x45, 0x00) != 0xff) - rv = XBOXFB_ENCODER_CONEXANT; - else if (xboxfb_smbus_read(t, h, 0x6a, 0x00) != 0xff) - rv = XBOXFB_ENCODER_FOCUS; - else - rv = XBOXFB_ENCODER_XCALIBUR; - - bus_space_unmap(t, h, 16); - - return rv; -} - -/* - * Detect widescreen settings from the EEPROM - */ -static uint8_t -xboxfb_is_widescreen(void) -{ - bus_space_tag_t t = x86_bus_space_io; - bus_space_handle_t h; - uint8_t rv; - - rv = bus_space_map(t, XBOX_SMBUS_BA, 16, 0, &h); - if (rv) - return 0; - - rv = xboxfb_smbus_read(t, h, 0x54, 0x96) & 1; - - bus_space_unmap(t, h, 16); - - return rv; -} - -static uint8_t -xboxfb_get_avpack(void) -{ - bus_space_tag_t t; - bus_space_handle_t h; - uint8_t rv; - - t = x86_bus_space_io; - rv = bus_space_map(t, XBOX_SMBUS_BA, 16, 0, &h); - if (rv) - return PIC16LC_REG_AVPACK_COMPOSITE; /* shouldn't happen */ - - rv = xboxfb_smbus_pic_read(t, h, PIC16LC_REG_AVPACK); - - bus_space_unmap(t, h, 16); - - return rv; -} - -int -xboxfb_cnattach(void) -{ - static int ncalls = 0; - struct rasops_info *ri = &xboxfb_console_screen.scr_ri; - uint8_t *xboxfb_console_shadowbits = NULL; - long defattr; - uint8_t avpack; - uint32_t fbsize; - uint32_t sa_top, sa_left; - - /* We can't attach if we're not running on an Xbox... */ - if (!arch_i386_is_xbox) - return 1; - - /* XXX jmcneill - * Console initialization is called multiple times on i386; the first - * two being too early for us to use malloc or bus_space_map. Defer - * initialization under these subsystems are ready. - */ - ++ncalls; - if (ncalls < 3) - return -1; - - wsfont_init(); - - /* - * We need to ask the pic16lc for the avpack type to determine - * which video mode the loader has setup for us - */ - avpack = xboxfb_get_avpack(); - switch (avpack) { - case PIC16LC_REG_AVPACK_HDTV: - ri->ri_width = SCREEN_WIDTH_HDTV; - ri->ri_height = SCREEN_HEIGHT_HDTV; - sa_top = XBOXFB_SAFE_AREA_HDTV_TOP; - sa_left = XBOXFB_SAFE_AREA_HDTV_LEFT; - break; - case PIC16LC_REG_AVPACK_VGA: - case PIC16LC_REG_AVPACK_VGA_SOG: - ri->ri_width = SCREEN_WIDTH_VGA; - ri->ri_height = SCREEN_HEIGHT_VGA; - sa_top = sa_left = 0; - break; - default: - /* Ugh, Cromwell puts Xboxes w/ Conexant encoders that are - * configured for widescreen mode into a different resolution. - * compensate for that here. - */ - if (xboxfb_is_widescreen() && - xboxfb_get_encoder() == XBOXFB_ENCODER_CONEXANT) { - ri->ri_width = SCREEN_WIDTH_SDTVWS_CONEXANT; - ri->ri_height = SCREEN_HEIGHT_SDTVWS_CONEXANT; - } else { - ri->ri_width = SCREEN_WIDTH_SDTV; - ri->ri_height = SCREEN_HEIGHT_SDTV; - } - sa_top = XBOXFB_SAFE_AREA_SDTV_TOP; - sa_left = XBOXFB_SAFE_AREA_SDTV_LEFT; - break; - } - - fbsize = ri->ri_width * ri->ri_height * 4; - - xboxfb_console_shadowbits = malloc(fbsize, M_XBOXFB, M_NOWAIT); - - if (xboxfb_console_shadowbits == NULL) - aprint_error("xboxfb_cnattach: failed to allocate shadowfb\n"); - - if (bus_space_map(x86_bus_space_mem, XBOX_FB_START, fbsize, - BUS_SPACE_MAP_LINEAR, &xboxfb_console_memh)) { - aprint_error("xboxfb_cnattach: failed to map memory.\n"); - return 1; - } - - ri->ri_depth = SCREEN_BPP; - ri->ri_stride = ri->ri_width * ri->ri_depth / 8; - ri->ri_flg = 0; /* RI_CENTER does not work with shadowfb */ - if (xboxfb_console_shadowbits) { - ri->ri_bits = xboxfb_console_shadowbits; - ri->ri_hwbits = bus_space_vaddr(x86_bus_space_mem, - xboxfb_console_memh); - xboxfb_console_bits = ri->ri_hwbits; - } else { - ri->ri_bits = bus_space_vaddr(x86_bus_space_mem, - xboxfb_console_memh); - ri->ri_hwbits = NULL; - xboxfb_console_bits = ri->ri_bits; - } - - /* clear screen */ - if (ri->ri_bits != NULL) - memset(ri->ri_bits, 0, fbsize); - if (ri->ri_hwbits != NULL) - memset(ri->ri_hwbits, 0, fbsize); - - - xboxfb_console_width = ri->ri_width; - xboxfb_console_height = ri->ri_height; - - /* Define a TV safe area where applicable */ - if (sa_left > 0) { - ri->ri_hwbits += (sa_left * 4); - ri->ri_width -= (sa_left * 2); - } - if (sa_top > 0) { - ri->ri_hwbits += (ri->ri_stride * sa_top); - ri->ri_height -= (sa_top * 2); - } - - rasops_init(ri, ri->ri_height / 8, ri->ri_width / 8); - ri->ri_caps = WSSCREEN_WSCOLORS; - rasops_reconfig(ri, - ri->ri_height / ri->ri_font->fontheight, - ri->ri_width / ri->ri_font->fontwidth); - - xboxfb_defaultscreen.nrows = ri->ri_rows; - xboxfb_defaultscreen.ncols = ri->ri_cols; - xboxfb_defaultscreen.textops = &ri->ri_ops; - xboxfb_defaultscreen.capabilities = ri->ri_caps; - ri->ri_ops.allocattr(ri, 0, 0, 0, &defattr); - - wsdisplay_preattach(&xboxfb_defaultscreen, ri, 0, 0, defattr); - - return 0; -} diff --git a/sys/arch/i386/xbox/xboxlcd.c b/sys/arch/i386/xbox/xboxlcd.c deleted file mode 100644 index ea5f9b299cb..00000000000 --- a/sys/arch/i386/xbox/xboxlcd.c +++ /dev/null @@ -1,144 +0,0 @@ -/* $NetBSD: xboxlcd.c,v 1.4 2011/07/01 18:16:30 dyoung Exp $ */ - -/*- - * Copyright (c) 2006 Andrew Gillham - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Driver for Xecuter X3 LCD add-on - */ - -#include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xboxlcd.c,v 1.4 2011/07/01 18:16:30 dyoung Exp $"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/bus.h> -#include <machine/xbox.h> -#include <machine/pio.h> - -void xbox_lcd_init(void) -{ - outb(X3LCD_O_DAT, 0); - outb(X3LCD_O_CMD, 0); - outb(X3LCD_O_DIR_DAT, 0xFF); - outb(X3LCD_O_DIR_CMD, 0x07); - - xbox_lcd_output(X3LCD_FUNC_SET | X3LCD_DL_FLAG, X3LCD_INI); - delay(50000); - xbox_lcd_output(X3LCD_FUNC_SET | X3LCD_DL_FLAG, X3LCD_INI); - delay(50000); - xbox_lcd_output(X3LCD_FUNC_SET | X3LCD_DL_FLAG, X3LCD_INI); - delay(50000); - xbox_lcd_output(X3LCD_FUNC_SET, X3LCD_INI); - delay(50000); - xbox_lcd_output(X3LCD_FUNC_SET | X3LCD_DL_FLAG | X3LCD_N_FLAG, X3LCD_CMD); - delay(50000); - xbox_lcd_output(X3LCD_CONTROL | X3LCD_D_FLAG, X3LCD_CMD); - delay(50000); - xbox_lcd_output(X3LCD_CLEAR, X3LCD_CMD); - delay(50000); - xbox_lcd_output(X3LCD_ENTRY_MODE | X3LCD_ID_FLAG, X3LCD_CMD); - delay(50000); - - /* xbox_lcd_setpos(0,0); */ - - outb(X3LCD_O_LIGHT, 81); - delay(50000); -} - -void xbox_lcd_output(unsigned char data, unsigned char command) -{ - unsigned char cmd = 0; - int s; - - if (command & X3LCD_DAT) - { - cmd |= X3LCD_DISPCON_RS; - } - - /* output upper nibble of data */ - /* outb(X3LCD_O_DAT, data & 0xF0); */ -/* - outb(X3LCD_O_DAT, data); - outb(X3LCD_O_CMD, cmd); - outb(X3LCD_O_CMD, X3LCD_DISPCON_E | cmd); - outb(X3LCD_O_CMD, cmd); -*/ - - s = splhigh(); - /* only if not init command */ - if ((command & X3LCD_INI) == 0) - { - /* output lower nibble of data */ - /* outb(X3LCD_O_DAT, (data << 4) & 0xF0); */ - outb(X3LCD_O_DAT, data); - outb(X3LCD_O_CMD, cmd); - outb(X3LCD_O_CMD, X3LCD_DISPCON_E | cmd); - outb(X3LCD_O_CMD, cmd); - } - splx(s); - delay(30000); -} - -void xbox_lcd_writestring(char *lcdstring) -{ - unsigned char i; - do { - i = *lcdstring; - if ( i == 0x00) - break; - - xbox_lcd_output(i, X3LCD_DAT); - i = *lcdstring++; - } while(1); -} - - -void xbox_lcd_writetext(const char *lcdtext) -{ - unsigned char i; - while ((i = *lcdtext++)) { - if ((i > 31) && (i < 128)) { - xbox_lcd_output(i, X3LCD_DAT); - } - } -} - -void xbox_lcd_putchar(unsigned char data) -{ - if ((data >= ' ') && (data <= '~')) { - xbox_lcd_output(data, X3LCD_DAT); - } -} - -void xbox_lcd_setpos(unsigned int pos, unsigned int line) -{ - xbox_lcd_output(X3LCD_DDRAM_SET | 0, X3LCD_CMD); -} - diff --git a/sys/arch/x86/pci/pci_machdep.c b/sys/arch/x86/pci/pci_machdep.c index f5758e135df..3d8ba34eb66 100644 --- a/sys/arch/x86/pci/pci_machdep.c +++ b/sys/arch/x86/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.52 2011/10/18 23:43:36 dyoung Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.53 2011/11/18 22:18:08 jmcneill Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.52 2011/10/18 23:43:36 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.53 2011/11/18 22:18:08 jmcneill Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -139,13 +139,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.52 2011/10/18 23:43:36 dyoung Exp #include "opt_pci_conf_mode.h" -#ifdef __i386__ -#include "opt_xbox.h" -#ifdef XBOX -#include <machine/xbox.h> -#endif -#endif - #ifdef PCI_CONF_MODE #if (PCI_CONF_MODE == 1) || (PCI_CONF_MODE == 2) static int pci_mode = PCI_CONF_MODE; @@ -389,20 +382,6 @@ pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) int pci_bus_maxdevs(pci_chipset_tag_t pc, int busno) { - -#if defined(__i386__) && defined(XBOX) - /* - * Scanning above the first device is fatal on the Microsoft Xbox. - * If busno=1, only allow for one device. - */ - if (arch_i386_is_xbox) { - if (busno == 1) - return 1; - else if (busno > 1) - return 0; - } -#endif - /* * Bus number is irrelevant. If Configuration Mechanism 2 is in * use, can only have devices 0-15 on any bus. If Configuration @@ -500,15 +479,6 @@ pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) return (*ipc->pc_ov->ov_conf_read)(ipc->pc_ctx, pc, tag, reg); } -#if defined(__i386__) && defined(XBOX) - if (arch_i386_is_xbox) { - int bus, dev, fn; - pci_decompose_tag(pc, tag, &bus, &dev, &fn); - if (bus == 0 && dev == 0 && (fn == 1 || fn == 2)) - return (pcireg_t)-1; - } -#endif - pci_conf_lock(&ocl, pci_conf_selector(tag, reg)); data = inl(pci_conf_port(tag, reg)); pci_conf_unlock(&ocl); @@ -531,15 +501,6 @@ pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data) return; } -#if defined(__i386__) && defined(XBOX) - if (arch_i386_is_xbox) { - int bus, dev, fn; - pci_decompose_tag(pc, tag, &bus, &dev, &fn); - if (bus == 0 && dev == 0 && (fn == 1 || fn == 2)) - return; - } -#endif - pci_conf_lock(&ocl, pci_conf_selector(tag, reg)); outl(pci_conf_port(tag, reg), data); pci_conf_unlock(&ocl); diff --git a/sys/arch/x86/x86/consinit.c b/sys/arch/x86/x86/consinit.c index 35e877aef9d..25b200ba360 100644 --- a/sys/arch/x86/x86/consinit.c +++ b/sys/arch/x86/x86/consinit.c @@ -1,4 +1,4 @@ -/* $NetBSD: consinit.c,v 1.22 2011/07/01 18:21:31 dyoung Exp $ */ +/* $NetBSD: consinit.c,v 1.23 2011/11/18 22:18:08 jmcneill Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.22 2011/07/01 18:21:31 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.23 2011/11/18 22:18:08 jmcneill Exp $"); #include "opt_kgdb.h" @@ -70,13 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.22 2011/07/01 18:21:31 dyoung Exp $") #include <dev/wsfb/genfbvar.h> #endif -#ifdef __i386__ -#include "xboxfb.h" -#if (NXBOXFB > 0) -#include <machine/xbox.h> -#endif -#endif - #include "com.h" #if (NCOM > 0) #include <sys/termios.h> @@ -177,18 +170,6 @@ consinit(void) } genfb_disable(); #endif -#if (NXBOXFB > 0) - switch (xboxfb_cnattach()) { - case 0: - goto dokbd; - case 1: - break; - case -1: - /* defer initialization until later */ - initted = 0; - return; - } -#endif #if (NVGA > 0) if (!vga_cnattach(x86_bus_space_io, x86_bus_space_mem, -1, 1)) diff --git a/sys/arch/xen/conf/files.compat b/sys/arch/xen/conf/files.compat index 5a39740c17b..41d880a666a 100644 --- a/sys/arch/xen/conf/files.compat +++ b/sys/arch/xen/conf/files.compat @@ -1,4 +1,4 @@ -# $NetBSD: files.compat,v 1.22 2009/10/03 20:56:39 jmcneill Exp $ +# $NetBSD: files.compat,v 1.23 2011/11/18 22:18:08 jmcneill Exp $ # NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp # options for MP configuration through the MP spec @@ -48,9 +48,6 @@ defflag opt_largepages.h XXXLARGEPAGES # kernel stack debug defflag opt_kstack_dr0.h XXXKSTACK_CHECK_DR0 -# Microsoft Xbox support -defflag opt_xbox.h XXXXBOX - #Pentium 4+ Thermal Monitor ODCM (aka On Demand Clock Modulation) defflag opt_intel_odcm.h XXXINTEL_ONDEMAND_CLOCKMOD diff --git a/sys/dev/i2c/files.i2c b/sys/dev/i2c/files.i2c index 6596264d2eb..91e7648f1f5 100644 --- a/sys/dev/i2c/files.i2c +++ b/sys/dev/i2c/files.i2c @@ -1,4 +1,4 @@ -# $NetBSD: files.i2c,v 1.44 2011/10/03 22:27:23 jmcneill Exp $ +# $NetBSD: files.i2c,v 1.45 2011/11/18 22:18:08 jmcneill Exp $ obsolete defflag opt_i2cbus.h I2C_SCAN define i2cbus { } @@ -143,16 +143,6 @@ attach sgsmix at iic file dev/i2c/sgsmix.c sgsmix needs-flag defflag opt_sgsmix.h SGSMIX_DEBUG -# Xbox PIC16LC System Management Controller -device pic16lc: sysmon_envsys -attach pic16lc at iic -file dev/i2c/pic16lc.c pic16lc needs-flag - -# Xbox Serial EEPROM -device xbseeprom -attach xbseeprom at iic -file dev/i2c/xbseeprom.c xbseeprom - # Memory Serial Presence Detect attach spdmem at iic with spdmem_iic file dev/i2c/spdmem_i2c.c spdmem_iic diff --git a/sys/dev/i2c/pic16lc.c b/sys/dev/i2c/pic16lc.c deleted file mode 100644 index 554fe4ea456..00000000000 --- a/sys/dev/i2c/pic16lc.c +++ /dev/null @@ -1,290 +0,0 @@ -/* $NetBSD: pic16lc.c,v 1.18 2011/11/17 16:04:07 christos Exp $ */ - -/*- - * Copyright (c) 2007, 2008 Jared D. McNeill <jmcneill@invisible.ca> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Microsoft XBOX System Management Controller - * - * Documentation lives here: - * http://www.xbox-linux.org/wiki/PIC - */ - -#include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pic16lc.c,v 1.18 2011/11/17 16:04:07 christos Exp $"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/malloc.h> - -#include <machine/xbox.h> - -#include <dev/sysmon/sysmonvar.h> -#include <dev/i2c/i2cvar.h> -#include <dev/i2c/pic16lcreg.h> - -static int pic16lc_match(device_t, cfdata_t, void *); -static void pic16lc_attach(device_t, device_t, void *); - -static int pic16lc_intr(void *); - -void pic16lc_reboot(void); -void pic16lc_poweroff(void); -void pic16lc_setled(uint8_t); - -#define XBOX_SENSOR_CPU 0 -#define XBOX_SENSOR_BOARD 1 -#define XBOX_NSENSORS 2 - -struct pic16lc_softc { - device_t sc_dev; - - i2c_tag_t sc_tag; - i2c_addr_t sc_addr; - void * sc_ih; - - envsys_data_t sc_sensor[XBOX_NSENSORS]; - struct sysmon_envsys *sc_sme; -}; - -static struct pic16lc_softc *pic16lc = NULL; - -static void pic16lc_update(struct pic16lc_softc *, envsys_data_t *); -static void pic16lc_refresh(struct sysmon_envsys *, envsys_data_t *); - -static void pic16lc_write_1(struct pic16lc_softc *, uint8_t, uint8_t); -static void pic16lc_read_1(struct pic16lc_softc *, uint8_t, uint8_t *); - -CFATTACH_DECL_NEW(pic16lc, sizeof(struct pic16lc_softc), - pic16lc_match, pic16lc_attach, NULL, NULL); - -static int -pic16lc_match(device_t parent, cfdata_t cf, void *opaque) -{ - struct i2c_attach_args *ia = opaque; - - if (pic16lc != NULL) /* we can only have one... */ - return 0; - if (ia->ia_addr != 0x10) /* must live at 0x10 on xbox */ - return 0; - - return 1; -} - -static void -pic16lc_attach(device_t parent, device_t self, void *opaque) -{ - struct pic16lc_softc *sc = device_private(self); - struct i2c_attach_args *ia = opaque; - u_char ver[4]; - int i; - - sc->sc_dev = self; - sc->sc_tag = ia->ia_tag; - sc->sc_addr = ia->ia_addr; - - pic16lc = sc; - - sc->sc_sme = sysmon_envsys_create(); - - /* initialize CPU sensor */ - sc->sc_sensor[XBOX_SENSOR_CPU].units = ENVSYS_STEMP; - sc->sc_sensor[XBOX_SENSOR_CPU].state = ENVSYS_SINVALID; - (void)strlcpy(sc->sc_sensor[XBOX_SENSOR_CPU].desc, "Xbox CPU Temp", - sizeof(sc->sc_sensor[XBOX_SENSOR_CPU])); - /* initialize board sensor */ - sc->sc_sensor[XBOX_SENSOR_BOARD].units = ENVSYS_STEMP; - sc->sc_sensor[XBOX_SENSOR_BOARD].state = ENVSYS_SINVALID; - (void)strlcpy(sc->sc_sensor[XBOX_SENSOR_BOARD].desc, "Xbox Board Temp", - sizeof(sc->sc_sensor[XBOX_SENSOR_BOARD])); - - for (i = 0; i < XBOX_NSENSORS; i++) { - if (sysmon_envsys_sensor_attach(sc->sc_sme, - &sc->sc_sensor[i])) { - sysmon_envsys_destroy(sc->sc_sme); - return; - } - } - - /* hook into sysmon */ - sc->sc_sme->sme_name = device_xname(sc->sc_dev); - sc->sc_sme->sme_cookie = sc; - sc->sc_sme->sme_refresh = pic16lc_refresh; - - if (sysmon_envsys_register(sc->sc_sme)) { - aprint_error_dev(self, "unable to register with sysmon\n"); - sysmon_envsys_destroy(sc->sc_sme); - return; - } - - if (iic_acquire_bus(sc->sc_tag, 0) != 0) { - aprint_error(": unable to acquire i2c bus\n"); - return; - } - - aprint_normal(": Xbox System Management Controller"); - - /* find the PIC version */ - pic16lc_write_1(sc, PIC16LC_REG_VER, 0x00); - pic16lc_read_1(sc, PIC16LC_REG_VER, &ver[0]); - pic16lc_read_1(sc, PIC16LC_REG_VER, &ver[1]); - pic16lc_read_1(sc, PIC16LC_REG_VER, &ver[2]); - ver[3] = '\0'; - - aprint_normal(" (rev. %s)\n", ver); - - pic16lc_setled(0xff); /* orange */ - - iic_release_bus(sc->sc_tag, 0); - - /* disable reset on eject */ - pic16lc_write_1(sc, PIC16LC_REG_RESETONEJECT, 0x01); - - sc->sc_ih = iic_smbus_intr_establish_proc(sc->sc_tag, pic16lc_intr, sc); - if (sc->sc_ih == NULL) - aprint_error_dev(self, "couldn't establish interrupt\n"); - - return; -} - -static void -pic16lc_write_1(struct pic16lc_softc *sc, uint8_t cmd, uint8_t val) -{ - iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, - sc->sc_addr, &cmd, 1, &val, 1, 0); -} - -static void -pic16lc_read_1(struct pic16lc_softc *sc, uint8_t cmd, uint8_t *valp) -{ - iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, - sc->sc_addr, &cmd, 1, valp, 1, 0); -} - -static void -pic16lc_update(struct pic16lc_softc *sc, envsys_data_t *edata) -{ - uint8_t temp, sensor; - - switch (edata->sensor) { - case XBOX_SENSOR_CPU: - sensor = PIC16LC_REG_CPUTEMP; - break; - case XBOX_SENSOR_BOARD: - sensor = PIC16LC_REG_BOARDTEMP; - break; - default: - aprint_error(": invalid sensor %u\n", edata->sensor); - return; - } - - if (iic_acquire_bus(sc->sc_tag, 0) != 0) { - aprint_error(": unable to acquire i2c bus\n"); - return; - } - - pic16lc_read_1(sc, sensor, &temp); - edata->state = ENVSYS_SVALID; - edata->value_cur = (unsigned int)temp * 1000000 + 273150000; - - iic_release_bus(sc->sc_tag, 0); - - return; -} - -static void -pic16lc_refresh(struct sysmon_envsys *sme, envsys_data_t *edata) -{ - struct pic16lc_softc *sc = sme->sme_cookie; - - pic16lc_update(sc, edata); -} - -static int -pic16lc_intr(void *opaque) -{ - struct pic16lc_softc *sc = opaque; - uint8_t val; - int rv = 0; - - pic16lc_read_1(sc, PIC16LC_REG_INTSTATUS, &val); - if (val == 0) - return rv; - - if (val & PIC16LC_REG_INTSTATUS_POWER) - aprint_normal_dev(sc->sc_dev, "power button pressed\n"); - if (val & PIC16LC_REG_INTSTATUS_TRAYCLOSED) - aprint_normal_dev(sc->sc_dev, "tray closed\n"); - if (val & PIC16LC_REG_INTSTATUS_TRAYOPENING) { - aprint_normal_dev(sc->sc_dev, "tray opening\n"); - pic16lc_write_1(sc, PIC16LC_REG_INTACK, 0x02); - } - if (val & PIC16LC_REG_INTSTATUS_AVPACK_UNPLUG) - aprint_normal_dev(sc->sc_dev, "A/V pack removed\n"); - if (val & PIC16LC_REG_INTSTATUS_AVPACK_PLUG) - aprint_normal_dev(sc->sc_dev, "A/V pack inserted\n"); - if (val & PIC16LC_REG_INTSTATUS_EJECT_BUTTON) { - pic16lc_write_1(sc, PIC16LC_REG_INTACK, 0x04); - pic16lc_write_1(sc, PIC16LC_REG_TRAYEJECT, 0x00); - ++rv; - } - if (val & PIC16LC_REG_INTSTATUS_TRAYCLOSING) - aprint_normal_dev(sc->sc_dev, "tray closing\n"); - - return rv; -} - -void -pic16lc_reboot(void) -{ - if (pic16lc == NULL) { - printf("pic16lc_reboot: driver not attached!\n"); - return; - } - pic16lc_write_1(pic16lc, PIC16LC_REG_POWER, PIC16LC_REG_POWER_RESET); -} - -void -pic16lc_poweroff(void) -{ - if (pic16lc == NULL) { - printf("pic16lc_poweroff: driver not attached!\n"); - return; - } - pic16lc_write_1(pic16lc, PIC16LC_REG_POWER, PIC16LC_REG_POWER_SHUTDOWN); -} - -void -pic16lc_setled(uint8_t val) -{ - if (pic16lc == NULL) { - printf("pic16lc_setled: driver not attached!\n"); - return; - } - pic16lc_write_1(pic16lc, PIC16LC_REG_LEDSEQ, val); - pic16lc_write_1(pic16lc, PIC16LC_REG_LEDMODE, 0x01); -} diff --git a/sys/dev/i2c/xbseeprom.c b/sys/dev/i2c/xbseeprom.c deleted file mode 100644 index 08c7b17a89e..00000000000 --- a/sys/dev/i2c/xbseeprom.c +++ /dev/null @@ -1,171 +0,0 @@ -/* $NetBSD: xbseeprom.c,v 1.6 2008/05/05 00:21:04 jmcneill Exp $ */ - -/*- - * Copyright (c) 2007, 2008 Jared D. McNeill <jmcneill@invisible.ca> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Microsoft XBOX Serial EEPROM - * - * Documentation lives here: - * http://www.xbox-linux.org/wiki/Xbox_Serial_EEPROM - */ - -#include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xbseeprom.c,v 1.6 2008/05/05 00:21:04 jmcneill Exp $"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/kmem.h> -#include <sys/sysctl.h> - -#include <dev/i2c/i2cvar.h> - -static int xbseeprom_match(device_t, cfdata_t, void *); -static void xbseeprom_attach(device_t, device_t, void *); - -struct xbseeprom_data { - /* factory settings */ - uint8_t HMAC_SHA1_Hash[20]; - uint8_t Confounder[8]; - uint8_t HDDKkey[16]; - uint8_t XBERegion[4]; - uint8_t Checksum2[4]; - uint8_t SerialNumber[12]; - uint8_t MACAddress[6]; - uint8_t UNKNOWN2[2]; - uint8_t OnlineKey[16]; - uint8_t VideoStandard[4]; - uint8_t UNKNOWN3[4]; - /* user settings */ - uint8_t Checksum3[4]; - uint8_t TimeZoneBias[4]; - uint8_t TimeZoneStdName[4]; - uint8_t TimeZoneDltName[4]; - uint8_t UNKNOWN4[8]; - uint8_t TimeZoneStdDate[4]; - uint8_t TimeZoneDltDate[4]; - uint8_t UNKNOWN5[8]; - uint8_t TimeZoneStdBias[4]; - uint8_t TimeZoneDltBias[4]; - uint8_t LanguageID[4]; - uint8_t VideoFlags[4]; - uint8_t AudioFlags[4]; - uint8_t ParentalControlGames[4]; - uint8_t ParentalControlPwd[4]; - uint8_t ParentalControlMovies[4]; - uint8_t XBOXLiveIPAddress[4]; - uint8_t XBOXLiveDNS[4]; - uint8_t XBOXLiveGateway[4]; - uint8_t XBOXLiveSubnetMask[4]; - uint8_t OtherSettings[4]; - uint8_t DVDPlaybackKitZone[4]; - uint8_t UNKNOWN6[64]; -}; - -#define XBSEEPROM_SIZE (sizeof(struct xbseeprom_data)) - -struct xbseeprom_softc { - device_t sc_dev; - - i2c_tag_t sc_tag; - i2c_addr_t sc_addr; - - struct xbseeprom_data *sc_data; -}; - -static void xbseeprom_read_1(struct xbseeprom_softc *, uint8_t, uint8_t *); - -static char xbseeprom_serial[17]; - -CFATTACH_DECL_NEW(xbseeprom, sizeof(struct xbseeprom_softc), - xbseeprom_match, xbseeprom_attach, NULL, NULL); - -static int -xbseeprom_match(device_t parent, cfdata_t cf, void *opaque) -{ - struct i2c_attach_args *ia = opaque; - - /* Serial EEPROM always lives at 0x54 on Xbox */ - if (ia->ia_addr == 0x54) - return 1; - - return 0; -} - -static void -xbseeprom_attach(device_t parent, device_t self, void *opaque) -{ - struct xbseeprom_softc *sc = device_private(self); - struct i2c_attach_args *ia = opaque; - uint8_t *ptr; - int i; - - sc->sc_dev = self; - sc->sc_tag = ia->ia_tag; - sc->sc_addr = ia->ia_addr; - - sc->sc_data = kmem_alloc(XBSEEPROM_SIZE, KM_SLEEP); - if (sc->sc_data == NULL) { - aprint_error(": Not enough memory to copy EEPROM\n"); - return; - } - - aprint_normal(": Xbox Serial EEPROM\n"); - - /* Read in EEPROM contents */ - ptr = (uint8_t *)sc->sc_data; - for (i = 0; i < XBSEEPROM_SIZE; i++, ptr++) - xbseeprom_read_1(sc, i, ptr); - -#if 0 - /* Display some interesting information */ - aprint_normal_dev(self, "MAC address %02x:%02x:%02x:%02x:%02x:%02x\n", - sc->sc_data->MACAddress[0], sc->sc_data->MACAddress[1], - sc->sc_data->MACAddress[2], sc->sc_data->MACAddress[3], - sc->sc_data->MACAddress[4], sc->sc_data->MACAddress[5] - ); -#endif - - /* Setup sysctl subtree */ - memset(xbseeprom_serial, 0, sizeof(xbseeprom_serial)); - memcpy(xbseeprom_serial, sc->sc_data->SerialNumber, 16); - - sysctl_createv(NULL, 0, NULL, NULL, - 0, CTLTYPE_STRING, "xbox_serial", - SYSCTL_DESCR("Xbox serial number"), - NULL, 0, &xbseeprom_serial, 0, - CTL_MACHDEP, CTL_CREATE, CTL_EOL); - - return; -} - -static void -xbseeprom_read_1(struct xbseeprom_softc *sc, uint8_t cmd, uint8_t *valp) -{ - iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, - sc->sc_addr, &cmd, 1, valp, 1, I2C_F_POLL); -} |
