Index: head/sys/conf/files.i386 =================================================================== --- head/sys/conf/files.i386 +++ head/sys/conf/files.i386 @@ -549,10 +549,6 @@ libkern/udivdi3.c standard libkern/umoddi3.c standard libkern/x86/crc32_sse42.c standard -i386/xbox/xbox.c optional xbox -i386/xbox/xboxfb.c optional xboxfb -dev/fb/boot_font.c optional xboxfb -i386/xbox/pic16l.s optional xbox # # x86 real mode BIOS support, required by dpms/pci/vesa # Index: head/sys/conf/options =================================================================== --- head/sys/conf/options +++ head/sys/conf/options @@ -892,9 +892,6 @@ HWPMC_HOOKS HWPMC_MIPS_BACKTRACE opt_hwpmc_hooks.h -# XBOX options for FreeBSD/i386, but some files are MI -XBOX opt_xbox.h - # Interrupt filtering INTR_FILTER Index: head/sys/i386/conf/NOTES =================================================================== --- head/sys/i386/conf/NOTES +++ head/sys/i386/conf/NOTES @@ -221,23 +221,6 @@ # options PERFMON -# -# XBOX causes the kernel to be bootable on the Microsoft XBox console system. -# The resulting kernel will auto-detect whether it is being booted on a XBox, -# so kernels compiled with this option will also work on an ordinary PC. -# This option require I686_CPU. -# -# xboxfb includes support for the XBox frame buffer device. It is fully USB- -# keyboard aware, and will only be used if an xbox is detected. This option -# (obviously) requires XBOX support in your kernel. -# -# NOTE: xboxfb currently conflicts with syscons(4); if you have an XBOX and -# include both in your kernel; you will not get any video output. Ordinary -# PC's do not suffer from this. -# -options XBOX -device xboxfb - ##################################################################### # NETWORKING OPTIONS Index: head/sys/i386/conf/XBOX =================================================================== --- head/sys/i386/conf/XBOX +++ head/sys/i386/conf/XBOX @@ -1,87 +0,0 @@ -# -# XBOX -- kernel for an XBOX -# -# $FreeBSD$ -cpu I686_CPU # Celeron -ident XBOX - -makeoptions MODULES_OVERRIDE="" - -options KDB -options DDB - -options XBOX # kernel is for XBOX -device xboxfb # frame buffer support (REQUIRED!) -device sc # syscons -device fb - -# no support yet for root device name fetching -options ROOTDEVNAME=\"ufs:ada0s1a\" -#options ROOTDEVNAME=\"cd9660:acd0\" - -options SCHED_4BSD # 4BSD scheduler -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options FFS # Berkeley Fast Filesystem -options SOFTUPDATES # Enable FFS soft updates support -#options UFS_ACL # Support for access control lists -#options UFS_DIRHASH # Improve performance on big directories -#options MD_ROOT # MD is a potential root device -options NFSCL # Network Filesystem Client -#options NFSD # Network Filesystem Server -#options NFSLOCKD # Network Lock Manager -#options NFS_ROOT # NFS usable as /, requires NFSCL -#options MSDOSFS # MSDOS Filesystem -options CD9660 # ISO 9660 Filesystem -#options PROCFS # Process filesystem (requires PSEUDOFS) -#options PSEUDOFS # Pseudo-filesystem framework -#options COMPAT_FREEBSD4 # Compatible with FreeBSD4 -#options KTRACE # ktrace(1) support -#options SYSVSHM # SYSV-style shared memory -#options SYSVMSG # SYSV-style message queues -#options SYSVSEM # SYSV-style semaphores -#options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions -#options KBD_INSTALL_CDEV # install a CDEV entry in /dev -# Xbox has a non-standard default timer frequency -options TIMER_FREQ=1125000 # Gives ~733.34MHz CPU - -#device apic # I/O APIC - -device pci - -# ATA and ATAPI devices -device ata - -# ATA/SCSI peripherals -device scbus # SCSI bus (required for ATA/SCSI) -device cd # CD -device da # Direct Access (disks) -device pass # Passthrough device (direct ATA/SCSI access) - -# Pseudo devices. -device loop # Network loopback -device random # Entropy device -device ether # Ethernet support -#device tun # Packet tunnel. -#device md # Memory "disks" -#device gif # IPv6 and IPv4 tunneling - -# The `bpf' device enables the Berkeley Packet Filter. -# Be aware of the administrative consequences of enabling this! -# Note that 'bpf' is required for DHCP. -device bpf # Berkeley packet filter - -# USB support -options USB_DEBUG # enable debug msgs -#device uhci # UHCI PCI->USB interface -device ohci # OHCI PCI->USB interface -device usb # USB Bus (required) -device ukbd # Keyboard -device umass # Disks/Mass storage - Requires scbus and da - -device miibus - -device sound -device snd_ich # nForce audio - -device nfe # nVidia nForce MCP on-board Ethernet Networking Index: head/sys/i386/i386/machdep.c =================================================================== --- head/sys/i386/i386/machdep.c +++ head/sys/i386/i386/machdep.c @@ -52,7 +52,6 @@ #include "opt_mp_watchdog.h" #include "opt_perfmon.h" #include "opt_platform.h" -#include "opt_xbox.h" #include #include @@ -148,13 +147,6 @@ #include #endif -#ifdef XBOX -#include - -int arch_i386_is_xbox = 0; -uint32_t arch_i386_xbox_memsize = 0; -#endif - /* Sanity check for __curthread() */ CTASSERT(offsetof(struct pcpu, pc_curthread) == 0); @@ -1780,18 +1772,6 @@ caddr_t kmdp; has_smap = 0; -#ifdef XBOX - if (arch_i386_is_xbox) { - /* - * We queried the memory size before, so chop off 4MB for - * the framebuffer and inform the OS of this. - */ - physmap[0] = 0; - physmap[1] = (arch_i386_xbox_memsize * 1024 * 1024) - XBOX_FB_SIZE; - physmap_idx = 0; - goto physmap_done; - } -#endif bzero(&vmf, sizeof(vmf)); bzero(physmap, sizeof(physmap)); basemem = 0; @@ -2299,28 +2279,6 @@ r_idt.rd_limit = sizeof(idt0) - 1; r_idt.rd_base = (int) idt; lidt(&r_idt); - -#ifdef XBOX - /* - * 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; - pic16l_setled(XBOX_LED_GREEN); - - /* - * 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 */ /* * Initialize the clock before the console so that console Index: head/sys/i386/i386/pmap.c =================================================================== --- head/sys/i386/i386/pmap.c +++ head/sys/i386/i386/pmap.c @@ -101,7 +101,6 @@ #include "opt_pmap.h" #include "opt_smp.h" #include "opt_vm.h" -#include "opt_xbox.h" #include #include @@ -149,10 +148,6 @@ #include #endif -#ifdef XBOX -#include -#endif - #ifndef PMAP_SHPGPERPROC #define PMAP_SHPGPERPROC 200 #endif @@ -501,12 +496,6 @@ * physical memory region that is used by the ACPI wakeup code. This * mapping must not have PG_G set. */ -#ifdef XBOX - /* FIXME: This is gross, but needed for the XBOX. Since we are in such - * an early stadium, we cannot yet neatly map video memory ... :-( - * Better fixes are very welcome! */ - if (!arch_i386_is_xbox) -#endif for (i = 1; i < NKPT; i++) PTD[i] = 0; Index: head/sys/i386/i386/vm_machdep.c =================================================================== --- head/sys/i386/i386/vm_machdep.c +++ head/sys/i386/i386/vm_machdep.c @@ -47,7 +47,6 @@ #include "opt_npx.h" #include "opt_reset.h" #include "opt_cpu.h" -#include "opt_xbox.h" #include #include @@ -91,10 +90,6 @@ #include -#ifdef XBOX -#include -#endif - #ifndef NSFBUFS #define NSFBUFS (512 + maxusers * 16) #endif @@ -600,14 +595,6 @@ void cpu_reset() { -#ifdef XBOX - if (arch_i386_is_xbox) { - /* Kick the PIC16L, it can reboot the box */ - pic16l_reboot(); - for (;;); - } -#endif - #ifdef SMP cpuset_t map; u_int cnt; Index: head/sys/i386/include/xbox.h =================================================================== --- head/sys/i386/include/xbox.h +++ head/sys/i386/include/xbox.h @@ -1,50 +0,0 @@ -/*- - * 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$ - */ -#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 (0x130000) -#define XBOX_FB_START (0xf0000000 | (XBOX_RAM_SIZE - XBOX_FB_SIZE)) -#define XBOX_FB_START_PTR (0xFD600800) - -extern int arch_i386_is_xbox; -extern uint32_t arch_i386_xbox_memsize; /* Megabytes */ - -void pic16l_setbyte(int addr, int reg, int data); -void pic16l_setled(int val); -void pic16l_reboot(void); -void pic16l_poweroff(void); - -#endif /* !_MACHINE_XBOX_H_ */ Index: head/sys/i386/pci/pci_cfgreg.c =================================================================== --- head/sys/i386/pci/pci_cfgreg.c +++ head/sys/i386/pci/pci_cfgreg.c @@ -30,8 +30,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_xbox.h" - #include #include #include @@ -52,10 +50,6 @@ #include #include -#ifdef XBOX -#include -#endif - #define PRVERB(a) do { \ if (bootverbose) \ printf a ; \ @@ -252,39 +246,6 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes) { int dataport = 0; - -#ifdef XBOX - if (arch_i386_is_xbox) { - /* - * The Xbox MCPX chipset is a derivative of the nForce 1 - * chipset. It almost has the same bus layout; some devices - * cannot be used, because they have been removed. - */ - - /* - * Devices 00:00.1 and 00:00.2 used to be memory controllers on - * the nForce chipset, but on the Xbox, using them will lockup - * the chipset. - */ - if (bus == 0 && slot == 0 && (func == 1 || func == 2)) - return dataport; - - /* - * Bus 1 only contains a VGA controller at 01:00.0. When you try - * to probe beyond that device, you only get garbage, which - * could cause lockups. - */ - if (bus == 1 && (slot != 0 || func != 0)) - return dataport; - - /* - * Bus 2 used to contain the AGP controller, but the Xbox MCPX - * doesn't have one. Probing it can cause lockups. - */ - if (bus >= 2) - return dataport; - } -#endif if (bus <= PCI_BUSMAX && slot < devmax Index: head/sys/i386/xbox/pic16l.s =================================================================== --- head/sys/i386/xbox/pic16l.s +++ head/sys/i386/xbox/pic16l.s @@ -1,202 +0,0 @@ -/*- - * 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$ - */ -#include - -.text - -/* - * send a command to the PIC16L - * - * void pic16l_setbyte (int addr, int reg, int data) - * - */ -ENTRY(pic16l_setbyte) - push %ebp - mov %esp,%ebp - - push %ebx - - movw $0xc000,%dx - -1: xor %eax,%eax - inw %dx,%ax - shr $0x0b,%eax - and $0x01,%eax - test %eax,%eax - jne 1b - - mov $50,%ecx -2: movw $0xc004,%dx - movl 0x8(%ebp),%eax - outb %al,%dx - movw $0xc008,%dx - movl 0xc(%ebp),%eax - outb %al,%dx - movw $0xc006,%dx - movl 0x10(%ebp),%eax - outw %ax,%dx - - movw $0xc000,%dx - inw %dx,%ax - outw %ax,%dx - - movw $0xc002,%dx - movb $0x1a,%al - outb %al,%dx - - movw $0xc000,%dx -3: - inb %dx,%al - movb %al,%bl - orb $0x36,%al - jz 3b - - orb $0x10,%bl - jnz 5f - -4: - push %ecx - xor %ecx,%ecx -l: loop l - pop %ecx - - dec %ecx - jz 5f - jmp 2b -5: - - pop %ebx - - leave - ret - -/* - * instructs the pic16l to reboot the xbox - * - * void pic16l_reboot(); - * - */ -ENTRY(pic16l_reboot) - pushl $0x01 - pushl $0x02 - pushl $0x20 - call pic16l_setbyte - addl $12,%esp - ret - -/* - * instructs the pic16l to power-off the xbox - * - * void pic16l_poweroff(); - * - */ -ENTRY(pic16l_poweroff) - pushl $0x80 - pushl $0x02 - pushl $0x20 - call pic16l_setbyte - addl $12,%esp - ret - -pic16l_ledhlp: - movw $0xc000,%dx -1: xor %eax,%eax - inw %dx,%ax - shr $0x0b,%eax - and $0x01,%eax - test %eax,%eax - jne 1b - - mov $400,%ecx - -2: - movw $0xc004,%dx - movb $0x20,%al - outb %al,%dx - - movw $0xc008,%dx - movb %bh,%al - outb %al,%dx - - movw $0xc006,%dx - movb %bl,%al - outb %al,%dx - - movw $0xc000,%dx - inw %dx,%ax - outw %ax,%dx - - movw $0xc002,%dx - movb $0x1a,%al - outb %al,%dx - - movw $0xc000,%dx -3: - inb %dx,%al - movb %al,%bl - orb $0x36,%al - jz 3b - - orb $0x10,%bl - jz 4f - - ret - -4: - push %ecx - xor %ecx,%ecx -l2: loop l2 - pop %ecx - dec %ecx - jz 5f - jmp 2b -5: - ret - -/* - * changes the front led - * - * void pic16l_setled (int val); - */ -ENTRY(pic16l_setled) - push %ebp - mov %esp,%ebp - - push %ebx - - movl 0x8(%ebp),%ebx - orl $0x800,%ebx - call pic16l_ledhlp - movl $0x701,%ebx - call pic16l_ledhlp - - pop %ebx - - leave - ret Index: head/sys/i386/xbox/xbox.c =================================================================== --- head/sys/i386/xbox/xbox.c +++ head/sys/i386/xbox/xbox.c @@ -1,63 +0,0 @@ -/*- - * 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$ - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef I686_CPU -#error You must have a I686_CPU in your kernel if you want to make an XBOX-compatible kernel -#endif - -static void -xbox_poweroff(void* junk, int howto) -{ - if (!(howto & RB_POWEROFF)) - return; - - pic16l_poweroff(); -} - -static void -xbox_init(void) -{ - - if (!arch_i386_is_xbox) - return; - - /* register our poweroff function */ - EVENTHANDLER_REGISTER (shutdown_final, xbox_poweroff, NULL, - SHUTDOWN_PRI_LAST); -} - -SYSINIT(xbox, SI_SUB_DRIVERS, SI_ORDER_FIRST, xbox_init, NULL); Index: head/sys/i386/xbox/xboxfb.c =================================================================== --- head/sys/i386/xbox/xboxfb.c +++ head/sys/i386/xbox/xboxfb.c @@ -1,655 +0,0 @@ -/*- - * Copyright (c) 2005, 2006 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * This is the syscon(4)-ized version of the Xbox Frame Buffer driver. It - * supports about all features required, such as mouse support. - * - * A lot of functions that are not useful to us have not been implemented. - * It appears that some functions are never called, but these implementations - * are here nevertheless. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct xboxfb_softc { - video_adapter_t sc_va; - - /* screen height (pixels) */ - uint32_t sc_height; - - /* screen width (pixels) */ - uint32_t sc_width; - - /* pointer to the actual XBOX video memory */ - char* sc_framebuffer; - - /* pointer to the font used */ - const struct gfb_font* sc_font; -}; - -#define SCREEN_WIDTH 640 -#define SCREEN_HEIGHT 480 - -#define XBOXFB_DRIVER_NAME "xboxsc" - -extern const struct gfb_font bold8x16; - -static vi_probe_t xboxfb_probe; -static vi_init_t xboxfb_init; -static vi_get_info_t xboxfb_get_info; -static vi_query_mode_t xboxfb_query_mode; -static vi_set_mode_t xboxfb_set_mode; -static vi_save_font_t xboxfb_save_font; -static vi_load_font_t xboxfb_load_font; -static vi_show_font_t xboxfb_show_font; -static vi_save_palette_t xboxfb_save_palette; -static vi_load_palette_t xboxfb_load_palette; -static vi_set_border_t xboxfb_set_border; -static vi_save_state_t xboxfb_save_state; -static vi_load_state_t xboxfb_load_state; -static vi_set_win_org_t xboxfb_set_win_org; -static vi_read_hw_cursor_t xboxfb_read_hw_cursor; -static vi_set_hw_cursor_t xboxfb_set_hw_cursor; -static vi_set_hw_cursor_shape_t xboxfb_set_hw_cursor_shape; -static vi_blank_display_t xboxfb_blank_display; -static vi_mmap_t xboxfb_mmap; -static vi_ioctl_t xboxfb_ioctl; -static vi_clear_t xboxfb_clear; -static vi_fill_rect_t xboxfb_fill_rect; -static vi_bitblt_t xboxfb_bitblt; -static vi_diag_t xboxfb_diag; -static vi_save_cursor_palette_t xboxfb_save_cursor_palette; -static vi_load_cursor_palette_t xboxfb_load_cursor_palette; -static vi_copy_t xboxfb_copy; -static vi_putp_t xboxfb_putp; -static vi_putc_t xboxfb_putc; -static vi_puts_t xboxfb_puts; -static vi_putm_t xboxfb_putm; - -static video_switch_t xboxvidsw = { - .probe = xboxfb_probe, - .init = xboxfb_init, - .get_info = xboxfb_get_info, - .query_mode = xboxfb_query_mode, - .set_mode = xboxfb_set_mode, - .save_font = xboxfb_save_font, - .load_font = xboxfb_load_font, - .show_font = xboxfb_show_font, - .save_palette = xboxfb_save_palette, - .load_palette = xboxfb_load_palette, - .set_border = xboxfb_set_border, - .save_state = xboxfb_save_state, - .load_state = xboxfb_load_state, - .set_win_org = xboxfb_set_win_org, - .read_hw_cursor = xboxfb_read_hw_cursor, - .set_hw_cursor = xboxfb_set_hw_cursor, - .set_hw_cursor_shape = xboxfb_set_hw_cursor_shape, - .blank_display = xboxfb_blank_display, - .mmap = xboxfb_mmap, - .ioctl = xboxfb_ioctl, - .clear = xboxfb_clear, - .fill_rect = xboxfb_fill_rect, - .bitblt = xboxfb_bitblt, - NULL, - NULL, - .diag = xboxfb_diag, - .save_cursor_palette = xboxfb_save_cursor_palette, - .load_cursor_palette = xboxfb_load_cursor_palette, - .copy = xboxfb_copy, - .putp = xboxfb_putp, - .putc = xboxfb_putc, - .puts = xboxfb_puts, - .putm = xboxfb_putm -}; - -static int xboxfb_configure(int flags); -VIDEO_DRIVER(xboxsc, xboxvidsw, xboxfb_configure); - -static vr_init_t xbr_init; -static vr_clear_t xbr_clear; -static vr_draw_border_t xbr_draw_border; -static vr_draw_t xbr_draw; -static vr_set_cursor_t xbr_set_cursor; -static vr_draw_cursor_t xbr_draw_cursor; -static vr_blink_cursor_t xbr_blink_cursor; -static vr_set_mouse_t xbr_set_mouse; -static vr_draw_mouse_t xbr_draw_mouse; - -/* - * We use our own renderer; this is because we must emulate a hardware - * cursor. - */ -static sc_rndr_sw_t xboxrend = { - xbr_init, - xbr_clear, - xbr_draw_border, - xbr_draw, - xbr_set_cursor, - xbr_draw_cursor, - xbr_blink_cursor, - xbr_set_mouse, - xbr_draw_mouse -}; -RENDERER(xboxsc, 0, xboxrend, gfb_set); - -static struct xboxfb_softc xboxfb_sc; - -/* color mappings, from dev/fb/creator.c */ -static const uint32_t cmap[] = { - 0x00000000, /* black */ - 0x000000ff, /* blue */ - 0x0000ff00, /* green */ - 0x0000c0c0, /* cyan */ - 0x00ff0000, /* red */ - 0x00c000c0, /* magenta */ - 0x00c0c000, /* brown */ - 0x00c0c0c0, /* light grey */ - 0x00808080, /* dark grey */ - 0x008080ff, /* light blue */ - 0x0080ff80, /* light green */ - 0x0080ffff, /* light cyan */ - 0x00ff8080, /* light red */ - 0x00ff80ff, /* light magenta */ - 0x00ffff80, /* yellow */ - 0x00ffffff /* white */ -}; - -/* mouse pointer from dev/syscons/scgfbrndr.c */ -static u_char mouse_pointer[16] = { - 0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7e, 0x68, - 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 -}; - -static int -xboxfb_init(int unit, video_adapter_t* adp, int flags) -{ - struct xboxfb_softc* sc = &xboxfb_sc; - video_info_t* vi; - int i; - int* iptr; - - vi = &adp->va_info; - - vid_init_struct (adp, XBOXFB_DRIVER_NAME, -1, unit); - sc->sc_height = SCREEN_HEIGHT; - sc->sc_width = SCREEN_WIDTH; - sc->sc_font = &bold8x16; - if (!(adp->va_flags & V_ADP_INITIALIZED)) { - /* - * We must make a mapping from video framebuffer memory - * to real. This is very crude: we map the entire - * videomemory to PAGE_SIZE! Since our kernel lives at - * it's relocated address range (0xc0xxxxxx), it won't - * care. - * - * We use address PAGE_SIZE and up so we can still trap - * NULL pointers. Once the real init is called, the - * mapping will be done via the OS and stored in a more - * sensible location ... but since we're not fully - * initialized, this is our only way to go :-( - */ - for (i = 0; i < (XBOX_FB_SIZE / PAGE_SIZE); i++) { - pmap_kenter (((i + 1) * PAGE_SIZE), XBOX_FB_START + (i * PAGE_SIZE)); - } - pmap_kenter ((i + 1) * PAGE_SIZE, XBOX_FB_START_PTR - XBOX_FB_START_PTR % PAGE_SIZE); - sc->sc_framebuffer = (char*)PAGE_SIZE; - - /* ensure the framebuffer is where we want it to be */ - *(uint32_t*)((i + 1) * PAGE_SIZE + XBOX_FB_START_PTR % PAGE_SIZE) = XBOX_FB_START; - - /* clear the screen */ - iptr = (uint32_t*)sc->sc_framebuffer; - for (i = 0; i < sc->sc_height * sc->sc_width; i++) - *iptr++ = cmap[0]; - - /* don't ever do this again! */ - adp->va_flags |= V_ADP_INITIALIZED; - } - - vi->vi_mode = M_TEXT_80x25; - vi->vi_cwidth = sc->sc_font->width; - vi->vi_cheight = sc->sc_font->height; - vi->vi_height = (sc->sc_height / vi->vi_cheight); - vi->vi_width = (sc->sc_width / vi->vi_cwidth); - vi->vi_flags = V_INFO_COLOR | V_INFO_LINEAR; - vi->vi_mem_model = V_INFO_MM_DIRECT; - - adp->va_flags |= V_ADP_COLOR; - - if (vid_register(adp) < 0) - return (ENXIO); - - adp->va_flags |= V_ADP_REGISTERED; - - return 0; -} - -static int -xboxfb_probe(int unit, video_adapter_t** adp, void* arg, int flags) -{ - return 0; -} - -static int -xboxfb_configure(int flags) -{ - struct xboxfb_softc* sc = &xboxfb_sc; - - /* Don't init the framebuffer on non-XBOX-es */ - if (!arch_i386_is_xbox) - return 0; - - /* - * If we do only a probe, we are in such an early boot stadium - * that we cannot yet do a 'clean' initialization. - */ - if (flags & VIO_PROBE_ONLY) { - xboxfb_init(0, &sc->sc_va, 0); - return 1; - } - - /* Do a clean mapping of the framebuffer memory */ - sc->sc_framebuffer = pmap_mapdev (XBOX_FB_START, XBOX_FB_SIZE); - return 1; -} - -static void -sc_identify(driver_t* driver, device_t parent) -{ - BUS_ADD_CHILD(parent, INT_MAX, SC_DRIVER_NAME, 0); -} - -static int -sc_probe(device_t dev) -{ - device_set_desc(dev, "XBox System console"); - return (sc_probe_unit(device_get_unit(dev), device_get_flags(dev) | SC_AUTODETECT_KBD)); -} - -static int sc_attach(device_t dev) -{ - return (sc_attach_unit(device_get_unit(dev), device_get_flags(dev) | SC_AUTODETECT_KBD)); -} - -static device_method_t sc_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, sc_identify), - DEVMETHOD(device_probe, sc_probe), - DEVMETHOD(device_attach, sc_attach), - { 0, 0 } -}; - -static driver_t xboxfb_sc_driver = { - SC_DRIVER_NAME, - sc_methods, - sizeof(sc_softc_t) -}; - -static devclass_t sc_devclass; - -DRIVER_MODULE(sc, legacy, xboxfb_sc_driver, sc_devclass, 0, 0); - -static void -xbr_init(scr_stat* scp) -{ -} - -static void -xbr_clear(scr_stat* scp, int c, int attr) -{ -} - -static void -xbr_draw_border(scr_stat* scp, int color) -{ -} - -static void -xbr_draw(scr_stat* scp, int from, int count, int flip) -{ - video_adapter_t* adp = scp->sc->adp; - int i, c, a; - - if (!flip) { - /* Normal printing */ - vidd_puts(adp, from, (uint16_t*)sc_vtb_pointer(&scp->vtb, from), count); - } else { - /* This is for selections and such: invert the color attribute */ - for (i = count; i-- > 0; ++from) { - c = sc_vtb_getc(&scp->vtb, from); - a = sc_vtb_geta(&scp->vtb, from) >> 8; - vidd_putc(adp, from, c, (a >> 4) | ((a & 0xf) << 4)); - } - } -} - -static void -xbr_set_cursor(scr_stat* scp, int base, int height, int blink) -{ -} - -static void -xbr_draw_cursor(scr_stat* scp, int at, int blink, int on, int flip) -{ - struct xboxfb_softc* sc = &xboxfb_sc; - video_adapter_t* adp = scp->sc->adp; - uint32_t* ptri = (uint32_t*)sc->sc_framebuffer; - int row, col, i, j; - - if (scp->curs_attr.height <= 0) - return; - - /* calculate the coordinates in the video buffer */ - row = (at / adp->va_info.vi_width) * adp->va_info.vi_cheight; - col = (at % adp->va_info.vi_width) * adp->va_info.vi_cwidth; - ptri += (row * sc->sc_width) + col; - - /* our cursor consists of simply inverting the char under it */ - for (i = 0; i < adp->va_info.vi_cheight; i++) { - for (j = 0; j < adp->va_info.vi_cwidth; j++) { - *ptri++ ^= 0x00FFFFFF; - } - ptri += (sc->sc_width - adp->va_info.vi_cwidth); - } -} - -static void -xbr_blink_cursor(scr_stat* scp, int at, int flip) -{ -} - -static void -xbr_set_mouse(scr_stat* scp) -{ -} - -static void -xbr_draw_mouse(scr_stat* scp, int x, int y, int on) -{ - vidd_putm(scp->sc->adp, x, y, mouse_pointer, 0xffffffff, 16, 8); - -} - -static int -xboxfb_get_info(video_adapter_t *adp, int mode, video_info_t *info) -{ - bcopy(&adp->va_info, info, sizeof(*info)); - return (0); -} - -static int -xboxfb_query_mode(video_adapter_t *adp, video_info_t *info) -{ - return (ENODEV); -} - -static int -xboxfb_set_mode(video_adapter_t *adp, int mode) -{ - return (0); -} - -static int -xboxfb_save_font(video_adapter_t *adp, int page, int size, int width, - u_char *data, int c, int count) -{ - return (ENODEV); -} - -static int -xboxfb_load_font(video_adapter_t *adp, int page, int size, int width, - u_char *data, int c, int count) -{ - return (ENODEV); -} - -static int -xboxfb_show_font(video_adapter_t *adp, int page) -{ - return (ENODEV); -} - -static int -xboxfb_save_palette(video_adapter_t *adp, u_char *palette) -{ - return (ENODEV); -} - -static int -xboxfb_load_palette(video_adapter_t *adp, u_char *palette) -{ - return (ENODEV); -} - -static int -xboxfb_set_border(video_adapter_t *adp, int border) -{ - return (0); -} - -static int -xboxfb_save_state(video_adapter_t *adp, void *p, size_t size) -{ - return (ENODEV); -} - -static int -xboxfb_load_state(video_adapter_t *adp, void *p) -{ - return (ENODEV); -} - -static int -xboxfb_set_win_org(video_adapter_t *adp, off_t offset) -{ - return (ENODEV); -} - -static int -xboxfb_read_hw_cursor(video_adapter_t *adp, int *col, int *row) -{ - *col = 0; - *row = 0; - return (0); -} - -static int -xboxfb_set_hw_cursor(video_adapter_t *adp, int col, int row) -{ - return (ENODEV); -} - -static int -xboxfb_set_hw_cursor_shape(video_adapter_t *adp, int base, int height, - int celsize, int blink) -{ - return (ENODEV); -} - -static int -xboxfb_blank_display(video_adapter_t *adp, int mode) -{ - return (0); -} - -static int -xboxfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot, vm_memattr_t *memattr) -{ - return (EINVAL); -} - -static int -xboxfb_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data) -{ - return (fb_commonioctl(adp, cmd, data)); -} - -static int -xboxfb_clear(video_adapter_t *adp) -{ - return (0); -} - -static int -xboxfb_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) -{ - return (0); -} - -static int -xboxfb_bitblt(video_adapter_t *adp, ...) -{ - return (ENODEV); -} - -static int -xboxfb_diag(video_adapter_t *adp, int level) -{ - video_info_t info; - - fb_dump_adp_info(adp->va_name, adp, level); - xboxfb_get_info(adp, 0, &info); - fb_dump_mode_info(adp->va_name, adp, &info, level); - return (0); -} - -static int -xboxfb_save_cursor_palette(video_adapter_t *adp, u_char *palette) -{ - return (ENODEV); -} - -static int -xboxfb_load_cursor_palette(video_adapter_t *adp, u_char *palette) -{ - return (ENODEV); -} - -static int -xboxfb_copy(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst, int n) -{ - return (ENODEV); -} - -static int -xboxfb_putp(video_adapter_t *adp, vm_offset_t off, u_int32_t p, u_int32_t a, - int size, int bpp, int bit_ltor, int byte_ltor) -{ - return (ENODEV); -} - -static int -xboxfb_putc(video_adapter_t *adp, vm_offset_t off, u_int8_t c, u_int8_t a) -{ - int row, col; - int i, j; - struct xboxfb_softc* sc = &xboxfb_sc; - uint32_t* ptri = (uint32_t*)sc->sc_framebuffer; - const uint8_t* fontdata; - uint32_t clr; - uint8_t mask; - - /* calculate the position in the frame buffer */ - row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; - col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; - fontdata = &sc->sc_font->data[c * adp->va_info.vi_cheight]; - ptri += (row * sc->sc_width) + col; - - /* Place the character on the screen, pixel by pixel */ - for (j = 0; j < adp->va_info.vi_cheight; j++) { - mask = 0x80; - for (i = 0; i < adp->va_info.vi_cwidth; i++) { - clr = (*fontdata & mask) ? cmap[a & 0xf] : cmap[(a >> 4) & 0xf]; - *ptri++ = clr; - mask >>= 1; - } - ptri += (sc->sc_width - adp->va_info.vi_cwidth); - fontdata++; - } - return (0); -} - -static int -xboxfb_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, int len) -{ - int i; - - for (i = 0; i < len; i++) { - vidd_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8); - } - return (0); -} - -static int -xboxfb_putm(video_adapter_t *adp, int x, int y, u_int8_t *pixel_image, - u_int32_t pixel_mask, int size, int width) -{ - struct xboxfb_softc* sc = &xboxfb_sc; - uint32_t* ptri = (uint32_t*)sc->sc_framebuffer; - int i, j; - - if (x < 0 || y < 0 || x + width > sc->sc_width || y + (2 * size) > sc->sc_height) - return 0; - - ptri += (y * sc->sc_width) + x; - - /* plot the mousecursor wherever the user wants it */ - for (j = 0; j < size; j++) { - for (i = width; i > 0; i--) { - if (pixel_image[j] & (1 << i)) - *ptri = cmap[0xf]; - ptri++; - } - ptri += (sc->sc_width - width); - } - return (0); -} Index: head/sys/isa/syscons_isa.c =================================================================== --- head/sys/isa/syscons_isa.c +++ head/sys/isa/syscons_isa.c @@ -60,12 +60,6 @@ #include -#include "opt_xbox.h" - -#ifdef XBOX -#include -#endif - static devclass_t sc_devclass; static sc_softc_t main_softc; @@ -157,19 +151,6 @@ { const char *at; int f, u; - -#ifdef XBOX - /* - * The XBox Loader does not support hints, which makes our initial - * console probe fail. Therefore, if an XBox is found, we hardcode the - * existence of the console, as it is always there anyway. - */ - if (arch_i386_is_xbox) { - *unit = 0; - *flags = SC_KERNEL_CONSOLE; - return (CN_INTERNAL); - } -#endif *unit = -1; for (u = 0; u < 16; u++) { Index: head/sys/x86/x86/cpu_machdep.c =================================================================== --- head/sys/x86/x86/cpu_machdep.c +++ head/sys/x86/x86/cpu_machdep.c @@ -54,7 +54,6 @@ #include "opt_platform.h" #ifdef __i386__ #include "opt_apic.h" -#include "opt_xbox.h" #endif #include