* Using UML to work on framebuffers
@ 2003-01-15 0:31 Jon Smirl
2003-01-15 0:35 ` James Simmons
0 siblings, 1 reply; 3+ messages in thread
From: Jon Smirl @ 2003-01-15 0:31 UTC (permalink / raw)
To: fbdev
I have a patch for 2.5 that allows some framebuffers
drivers (non-dma ones) to run unmodified on UML. I'm
still working on DMA and IRQ support.
UML - user mode linux. UML runs the Linux kernel as a
process. For example my PC is booted on 2.4 and the
UML runs 2.5.
The advantage to this is that you can use gdb/ddd to
debug the fb driver code. It's actually kind of neat.
I use one gdb inside of UML to control the fbtest app
and another gdb to step the code inside of the fb
driver.
Is anyone interested in trying this out?
You need two video cards in your machine one for X and
one for the target framebuffer. I am using AGP for X
and targeting a PCI Rage128.
=====
Jon Smirl
jonsmirl@yahoo.com
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving
your online business a competitive advantage. Test-drive a Thawte SSL
certificate - our easy online guide will show you how. Click here to get
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Using UML to work on framebuffers
2003-01-15 0:31 Using UML to work on framebuffers Jon Smirl
@ 2003-01-15 0:35 ` James Simmons
2003-01-15 1:19 ` Jon Smirl
0 siblings, 1 reply; 3+ messages in thread
From: James Simmons @ 2003-01-15 0:35 UTC (permalink / raw)
To: Jon Smirl; +Cc: fbdev
Yes very much so. It woudl make my life easier.
> I have a patch for 2.5 that allows some framebuffers
> drivers (non-dma ones) to run unmodified on UML. I'm
> still working on DMA and IRQ support.
>
> UML - user mode linux. UML runs the Linux kernel as a
> process. For example my PC is booted on 2.4 and the
> UML runs 2.5.
>
> The advantage to this is that you can use gdb/ddd to
> debug the fb driver code. It's actually kind of neat.
> I use one gdb inside of UML to control the fbtest app
> and another gdb to step the code inside of the fb
> driver.
>
> Is anyone interested in trying this out?
>
> You need two video cards in your machine one for X and
> one for the target framebuffer. I am using AGP for X
> and targeting a PCI Rage128.
>
> =====
> Jon Smirl
> jonsmirl@yahoo.com
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: Take your first step towards giving
> your online business a competitive advantage. Test-drive a Thawte SSL
> certificate - our easy online guide will show you how. Click here to get
> started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving
your online business a competitive advantage. Test-drive a Thawte SSL
certificate - our easy online guide will show you how. Click here to get
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Using UML to work on framebuffers
2003-01-15 0:35 ` James Simmons
@ 2003-01-15 1:19 ` Jon Smirl
0 siblings, 0 replies; 3+ messages in thread
From: Jon Smirl @ 2003-01-15 1:19 UTC (permalink / raw)
To: James Simmons; +Cc: fbdev
[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]
Here's what you need to do:
1) Initialize your secondary adapter with vbios.vm86
http://www.arava.co.il/matan/svgalib/hypermail/1660.html
2) bk pull bk://namesys.com/bk/reiser4-linux-2.5 r25
Namsys uses UML to develop Reiser4. Oleg keeps UML and
2.5 very closely integrated and up to date.
If someone tells me how, I can generate a patch for a
vanilla 2.5. If I diff from torvalds, 1.919.1.104,
would that work?
3) cd r25/fs
bk pull bk://namesys.com/bk/reiser4
this is just needed to build properly
4) Apply the attached patch
5) make mrproper
6) copy attached config file
7) make oldconfig ARCH=um
8) make linux ARCH=um
9) Download a system disk image
http://user-mode-linux.sourceforge.net/dl-sf.html
I am using:
root_fs.rh-7.2-full.pristine.20020312.bz2
if you are running redhat you will already have UML
tools, if not you need to download them too.
10) Set up sudo to run linux as root. It needs to be
root to play with the hardware.
11) start ddd &
do a ps -aux and get the pid for gdb
from ddd open the file linux and set breakpoints
12) run the image, i use:
./run gdb-pid
sudo /home/jonsmirl/aty25/linux
ubd0=cow,/opt/uml/root_fs ubd1=cows,/opt/uml/swap
root=/dev/ubd/0 ubd4=cowr,/opt/uml/reiser4
eth0=tuntap,,,192.168.0.2 debug=parent gdb-pid=${1}
video=aty128fb
You don't need the swap and reiser4 images to start.
Read about networking with UML:
http://user-mode-linux.sourceforge.net/
I run NFS from UML to my host so that I can see my
host's disk. If you aren't running NAT you may need to
modify a few things.
Let me know what doesn't work. You're the lucky first
to try this. This is a lot of work to get set up, but
it is easy to use once you get it going.
Right now I'm trying to get interrupts working. Some
USB people are after me to help make their debugging easier.
=====
Jon Smirl
jonsmirl@yahoo.com
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
[-- Attachment #2: .config --]
[-- Type: application/octet-stream, Size: 8357 bytes --]
#
# Automatically generated make config: don't edit
#
CONFIG_USERMODE=y
CONFIG_MMU=y
CONFIG_SWAP=y
CONFIG_PCI=y
CONFIG_UID16=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_LOG_BUF_SHIFT=14
#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y
#
# General Setup
#
CONFIG_MODE_TT=y
CONFIG_MODE_SKAS=y
CONFIG_NET=y
CONFIG_SYSVIPC=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_MISC=y
CONFIG_HOSTFS=y
CONFIG_MCONSOLE=y
CONFIG_MAGIC_SYSRQ=y
# CONFIG_HOST_2G_2G is not set
# CONFIG_UML_SMP is not set
# CONFIG_SMP is not set
CONFIG_NEST_LEVEL=0
CONFIG_KERNEL_HALF_GIGS=1
# CONFIG_HIGHMEM is not set
CONFIG_PROC_MM=y
CONFIG_KERNEL_STACK_ORDER=2
#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
CONFIG_KMOD=y
#
# Virtual PCI Bus
#
# CONFIG_PCI_LEGACY_PROC is not set
CONFIG_PCI_NAMES=y
CONFIG_HOTPLUG=y
#
# USB support
#
# CONFIG_USB is not set
#
# Character Devices
#
CONFIG_STDIO_CONSOLE=y
CONFIG_SSL=y
CONFIG_FD_CHAN=y
# CONFIG_NULL_CHAN is not set
CONFIG_PORT_CHAN=y
CONFIG_PTY_CHAN=y
CONFIG_TTY_CHAN=y
CONFIG_XTERM_CHAN=y
CONFIG_CON_ZERO_CHAN="fd:0,fd:1"
CONFIG_CON_CHAN="xterm"
CONFIG_SSL_CHAN="pty"
CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=256
# CONFIG_WATCHDOG is not set
CONFIG_UML_SOUND=y
CONFIG_SOUND=y
CONFIG_HOSTAUDIO=y
#
# Block Devices
#
CONFIG_BLK_DEV_UBD=y
# CONFIG_BLK_DEV_UBD_SYNC is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_NBD=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_INITRD=y
# CONFIG_MMAPPER is not set
CONFIG_NETDEVICES=y
#
# Network Devices
#
CONFIG_UML_NET=y
CONFIG_UML_NET_ETHERTAP=y
CONFIG_UML_NET_TUNTAP=y
CONFIG_UML_NET_SLIP=y
CONFIG_UML_NET_DAEMON=y
CONFIG_UML_NET_MCAST=y
# CONFIG_UML_NET_PCAP is not set
# CONFIG_UML_NET_SLIRP is not set
CONFIG_DUMMY=y
# CONFIG_BONDING is not set
# CONFIG_EQUALIZER is not set
CONFIG_TUN=y
# CONFIG_ETHERTAP is not set
# CONFIG_PPP is not set
CONFIG_SLIP=m
# CONFIG_SLIP_COMPRESSED is not set
# CONFIG_SLIP_SMART is not set
# CONFIG_SLIP_MODE_SLIP6 is not set
#
# Networking support
#
#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_MMAP=y
# CONFIG_NETLINK_DEV is not set
# CONFIG_NETFILTER is not set
# CONFIG_FILTER is not set
CONFIG_UNIX=y
# CONFIG_NET_KEY is not set
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
# CONFIG_IP_ADVANCED_ROUTER is not set
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
# CONFIG_ARPD is not set
# CONFIG_INET_ECN is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
# CONFIG_XFRM_USER is not set
# CONFIG_IPV6 is not set
#
# SCTP Configuration (EXPERIMENTAL)
#
CONFIG_IPV6_SCTP__=y
# CONFIG_IP_SCTP is not set
# CONFIG_ATM is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_LLC is not set
# CONFIG_DECNET is not set
# CONFIG_BRIDGE is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_NET_DIVERT is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
# CONFIG_NET_FASTROUTE is not set
# CONFIG_NET_HW_FLOWCONTROL is not set
#
# QoS and/or fair queueing
#
# CONFIG_NET_SCHED is not set
#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
#
# ARCnet devices
#
# CONFIG_ARCNET is not set
#
# Ethernet (10 or 100Mbit)
#
# CONFIG_NET_ETHERNET is not set
#
# Ethernet (1000 Mbit)
#
# CONFIG_ACENIC is not set
# CONFIG_DL2K is not set
# CONFIG_E1000 is not set
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_R8169 is not set
# CONFIG_SK98LIN is not set
# CONFIG_TIGON3 is not set
# CONFIG_FDDI is not set
# CONFIG_HIPPI is not set
#
# Wireless LAN (non-hamradio)
#
# CONFIG_NET_RADIO is not set
#
# Token Ring devices (depends on LLC=y)
#
# CONFIG_RCPCI is not set
# CONFIG_SHAPER is not set
#
# Wan interfaces
#
# CONFIG_WAN is not set
#
# PCMCIA network device support
#
# CONFIG_NET_PCMCIA is not set
#
# File systems
#
# CONFIG_QUOTA is not set
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
CONFIG_REISER4_FS=y
CONFIG_REISER4_CHECK=y
CONFIG_REISER4_DEBUG=y
CONFIG_REISER4_CHECK_STACK=y
CONFIG_REISER4_DEBUG_MODIFY=y
CONFIG_REISER4_DEBUG_MEMCPY=y
CONFIG_REISER4_DEBUG_NODE=y
CONFIG_REISER4_ZERO_NEW_NODE=y
CONFIG_REISER4_TRACE=y
CONFIG_REISER4_EVENT_LOG=y
CONFIG_REISER4_STATS=y
CONFIG_REISER4_DEBUG_OUTPUT=y
# CONFIG_REISER4_NOOPT is not set
# CONFIG_REISERFS_FS is not set
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_XATTR=y
# CONFIG_EXT3_FS_POSIX_ACL is not set
CONFIG_JBD=y
# CONFIG_JBD_DEBUG is not set
# CONFIG_FAT_FS is not set
# CONFIG_EFS_FS is not set
# CONFIG_CRAMFS is not set
CONFIG_TMPFS=y
CONFIG_RAMFS=y
# CONFIG_ISO9660_FS is not set
# CONFIG_JFS_FS is not set
# CONFIG_MINIX_FS is not set
# CONFIG_VXFS_FS is not set
# CONFIG_NTFS_FS is not set
# CONFIG_HPFS_FS is not set
CONFIG_PROC_FS=y
CONFIG_DEVFS_FS=y
CONFIG_DEVFS_MOUNT=y
# CONFIG_DEVFS_DEBUG is not set
CONFIG_DEVPTS_FS=y
# CONFIG_QNX4FS_FS is not set
CONFIG_ROMFS_FS=m
CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UDF_FS is not set
# CONFIG_UFS_FS is not set
# CONFIG_XFS_FS is not set
#
# Network File Systems
#
# CONFIG_CODA_FS is not set
# CONFIG_INTERMEZZO_FS is not set
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
# CONFIG_NFS_V4 is not set
CONFIG_NFSD=y
CONFIG_NFSD_V3=y
# CONFIG_NFSD_V4 is not set
# CONFIG_NFSD_TCP is not set
CONFIG_SUNRPC=y
# CONFIG_SUNRPC_GSS is not set
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=y
# CONFIG_CIFS is not set
# CONFIG_SMB_FS is not set
# CONFIG_NCP_FS is not set
# CONFIG_AFS_FS is not set
CONFIG_FS_MBCACHE=y
#
# Partition Types
#
# CONFIG_PARTITION_ADVANCED is not set
CONFIG_MSDOS_PARTITION=y
#
# Security options
#
# CONFIG_SECURITY is not set
#
# Cryptographic options
#
# CONFIG_CRYPTO is not set
#
# Library routines
#
# CONFIG_CRC32 is not set
#
# SCSI support
#
# CONFIG_SCSI is not set
#
# Input device support
#
CONFIG_INPUT=y
#
# Userland interfaces
#
# CONFIG_INPUT_MOUSEDEV is not set
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_TSDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_INPUT_EVBUG is not set
#
# Input I/O drivers
#
# CONFIG_GAMEPORT is not set
CONFIG_SOUND_GAMEPORT=y
# CONFIG_SERIO is not set
#
# Input Device Drivers
#
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
# CONFIG_INPUT_MISC is not set
#
# Character devices
#
# CONFIG_VT is not set
# CONFIG_SERIAL_NONSTANDARD is not set
#
# Serial drivers
#
# CONFIG_SERIAL_8250 is not set
#
# Non-8250 serial port support
#
#
# I2C support
#
# CONFIG_I2C is not set
#
# I2C Hardware Sensors Mainboard support
#
#
# I2C Hardware Sensors Chip support
#
#
# Mice
#
# CONFIG_BUSMOUSE is not set
# CONFIG_QIC02_TAPE is not set
#
# IPMI
#
# CONFIG_IPMI_HANDLER is not set
#
# Watchdog Cards
#
# CONFIG_NVRAM is not set
# CONFIG_RTC is not set
# CONFIG_GEN_RTC is not set
# CONFIG_DTLK is not set
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
#
# Ftape, the floppy tape device driver
#
# CONFIG_FTAPE is not set
# CONFIG_AGP is not set
CONFIG_DRM=y
# CONFIG_DRM_TDFX is not set
CONFIG_DRM_R128=y
#
# PCMCIA character devices
#
# CONFIG_RAW_DRIVER is not set
#
# Graphics support
#
CONFIG_FB=y
# CONFIG_FB_CLGEN is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_IMSTT is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_MATROX is not set
# CONFIG_FB_RADEON is not set
CONFIG_FB_ATY128=y
# CONFIG_FB_ATY is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_VIRTUAL is not set
#
# Console display driver support
#
# CONFIG_VGA_CONSOLE is not set
# CONFIG_MDA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE is not set
#
# Multi-device support (RAID and LVM)
#
# CONFIG_MD is not set
#
# Memory Technology Devices (MTD)
#
# CONFIG_MTD is not set
#
# Kernel hacking
#
CONFIG_DEBUG_SLAB=y
# CONFIG_DEBUG_SPINLOCK is not set
CONFIG_DEBUGSYM=y
CONFIG_FRAME_POINTER=y
CONFIG_PT_PROXY=y
# CONFIG_GPROF is not set
# CONFIG_GCOV is not set
[-- Attachment #3: patch --]
[-- Type: application/octet-stream, Size: 31000 bytes --]
diff -Nru a/arch/um/Kconfig b/arch/um/Kconfig
--- a/arch/um/Kconfig Tue Jan 14 20:13:15 2003
+++ b/arch/um/Kconfig Tue Jan 14 20:13:15 2003
@@ -237,32 +237,6 @@
endmenu
-menu "Virtual PCI Bus"
-config PCI
- bool "Virtual PCI Bus"
- depends on MODULES && EXPERIMENTAL
- default n
- help
- Creates a virtual PCI bus inside of UML. Allows direct access to
- physical devices located in the host if the host has not loaded
- drivers for the device.
-
- For more information, see
- <http://user-mode-linux.sourceforge.net/xxxxx.html>.
-
- If unsure, say N.
-
-source "drivers/pci/Kconfig"
-
-config HOTPLUG
- bool
- depends on PCI
- default PCI
-
-endmenu
-
-source "drivers/usb/Kconfig"
-
source "arch/um/Kconfig_char"
source "arch/um/Kconfig_block"
@@ -297,10 +271,6 @@
source "arch/um/Kconfig_scsi"
endmenu
-
-source "drivers/input/Kconfig"
-source "drivers/char/Kconfig"
-source "drivers/video/Kconfig"
source "drivers/md/Kconfig"
diff -Nru a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
--- a/arch/um/drivers/Makefile Tue Jan 14 20:13:15 2003
+++ b/arch/um/drivers/Makefile Tue Jan 14 20:13:15 2003
@@ -41,7 +41,6 @@
obj-$(CONFIG_TTY_CHAN) += tty.o
obj-$(CONFIG_XTERM_CHAN) += xterm.o xterm_kern.o
obj-$(CONFIG_UML_WATCHDOG) += harddog.o
-obj-$(CONFIG_PCI) += vpci_kern.o
obj-y += stdio_console.o $(CHAN_OBJS)
diff -Nru a/arch/um/drivers/vpci_kern.c b/arch/um/drivers/vpci_kern.c
--- a/arch/um/drivers/vpci_kern.c Tue Jan 14 20:13:15 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,166 +0,0 @@
-/*
- * arch/um/drivers/vpci_kern.c
- *
- * Provide a virtual PCI bus environment in UML
- *
- * (C) Copyright 2002 Jon Smirl (jonsmirl@yahoo.com)
- * Licensed under the GPL
- */
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <asm/io.h>
-#include "mem_user.h"
-#include "ioremap.h"
-#include "os.h"
-
-
-void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int flag)
-{
- return NULL;
-}
-
-void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle)
-{
-}
-
-void pcibios_set_master(struct pci_dev *dev)
-{
-}
-
-int pcibios_enable_device(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int ioctl, idx;
- struct resource *r;
- char buf[30];
-
- snprintf(buf, sizeof(buf), "/proc/bus/pci/%02x/%02x.%01x", dev->bus->number, dev->devfn >> 3, dev->devfn & 7);
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) {
-
- r = &dev->resource[idx];
- if (r->start == r->end)
- continue;
-
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", dev->slot_name);
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO) {
- cmd |= PCI_COMMAND_IO;
- ioctl = PCIIOC_MMAP_IS_IO;
- } else if (r->flags & IORESOURCE_MEM) {
- cmd |= PCI_COMMAND_MEMORY;
- ioctl = PCIIOC_MMAP_IS_MEM;
- } else
- continue;
-
- register_physical(buf, ioctl, r->start, r->end - r->start + 1);
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n", dev->slot_name, old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- // FIXME - support interrupts
- return 0;
-}
-
-void pcibios_align_resource(void *data, struct resource *res, unsigned long size, unsigned long align)
-{
-}
-
-// Something (probably a ROM) was assigned an address, need to update the hardware and let UML know about it
-void pcibios_update_resource(struct pci_dev *dev, struct resource *root, struct resource *res, int resource)
-{
- char buf[30];
- u32 new, check;
- int ioctl = 0;
- int reg;
-
- new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
- if (resource < PCI_ROM_RESOURCE) {
- reg = PCI_BASE_ADDRESS_0 + 4 * resource;
- } else if (resource == PCI_ROM_RESOURCE) {
- res->flags |= PCI_ROM_ADDRESS_ENABLE;
- new |= PCI_ROM_ADDRESS_ENABLE;
- reg = dev->rom_base_reg;
- } else
- return; // Somebody might have asked allocation of a non-standard resource
-
- pci_write_config_dword(dev, reg, new);
- pci_read_config_dword(dev, reg, &check);
- if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
- printk(KERN_ERR "pcibios_update_resource: Error while updating region "
- "%s/%d (%08x != %08x)\n", dev->slot_name, resource, new, check);
- }
-
- snprintf(buf, sizeof(buf), "/proc/bus/pci/%02x/%02x.%01x", dev->bus->number, dev->devfn >> 3, dev->devfn & 7);
- if (res->flags & IORESOURCE_IO)
- ioctl = PCIIOC_MMAP_IS_IO;
- if (res->flags & IORESOURCE_MEM)
- ioctl = PCIIOC_MMAP_IS_MEM;
- register_physical(buf, ioctl, res->start, res->end - res->start + 1);
-}
-
-/*
- * Called after each bus is probed, but before its children
- * are examined.
- */
-void pcibios_fixup_bus(struct pci_bus *b)
-{
- pci_read_bridge_bases(b);
-}
-
-char *pcibios_setup(char *str)
-{
- // This is where PCI= parameters from the kernel command line are parsed
- return NULL;
-}
-
-struct pci_fixup pcibios_fixups[] = {
- {0}
-};
-
-// For PCI or other memory-mapped resources
-unsigned long pci_mem_start = 0x10000000;
-
-/*
- * Build entries for the physical devices on the virtual bus
- * Eventually this will take a boot parameter to tell what
- * devices to export.
- */
-int vpci_init(void)
-{
-#ifdef CONFIG_X86
- // enable access to physcial addresses between 0xC0000 and 0x100000
- // Expansion ROMs and the system BIOS ROM live at these addresses.
- // This mapping is required for many device drivers to function.
- register_physical("/proc/bus/pci/00/00.0", PCIIOC_MMAP_IS_MEM, 0xC0000, 0x100000);
-#endif
-
- // The PCI layer needs to know where to start searching search
- // for a safe place to map disabled devices into. The kernel starts
- // mapping these right after the end of physical RAM. UML should
- // too. Note that if the host has already mapped stuff into this
- // area it will be reflected when UML builds it data for exisiting
- // device. The search code will then skip over it. To tell how
- // much physical RAM is in the host stat /proc/kcore.
- // Note this is host memory size -- not UML
- long long low_mem_size;
- os_file_size("/proc/kcore", &low_mem_size);
-
- // Tell the PCI layer not to allocate too close to the RAM area..
- low_mem_size = (low_mem_size + 0xfffff) & ~0xfffff;
- if (low_mem_size > pci_mem_start)
- pci_mem_start = low_mem_size;
-
- printk("PCI: Mapping PCI hardware to virtual PCI bus\n");
- return pci_do_scan_bus(pci_alloc_primary_bus(0));
-}
-
-__initcall(vpci_init);
-EXPORT_SYMBOL(pci_mem_start);
diff -Nru a/arch/um/include/ioremap.h b/arch/um/include/ioremap.h
--- a/arch/um/include/ioremap.h Tue Jan 14 20:13:15 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,29 +0,0 @@
-/*
- * arch/um/include/ioremap.h
- *
- * Re-map IO memory to user and kernel address space so that we can access it.
- *
- * (C) Copyright 2002 Jon Smirl (jonsmirl@yahoo.com)
- */
-
-#ifndef _IOREMAP_H
-#define _IOREMAP_H
-
-#ifndef MAP_FAILED
-#define MAP_FAILED (void*)-1
-#endif
-
-struct phys_region {
- unsigned long paddr; // physical address of region
- unsigned long length; // length of physical region
- void *vaddr; // address of mapped region so that iounmap can find it later
- unsigned long vlength; // length of region for iounmap
- int ioctl; // ioctl to use on file to tell mem type
- char file_name; // variable length file_name
-};
-extern struct phys_region *physical_region(unsigned long physical);
-extern void register_physical(char * file_name, int ioctl, unsigned long physical, unsigned long length);
-extern void *map_physical(void *vaddr, unsigned long phys, unsigned long length, int r, int w, int x);
-extern int unmap_physical(void * vaddr);
-
-#endif // _IOREMAP_H
diff -Nru a/arch/um/include/os.h b/arch/um/include/os.h
--- a/arch/um/include/os.h Tue Jan 14 20:13:15 2003
+++ b/arch/um/include/os.h Tue Jan 14 20:13:15 2003
@@ -85,7 +85,6 @@
extern int os_seek_file(int fd, __u64 offset);
extern int os_open_file(char *file, struct openflags flags, int mode);
-extern int os_ioctl(int fd, int value);
extern int os_read_file(int fd, char *buf, int len);
extern int os_file_size(char *file, long long *size_out);
extern int os_pipe(int *fd, int stream, int close_on_exec);
@@ -107,10 +106,9 @@
extern void os_kill_process(int pid, int reap_child);
extern void os_usr1_process(int pid);
extern int os_getpid(void);
-extern int os_ioperm(unsigned long from, unsigned long num, int turn_on);
-extern void *os_map_memory(void* virt, int fd, unsigned long offset,
- unsigned long length, int r, int w, int x);
+extern int os_map_memory(void *virt, int fd, unsigned long off,
+ unsigned long len, int r, int w, int x);
extern int os_protect_memory(void *addr, unsigned long len,
int r, int w, int x);
extern int os_unmap_memory(void *addr, int len);
diff -Nru a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
--- a/arch/um/kernel/Makefile Tue Jan 14 20:13:15 2003
+++ b/arch/um/kernel/Makefile Tue Jan 14 20:13:15 2003
@@ -9,7 +9,7 @@
sigio_kern.o signal_kern.o signal_user.o smp.o syscall_kern.o \
syscall_user.o sysrq.o sys_call_table.o tempfile.o time.o \
time_kern.o tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o \
- umid.o user_syms.o user_util.o extable.o ioremap.o
+ umid.o user_syms.o user_util.o extable.o
obj-$(CONFIG_BLK_DEV_INITRD) += initrd_kern.o initrd_user.o
obj-$(CONFIG_GPROF) += gprof_syms.o
diff -Nru a/arch/um/kernel/ioremap.c b/arch/um/kernel/ioremap.c
--- a/arch/um/kernel/ioremap.c Tue Jan 14 20:13:15 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,196 +0,0 @@
-/*
- * arch/um/kernel/ioremap_kern.c
- *
- * Re-map IO memory to user and kernel address space so that we can access it.
- *
- * (C) Copyright 2002 Jon Smirl (jonsmirl@yahoo.com)
- */
-
-#include <asm/pgalloc.h>
-#include <linux/mm.h>
-#include "mem_user.h"
-#include "ioremap.h"
-#include "os.h"
-
-/*
- * Remap an arbitrary physical address space into the kernel virtual
- * address space. Needed when the kernel wants to access high addresses
- * directly.
- *
- * NOTE! We need to allow non-page-aligned mappings too: we will obviously
- * have to convert them into an offset in a page-aligned mapping, but the
- * caller shouldn't need to know that small detail.
- */
-void *__ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
-{
- void *addr;
-
- addr = map_physical(NULL, phys_addr, size, 1, 1, 0);
- if (addr == MAP_FAILED) // ioremap has different error return
- return NULL;
-
- return addr;
-}
-
-void *ioremap_nocache (unsigned long phys_addr, unsigned long size)
-{
- // FIXME - Are these pages really nocache or does more need to be done?
- //return __ioremap(phys_addr, size, _PAGE_PCD);
- return __ioremap(phys_addr, size, 0);
-}
-
-/*
- * Remap an arbitrary physical address space into the user virtual
- * address space. Needed when a user task wants to access high addresses
- * directly.
- */
-int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long physical, unsigned long size, pgprot_t prot)
-{
- void *addr;
-
- addr = map_physical((void*)vma->vm_start, physical, size, 1, 1, 0);
- if (addr == MAP_FAILED) // ioremap has different error return
- return EFAULT;
-
- return 0;
-}
-
-void iounmap(void *addr)
-{
- unmap_physical(addr);
-}
-
-
-
-asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
-{
- return os_ioperm(from, num, turn_on);
-}
-
-#define GPHYSICAL 40 // number of pointers to grow the array by
-unsigned int nphysical = 0; // number of physical regions allocated
-unsigned int cphysical = 0; // number of physcial regions available
-struct phys_region **pregions = 0; // pointer to arrary of regions
-
-struct phys_region *physical_region(unsigned long physical)
-{
- int i;
- struct phys_region **r = pregions;
- for(i = 0; i < nphysical; i++, r++)
- if ((*r != NULL) && (physical >= (*r)->paddr) && (physical < (*r)->paddr + (*r)->length))
- return *r;
- return NULL;
-}
-
-
-/* allocate a slot in the array of physical regions */
-struct phys_region **allocate_physical(void) {
- int i;
- struct phys_region **pr = pregions;
-
- // Check for a reusable slot
- for (i = 0; i < nphysical; i++, pr++) {
- if (*pr == NULL)
- return pr;
- }
- // Allocate one if room in existing array
- if (nphysical < cphysical)
- return &pregions[nphysical++];
-
- // no room in array, need to grow it
- pr = pregions;
- unsigned int c = sizeof(*pr) * (cphysical + GPHYSICAL); // New array size
- pregions = kmalloc(c, GFP_KERNEL);
- memset(pregions, 0, c); //start the pointer out null
- if (pr) {
- memcpy(pregions, pr, sizeof(*pr) * cphysical); // copy old array
- kfree(pr);
- }
- cphysical += GPHYSICAL;
-
- return &pregions[nphysical++];
-}
-
-// register a valid physical address range and provide a handle for mapping it
-void register_physical(char * file_name, int ioctl, unsigned long physical, unsigned long length)
-{
- struct phys_region **pr;
- struct phys_region *r;
-
- if ((r = physical_region(physical))) { // don't build it twice
- printk("register_physcial - registering %lx twice, resource conflict??\n", physical);
- return;
- }
- if (!file_name) {
- printk("register_physcial - file_name can't be NULL");
- return;
- }
- if (!length) {
- printk("register_physcial - length can't be zero");
- return;
- }
-
- pr = allocate_physical();
- r = *pr = kmalloc(sizeof(**pr) + strlen(file_name), GFP_KERNEL);
-
- r->paddr = physical;
- r->length = length;
- r->ioctl = ioctl;
- r->vaddr = 0; // indicate no existing mapping
- strcpy(&r->file_name, file_name);
-}
-
-void *map_physical(void *vaddr, unsigned long physical, unsigned long length, int r, int w, int x)
-{
- int fd;
- struct phys_region *reg;
- unsigned long offset, last_addr;
-
- // Don't allow wraparound or zero size
- last_addr = physical + length - 1;
- if (!length || last_addr < physical)
- return MAP_FAILED;
-
- // Mappings have to be page-aligned
- offset = physical & ~PAGE_MASK;
- physical &= PAGE_MASK;
- length = PAGE_ALIGN(last_addr) - physical;
-
- if (vaddr == NULL)
- vaddr = (void *)get_vm(length + offset);
-
- if (!(reg = physical_region(physical))) {
- printk("map_physical : Attempt to map unregistered physical address %lx length %lx\n", physical, length);
- return MAP_FAILED;
- }
- if (physical + length > reg->paddr + reg->length) {
- printk("map_physical : Requested length %lx is longer than registered region %lx\n", length, reg->paddr);
- return MAP_FAILED;
- }
- fd = os_open_file(®->file_name, of_rdwr(OPENFLAGS()), 0);
- if (!fd) {
- printk("map_physical : Mapped file, %s, could not be opened", ®->file_name);
- return MAP_FAILED;
- }
-// if (reg->vaddr)
-// panic("map_physical : fix me to handle multiple mappings\n");
- if (reg->ioctl)
- os_ioctl(fd, reg->ioctl);
- reg->vlength = length;
- reg->vaddr = os_map_memory(vaddr, fd, physical, length, r, w, x);
- os_close_file(fd); // mmap persists after close
-
- return (void *)(offset + (char *) reg->vaddr);
-}
-
-int unmap_physical(void *vaddr)
-{
- int i;
- for(i = 0; i < nphysical; i++)
- if (pregions[i] && (pregions[i]->vaddr == vaddr)) {
- pregions[i]->vaddr = NULL;
- return os_unmap_memory(vaddr, pregions[i]->vlength);
- }
- printk("ioremap : Attempt to unmap virtual address %p that is not currently mapped/n", vaddr);
- return -1;
-}
diff -Nru a/arch/um/kernel/mem_user.c b/arch/um/kernel/mem_user.c
--- a/arch/um/kernel/mem_user.c Tue Jan 14 20:13:15 2003
+++ b/arch/um/kernel/mem_user.c Tue Jan 14 20:13:15 2003
@@ -185,13 +185,9 @@
int r, int w, int x)
{
struct mem_region *region = phys_region(phys);
-
- void * err;
- err = os_map_memory((void *) virt, region->fd, phys_offset(phys), len,
- r, w, x);
- if (err == (void*)-1)
- return -errno;
- return 0;
+
+ return(os_map_memory((void *) virt, region->fd, phys_offset(phys), len,
+ r, w, x));
}
int protect_memory(unsigned long addr, unsigned long len, int r, int w, int x,
diff -Nru a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
--- a/arch/um/os-Linux/file.c Tue Jan 14 20:13:15 2003
+++ b/arch/um/os-Linux/file.c Tue Jan 14 20:13:15 2003
@@ -67,11 +67,6 @@
return(fd);
}
-int os_ioctl(int fd, int value)
-{
- return ioctl(fd, value);
-}
-
int os_connect_socket(char *name)
{
struct sockaddr_un sock;
diff -Nru a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
--- a/arch/um/os-Linux/process.c Tue Jan 14 20:13:15 2003
+++ b/arch/um/os-Linux/process.c Tue Jan 14 20:13:15 2003
@@ -9,7 +9,6 @@
#include <signal.h>
#include <sys/mman.h>
#include <sys/wait.h>
-#include <sys/io.h>
#include "os.h"
#include "user.h"
@@ -96,7 +95,7 @@
return(getpid());
}
-void *os_map_memory(void *virt, int fd, unsigned long off, unsigned long len,
+int os_map_memory(void *virt, int fd, unsigned long off, unsigned long len,
int r, int w, int x)
{
void *loc;
@@ -105,10 +104,11 @@
prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
(x ? PROT_EXEC : 0);
- loc = mmap(virt, len, prot, MAP_SHARED | MAP_FIXED, fd, off);
- if(loc == MAP_FAILED)
- printk("os_map_memory_nofix failed. errno %d\n", errno);
- return loc;
+ loc = mmap((void *) virt, len, prot, MAP_SHARED | MAP_FIXED,
+ fd, off);
+ if(loc < 0)
+ return(-errno);
+ return(0);
}
int os_protect_memory(void *addr, unsigned long len, int r, int w, int x)
@@ -129,12 +129,6 @@
if(err < 0) return(-errno);
return(0);
}
-
-int os_ioperm(unsigned long from, unsigned long num, int turn_on)
-{
- return ioperm(from, num, turn_on);
-}
-
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
diff -Nru a/drivers/pci/access.c b/drivers/pci/access.c
--- a/drivers/pci/access.c Tue Jan 14 20:13:15 2003
+++ b/drivers/pci/access.c Tue Jan 14 20:13:15 2003
@@ -1,9 +1,6 @@
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/ioport.h>
-#ifdef CONFIG_USERMODE
-#include "os.h"
-#endif
/*
* This interrupt-safe spinlock protects all accesses to PCI
@@ -22,7 +19,6 @@
#define PCI_word_BAD (pos & 1)
#define PCI_dword_BAD (pos & 3)
-#ifndef CONFIG_USERMODE
#define PCI_OP_READ(size,type,len) \
int pci_bus_read_config_##size \
(struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
@@ -50,49 +46,6 @@
spin_unlock_irqrestore(&pci_lock, flags); \
return res; \
}
-#else
-#define PCI_OP_READ(size,type,len) \
-int pci_bus_read_config_##size \
- (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
-{ \
- int fd, result; \
- char buf[30]; \
- u32 data; \
- \
- if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
- snprintf(buf, sizeof(buf), "/proc/bus/pci/%02x/%02x.%01x", \
- bus->number, devfn>>3, devfn&7); \
- fd = os_open_file(buf, of_read(OPENFLAGS()), 0); \
- if (fd < 0) return fd; \
- result = os_seek_file(fd, pos); \
- if (result < 0) return result; \
- result = os_read_file(fd, (char *)&data, sizeof(data)); \
- if (result < 0) return result; \
- os_close_file(fd); \
- *value = (type)data; \
- return 0; \
-}
-
-#define PCI_OP_WRITE(size,type,len) \
-int pci_bus_write_config_##size \
- (struct pci_bus *bus, unsigned int devfn, int pos, type value) \
-{ \
- int fd, result; \
- char buf[30]; \
- \
- if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
- snprintf(buf, sizeof(buf), "/proc/bus/pci/%02x/%02x.%01x", \
- bus->number, devfn>>3, devfn&7); \
- fd = os_open_file(buf, of_rdwr(OPENFLAGS()), 0); \
- if (fd < 0) return fd; \
- result = os_seek_file(fd, pos); \
- if (result < 0) return result; \
- result = os_write_file(fd, (char *)&value, sizeof(value)); \
- if (result < 0) return result; \
- os_close_file(fd); \
- return 0; \
-}
-#endif
PCI_OP_READ(byte, u8, 1)
PCI_OP_READ(word, u16, 2)
diff -Nru a/drivers/video/aty128fb.c b/drivers/video/aty128fb.c
--- a/drivers/video/aty128fb.c Tue Jan 14 20:13:15 2003
+++ b/drivers/video/aty128fb.c Tue Jan 14 20:13:15 2003
@@ -7,7 +7,7 @@
* Ani Joshi / Jeff Garzik
* - Code cleanup
*
- * Michel Danzer <michdaen@iiic.ethz.ch>
+ * Michel Dänzer <michdaen@iiic.ethz.ch>
* - 15/16 bit cleanup
* - fix panning
*
@@ -157,8 +157,6 @@
PCI_ANY_ID, PCI_ANY_ID, 0, 0, rage_128 },
{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RAGE128_RL,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, rage_128 },
- { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_Rage128_PD,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, rage_128_pro },
{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RAGE128_PF,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, rage_128_pro },
{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RAGE128_PR,
@@ -369,9 +367,8 @@
struct aty128fb_par *par);
#if !defined(CONFIG_PPC) && !defined(__sparc__)
static void __init aty128_get_pllinfo(struct aty128fb_par *par,
- void *bios);
-static void __init *aty128_map_ROM(struct pci_dev *pdev);
-static void __init aty128_unmap_ROM(struct pci_dev *dev, void * rom);
+ char *bios_seg);
+static char __init *aty128find_ROM(void);
#endif
static void aty128_timings(struct aty128fb_par *par);
static void aty128_init_engine(struct aty128fb_par *par);
@@ -1418,16 +1415,13 @@
#ifdef CONFIG_PMAC_PBOOK
if (!strncmp(this_opt, "lcd:", 4)) {
default_lcd_on = simple_strtoul(this_opt+4, NULL, 0);
- continue;
} else if (!strncmp(this_opt, "crt:", 4)) {
default_crt_on = simple_strtoul(this_opt+4, NULL, 0);
- continue;
}
#endif
#ifdef CONFIG_MTRR
if(!strncmp(this_opt, "nomtrr", 6)) {
mtrr = 0;
- continue;
}
#endif
#ifdef CONFIG_ALL_PPC
@@ -1436,7 +1430,6 @@
unsigned int vmode = simple_strtoul(this_opt+6, NULL, 0);
if (vmode > 0 && vmode <= VMODE_MAX)
default_vmode = vmode;
- continue;
} else if (!strncmp(this_opt, "cmode:", 6)) {
unsigned int cmode = simple_strtoul(this_opt+6, NULL, 0);
switch (cmode) {
@@ -1453,10 +1446,10 @@
default_cmode = CMODE_32;
break;
}
- continue;
}
#endif /* CONFIG_ALL_PPC */
- mode_option = this_opt;
+ else
+ mode_option = this_opt;
}
return 0;
}
@@ -1495,9 +1488,6 @@
case PCI_DEVICE_ID_ATI_RAGE128_RL:
strcpy(video_card, "Rage128 RL (AGP)");
break;
- case PCI_DEVICE_ID_ATI_Rage128_PD:
- strcpy(video_card, "Rage128 Pro PD (PCI)");
- break;
case PCI_DEVICE_ID_ATI_RAGE128_PF:
strcpy(video_card, "Rage128 Pro PF (AGP)");
break;
@@ -1646,7 +1636,7 @@
struct fb_info *info;
int err, size;
#if !defined(CONFIG_PPC) && !defined(__sparc__)
- void *bios = NULL;
+ char *bios_seg = NULL;
#endif
/* Enable device in PCI config */
@@ -1661,21 +1651,21 @@
"aty128fb FB")) {
printk(KERN_ERR "aty128fb: cannot reserve frame "
"buffer memory\n");
- return -ENODEV;
+ goto err_free_fb;
}
reg_addr = pci_resource_start(pdev, 2);
if (!request_mem_region(reg_addr, pci_resource_len(pdev, 2),
"aty128fb MMIO")) {
printk(KERN_ERR "aty128fb: cannot reserve MMIO region\n");
- goto err_free_fb;
+ goto err_free_mmio;
}
/* We have the resources. Now virtualize them */
size = sizeof(struct fb_info) + sizeof(struct aty128fb_par);
if (!(info = kmalloc(size, GFP_ATOMIC))) {
printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n");
- goto err_free_mmio;
+ goto err_unmap_out;
}
memset(info, 0, size);
@@ -1687,18 +1677,19 @@
/* Virtualize mmio region */
info->fix.mmio_start = reg_addr;
- par->regbase = ioremap(reg_addr, pci_resource_len(pdev, 2));
+ par->regbase = ioremap(reg_addr, 0x2000);
if (!par->regbase)
goto err_free_info;
/* Grab memory size from the card */
- // How does this relate to the resource length from the PCI hardware?
par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
/* Virtualize the framebuffer */
info->screen_base = ioremap(fb_addr, par->vram_size);
- if (!info->screen_base)
- goto err_unmap_out;
+ if (!info->screen_base) {
+ iounmap(par->regbase);
+ goto err_free_info;
+ }
/* Set up info->fix */
info->fix = aty128fb_fix;
@@ -1713,13 +1704,13 @@
}
#if !defined(CONFIG_PPC) && !defined(__sparc__)
- if (!(bios = aty128_map_ROM(pdev)))
- printk(KERN_INFO "aty128fb: BIOS not located, guessing timings.\n");
+ if (!(bios_seg = aty128find_ROM()))
+ printk(KERN_INFO "aty128fb: Rage128 BIOS not located. "
+ "Guessing...\n");
else {
- printk(KERN_INFO "aty128fb: Rage128 BIOS located at %lx\n",
- pdev->resource[PCI_ROM_RESOURCE].start);
- aty128_get_pllinfo(par, bios);
- aty128_unmap_ROM(pdev, bios);
+ printk(KERN_INFO "aty128fb: Rage128 BIOS located at "
+ "segment %4.4X\n", (unsigned int)bios_seg);
+ aty128_get_pllinfo(par, bios_seg);
}
#endif
aty128_timings(par);
@@ -1741,16 +1732,18 @@
err_out:
iounmap(info->screen_base);
-err_unmap_out:
iounmap(par->regbase);
err_free_info:
kfree(info);
-err_free_mmio:
+err_unmap_out:
release_mem_region(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2));
-err_free_fb:
+err_free_mmio:
release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
+err_free_fb:
+ release_mem_region(pci_resource_start(pdev, 1),
+ pci_resource_len(pdev, 1));
return -ENODEV;
}
@@ -1787,65 +1780,86 @@
/* PPC and Sparc cannot read video ROM */
#if !defined(CONFIG_PPC) && !defined(__sparc__)
-static void * __init aty128_map_ROM(struct pci_dev *dev)
+static char * __init aty128find_ROM(void)
{
- // If this is a primary card, there is a shadow copy of the
- // ROM somewhere in the first meg. We will just ignore the copy
- // and use the ROM directly.
-
- // no need to search for the ROM, just ask the card where it is.
- struct resource *r = &dev->resource[PCI_ROM_RESOURCE];
-
- // assign the ROM an address if it doesn't have one
- if (r->start == 0)
- pci_assign_resource(dev, PCI_ROM_RESOURCE);
-
- // enable if needed
- if (!(r->flags & PCI_ROM_ADDRESS_ENABLE))
- pci_write_config_dword(dev, dev->rom_base_reg, r->start | PCI_ROM_ADDRESS_ENABLE);
-
- unsigned char *addr = ioremap(r->start, r->end - r->start + 1);
-
- // Very simple test to make sure it appeared
- if (addr && (*addr != 0x55)) {
- printk("aty128fb: Invalid ROM signature %x\n", *addr);
- iounmap(addr);
- return NULL;
+ u32 segstart;
+ char *rom_base;
+ char *rom;
+ int stage;
+ int i, j;
+ char aty_rom_sig[] = "761295520"; /* ATI ROM Signature */
+ char *R128_sig[] = {
+ "R128", /* Rage128 ROM identifier */
+ "128b"
+ };
+
+ for (segstart=0x000c0000; segstart<0x000f0000; segstart+=0x00001000) {
+ stage = 1;
+
+ rom_base = (char *)ioremap(segstart, 0x1000);
+
+ if ((*rom_base == 0x55) && (((*(rom_base + 1)) & 0xff) == 0xaa))
+ stage = 2;
+
+ if (stage != 2) {
+ iounmap(rom_base);
+ continue;
+ }
+ rom = rom_base;
+
+ for (i = 0; (i < 128 - strlen(aty_rom_sig)) && (stage != 3); i++) {
+ if (aty_rom_sig[0] == *rom)
+ if (strncmp(aty_rom_sig, rom,
+ strlen(aty_rom_sig)) == 0)
+ stage = 3;
+ rom++;
+ }
+ if (stage != 3) {
+ iounmap(rom_base);
+ continue;
+ }
+ rom = rom_base;
+
+ /* ATI signature found. Let's see if it's a Rage128 */
+ for (i = 0; (i < 512) && (stage != 4); i++) {
+ for (j = 0; j < sizeof(R128_sig)/sizeof(char *);j++) {
+ if (R128_sig[j][0] == *rom)
+ if (strncmp(R128_sig[j], rom,
+ strlen(R128_sig[j])) == 0) {
+ stage = 4;
+ break;
+ }
+ }
+ rom++;
+ }
+ if (stage != 4) {
+ iounmap(rom_base);
+ continue;
+ }
+ return rom_base;
}
- return (void *)addr;
+ return NULL;
}
-static void __init aty128_unmap_ROM(struct pci_dev *dev, void * rom)
-{
- iounmap(rom);
-
- // leave it disabled and unassigned
- struct resource *r = &dev->resource[PCI_ROM_RESOURCE];
- r->flags &= !PCI_ROM_ADDRESS_ENABLE;
- r->end -= r->start;
- r->start = 0;
- pci_write_config_dword(dev, dev->rom_base_reg, 0);
-
-}
static void __init
-aty128_get_pllinfo(struct aty128fb_par *par, void *bios)
+aty128_get_pllinfo(struct aty128fb_par *par, char *bios_seg)
{
void *bios_header;
void *header_ptr;
u16 bios_header_offset, pll_info_offset;
PLL_BLOCK pll;
- bios_header = (char *)bios + 0x48L;
+ bios_header = bios_seg + 0x48L;
header_ptr = bios_header;
bios_header_offset = readw(header_ptr);
- bios_header = (char *)bios + bios_header_offset;
+ bios_header = bios_seg + bios_header_offset;
bios_header += 0x30;
header_ptr = bios_header;
pll_info_offset = readw(header_ptr);
- header_ptr = (char *)bios + pll_info_offset;
+ header_ptr = bios_seg + pll_info_offset;
memcpy_fromio(&pll, header_ptr, 50);
diff -Nru a/include/asm-um/dma-mapping.h b/include/asm-um/dma-mapping.h
--- a/include/asm-um/dma-mapping.h Tue Jan 14 20:13:15 2003
+++ b/include/asm-um/dma-mapping.h Tue Jan 14 20:13:15 2003
@@ -1 +1 @@
-#include <asm/arch/dma-mapping.h>
+#include <asm-generic/dma-mapping.h>
diff -Nru a/include/asm-um/io.h b/include/asm-um/io.h
--- a/include/asm-um/io.h Tue Jan 14 20:13:15 2003
+++ b/include/asm-um/io.h Tue Jan 14 20:13:15 2003
@@ -1,7 +1,25 @@
#ifndef __UM_IO_H
#define __UM_IO_H
-#include "asm/arch/io.h"
-#undef page_to_phys
+#include "asm/page.h"
+
+#define IO_SPACE_LIMIT 0xdeadbeef /* Sure hope nothing uses this */
+
+static inline int inb(unsigned long i) { return(0); }
+static inline void outb(char c, unsigned long i) { }
+
+/*
+ * Change virtual addresses to physical addresses and vv.
+ * These are pretty trivial
+ */
+static inline unsigned long virt_to_phys(volatile void * address)
+{
+ return __pa((void *) address);
+}
+
+static inline void * phys_to_virt(unsigned long address)
+{
+ return __va(address);
+}
#endif
diff -Nru a/include/asm-um/pci.h b/include/asm-um/pci.h
--- a/include/asm-um/pci.h Tue Jan 14 20:13:15 2003
+++ b/include/asm-um/pci.h Tue Jan 14 20:13:15 2003
@@ -1,16 +1,6 @@
#ifndef __UM_PCI_H
#define __UM_PCI_H
-#include "asm/arch/pci.h"
+#define PCI_DMA_BUS_IS_PHYS (1)
-#undef HAVE_PCI_MMAP
-
-#ifdef CONFIG_PCI
-extern int isa_dma_bridge_buggy;
-#else
-#define isa_dma_bridge_buggy (0)
-#endif
-
-#define pcibios_assign_all_busses() 0
-
#endif
diff -Nru a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
--- a/include/asm-um/pgtable.h Tue Jan 14 20:13:15 2003
+++ b/include/asm-um/pgtable.h Tue Jan 14 20:13:15 2003
@@ -416,8 +416,6 @@
#endif
-extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long physical, unsigned long size, pgprot_t prot);
-
#endif
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-15 1:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-15 0:31 Using UML to work on framebuffers Jon Smirl
2003-01-15 0:35 ` James Simmons
2003-01-15 1:19 ` Jon Smirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).