Commit 12e35fae authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.54

parent 6696fcb6
This diff is collapsed.
......@@ -47,7 +47,7 @@ foo \kill}%
%
\title{{\bf Linux Allocated Devices}}
\author{Maintained by H. Peter Anvin $<$hpa@zytor.com$>$}
\date{Last revised: July 28, 1997}
\date{Last revised: September 5, 1997}
\maketitle
%
\noindent
......@@ -216,7 +216,9 @@ reply.
\major{85}{}{char }{Linux/SGI shared memory input queue}
\major{86}{}{char }{SCSI media changer}
\major{87}{}{char }{Sony Control-A1 stereo control bus}
\major{88}{--119}{}{Unallocated}
\major{88}{}{char }{COMX synchronous serial card}
\major{89}{}{char }{I$^2$C bus interface}
\major{90}{--119}{}{Unallocated}
\major{120}{--127}{}{Local/experimental use}
\major{128}{--239}{}{Unallocated}
\major{240}{--254}{}{Local/experimental use}
......@@ -525,6 +527,7 @@ physical disks.
\minor{148}{/dev/gfx}{Linux/SGI graphics effects device}
\minor{149}{/dev/input/mouse}{Linux/SGI Irix emulation mouse}
\minor{150}{/dev/input/keyboard}{Linux/SGI Irix emulation keyboard}
\minor{151}{/dev/led}{Front panel LEDs}
\end{devicelist}
\begin{devicelist}
......@@ -1417,8 +1420,8 @@ Currently for Dolphin Interconnect Solutions' PCI-SCI bridge.
\begin{devicelist}
\major{82}{}{char }{WiNRADiO communications receiver card}
\major{0}{/dev/winradio0}{First WiNRADiO card}
\major{1}{/dev/winradio1}{Second WiNRADiO card}
\minor{0}{/dev/winradio0}{First WiNRADiO card}
\minor{1}{/dev/winradio1}{Second WiNRADiO card}
\minordots
\end{devicelist}
......@@ -1465,7 +1468,21 @@ on {\url http://home.pages.de/~videotext/\/}.
\end{devicelist}
\begin{devicelist}
\major{88}{--119}{}{Unallocated}
\major{88}{}{char }{COMX synchronous serial card}
\minor{0}{/dev/comx0}{Channel 0}
\minor{1}{/dev/comx1}{Channel 1}
\minordots
\end{devicelist}
\begin{devicelist}
\major{89}{}{char }{I$^2$C bus interface}
\minor{0}{/dev/i2c0}{First I$^2$C adapter}
\minor{1}{/dev/i2c1}{Second I$^2$C adapter}
\minordots
\end{devicelist}
\begin{devicelist}
\major{90}{--119}{}{Unallocated}
\end{devicelist}
\begin{devicelist}
......
LINUX ALLOCATED DEVICES
Maintained by H. Peter Anvin <hpa@zytor.com>
Last revised: July 28, 1997
Last revised: September 5, 1997
This list is the successor to Rick Miller's Linux Device List, which
he stopped maintaining when he got busy with other things in 1993. It
......@@ -301,6 +301,7 @@ reply.
148 = /dev/gfx Linux/SGI graphics effects device
149 = /dev/input/mouse Linux/SGI Irix emulation mouse
150 = /dev/input/keyboard Linux/SGI Irix emulation keyboard
151 = /dev/led Front panel LEDs
11 char Raw keyboard device
0 = /dev/kbd Raw keyboard device
......@@ -1031,7 +1032,17 @@ reply.
1 = /dev/controla1 Second device on chain
...
88-119 UNALLOCATED
88 char COMX synchronous serial card
0 = /dev/comx0 COMX channel 0
1 = /dev/comx1 COMX channel 1
...
89 char I2C bus interface
0 = /dev/i2c0 First I2C adapter
1 = /dev/i2c1 Second I2C adapter
...
90-119 UNALLOCATED
120-127 LOCAL/EXPERIMENTAL USE
......
VERSION = 2
PATCHLEVEL = 1
SUBLEVEL = 53
SUBLEVEL = 54
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
......
......@@ -186,6 +186,7 @@ static void layout_dev(struct pci_dev *dev)
pcibios_read_config_dword(bus->number, dev->devfn, reg, &base);
if (!base) {
/* this base-address register is unused */
dev->base_address[(reg - PCI_BASE_ADDRESS_0)>>2] = 0;
continue;
}
......
......@@ -23,8 +23,10 @@ comment 'General setup'
bool 'Kernel math emulation' CONFIG_MATH_EMULATION
bool 'Networking support' CONFIG_NET
bool 'PCI bios support' CONFIG_PCI
bool 'PCI support' CONFIG_PCI
if [ "$CONFIG_PCI" = "y" ]; then
bool ' PCI BIOS support' CONFIG_PCI_BIOS
bool ' PCI direct access support' CONFIG_PCI_DIRECT
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool ' PCI bridge optimization (experimental)' CONFIG_PCI_OPTIMIZE
fi
......
......@@ -20,6 +20,8 @@ CONFIG_MODULES=y
# CONFIG_MATH_EMULATION is not set
CONFIG_NET=y
CONFIG_PCI=y
CONFIG_PCI_BIOS=y
# CONFIG_PCI_DIRECT is not set
# CONFIG_MCA is not set
CONFIG_SYSVIPC=y
CONFIG_SYSCTL=y
......@@ -139,7 +141,6 @@ CONFIG_SCSI_OMIT_FLASHPOINT=y
# CONFIG_SCSI_NCR53C406A is not set
# CONFIG_SCSI_NCR53C7xx is not set
# CONFIG_SCSI_NCR53C8XX is not set
# CONFIG_SCSI_PPA is not set
# CONFIG_SCSI_PAS16 is not set
# CONFIG_SCSI_QLOGIC_FAS is not set
# CONFIG_SCSI_QLOGIC_ISP is not set
......@@ -162,6 +163,7 @@ CONFIG_NET_ETHERNET=y
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_LANCE is not set
# CONFIG_NET_VENDOR_SMC is not set
# CONFIG_NET_VENDOR_RACAL is not set
# CONFIG_NET_ISA is not set
CONFIG_NET_EISA=y
# CONFIG_PCNET32 is not set
......@@ -174,7 +176,6 @@ CONFIG_EEXPRESS_PRO100=y
# CONFIG_NET_POCKET is not set
# CONFIG_FDDI is not set
# CONFIG_DLCI is not set
# CONFIG_PLIP is not set
# CONFIG_PPP is not set
# CONFIG_NET_RADIO is not set
# CONFIG_SLIP is not set
......@@ -239,6 +240,7 @@ CONFIG_82C710_MOUSE=y
# CONFIG_APM is not set
# CONFIG_WATCHDOG is not set
# CONFIG_RTC is not set
# CONFIG_H8 is not set
# CONFIG_NVRAM is not set
# CONFIG_JOYSTICK is not set
......
This diff is collapsed.
......@@ -42,8 +42,6 @@
extern volatile unsigned long smp_local_timer_ticks[1+NR_CPUS];
#endif
#define CR0_NE 32
unsigned int local_irq_count[NR_CPUS];
#ifdef __SMP__
atomic_t __intel_bh_counter;
......@@ -55,6 +53,8 @@ int __intel_bh_counter;
static unsigned int int_count[NR_CPUS][NR_IRQS] = {{0},};
#endif
atomic_t nmi_counter;
/*
* This contains the irq mask for both irq controllers
*/
......@@ -199,7 +199,6 @@ static void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
* be shot.
*/
static void math_error_irq(int cpl, void *dev_id, struct pt_regs *regs)
{
outb(0,0xF0);
......@@ -224,28 +223,26 @@ static struct irqaction *irq_action[16] = {
int get_irq_list(char *buf)
{
int i, len = 0;
int i;
struct irqaction * action;
char *p = buf;
for (i = 0 ; i < NR_IRQS ; i++) {
action = irq_action[i];
if (!action)
continue;
len += sprintf(buf+len, "%2d: %10u %s",
p += sprintf(p, "%3d: %10u %s",
i, kstat.interrupts[i], action->name);
for (action=action->next; action; action = action->next) {
len += sprintf(buf+len, ", %s", action->name);
p += sprintf(p, ", %s", action->name);
}
len += sprintf(buf+len, "\n");
*p++ = '\n';
}
/*
* Linus - should you add NMI counts here ?????
*/
p += sprintf(p, "NMI: %10u\n", atomic_read(&nmi_counter));
#ifdef __SMP_PROF__
len+=sprintf(buf+len, "IPI: %8lu received\n",
ipi_count);
p += sprintf(p, "IPI: %10lu\n", ipi_count);
#endif
return len;
return p - buf;
}
#ifdef __SMP_PROF__
......
......@@ -29,6 +29,7 @@
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/spinlock.h>
#include <asm/atomic.h>
asmlinkage int system_call(void);
asmlinkage void lcall7(void);
......@@ -271,7 +272,9 @@ static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
asmlinkage void do_nmi(struct pt_regs * regs, long error_code)
{
unsigned char reason = inb(0x61);
extern atomic_t nmi_counter;
atomic_inc(&nmi_counter);
if (reason & 0x80)
mem_parity_error(reason, regs);
if (reason & 0x40)
......@@ -348,7 +351,10 @@ asmlinkage void do_coprocessor_error(struct pt_regs * regs, long error_code)
asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs,
long error_code)
{
#if 0
/* No need to warn about this any longer. */
printk("Ignoring P6 Local APIC Spurious Interrupt Bug...\n");
#endif
}
/*
......
......@@ -261,6 +261,43 @@ __initfunc(unsigned long paging_init(unsigned long start_mem, unsigned long end_
return free_area_init(start_mem, end_mem);
}
/*
* Test if the WP bit works in supervisor mode. It isn't supported on 386's
* and also on some strange 486's (NexGen etc.). All 586+'s are OK. The jumps
* before and after the test are here to work-around some nasty CPU bugs.
*/
__initfunc(void test_wp_bit(void))
{
unsigned char tmp_reg;
unsigned long old = pg0[0];
printk("Checking if this processor honours the WP bit even in supervisor mode... ");
pg0[0] = pte_val(mk_pte(PAGE_OFFSET, PAGE_READONLY));
local_flush_tlb();
current->mm->mmap->vm_start += PAGE_SIZE;
__asm__ __volatile__(
"jmp 1f; 1:\n"
"movb %0,%1\n"
"movb %1,%0\n"
"jmp 1f; 1:\n"
:"=m" (*(char *) __va(0)),
"=q" (tmp_reg)
:/* no inputs */
:"memory");
pg0[0] = old;
local_flush_tlb();
current->mm->mmap->vm_start -= PAGE_SIZE;
if (wp_works_ok < 0) {
wp_works_ok = 0;
printk("No.\n");
#ifndef CONFIG_M386
panic("This kernel doesn't support CPU's with broken WP. Recompile it for a 386!");
#endif
} else
printk("Ok.\n");
}
__initfunc(void mem_init(unsigned long start_mem, unsigned long end_mem))
{
unsigned long start_low_mem = PAGE_SIZE;
......@@ -339,30 +376,9 @@ __initfunc(void mem_init(unsigned long start_mem, unsigned long end_mem))
reservedpages << (PAGE_SHIFT-10),
datapages << (PAGE_SHIFT-10),
initpages << (PAGE_SHIFT-10));
/* test if the WP bit is honoured in supervisor mode */
if (wp_works_ok < 0) {
unsigned char tmp_reg;
unsigned long old = pg0[0];
printk("Checking if this processor honours the WP bit even in supervisor mode... ");
pg0[0] = pte_val(mk_pte(PAGE_OFFSET, PAGE_READONLY));
local_flush_tlb();
current->mm->mmap->vm_start += PAGE_SIZE;
__asm__ __volatile__(
"movb %0,%1 ; movb %1,%0"
:"=m" (*(char *) __va(0)),
"=q" (tmp_reg)
:/* no inputs */
:"memory");
pg0[0] = old;
local_flush_tlb();
current->mm->mmap->vm_start -= PAGE_SIZE;
if (wp_works_ok < 0) {
wp_works_ok = 0;
printk("No.\n");
} else
printk("Ok.\n");
}
return;
if (wp_works_ok < 0)
test_wp_bit();
}
void free_initmem(void)
......
......@@ -68,7 +68,7 @@ CONFIG_SOLARIS_EMUL=m
#
# Floppy, IDE, and other block devices
#
# CONFIG_BLK_DEV_FD is not set
CONFIG_BLK_DEV_FD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_LINEAR=m
CONFIG_MD_STRIPED=m
......
/* $Id: ebus.c,v 1.7 1997/08/28 02:23:17 ecd Exp $
/* $Id: ebus.c,v 1.8 1997/09/05 22:59:39 ecd Exp $
* ebus.c: PCI to EBus bridge device.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
......@@ -39,16 +39,72 @@ extern void auxio_probe(void);
extern unsigned int psycho_irq_build(unsigned int full_ino);
__initfunc(void fill_ebus_device(int node, struct linux_ebus_device *dev))
static inline unsigned long
ebus_alloc(unsigned long *memory_start, size_t size)
{
unsigned long mem;
*memory_start = (*memory_start + 7) & ~(7);
mem = *memory_start;
*memory_start += size;
return mem;
}
__initfunc(void fill_ebus_child(int node, struct linux_ebus_child *dev))
{
int regs[PROMREG_MAX];
int irqs[PROMREG_MAX];
char lbuf[128];
int i, len;
dev->prom_node = node;
prom_getstring(node, "name", lbuf, sizeof(lbuf));
strcpy(dev->prom_name, lbuf);
len = prom_getproperty(node, "reg", (void *)regs, sizeof(regs));
dev->num_addrs = len / sizeof(regs[0]);
for (i = 0; i < dev->num_addrs; i++) {
if (regs[i] >= dev->parent->num_addrs) {
prom_printf("UGH: property for %s was %d, need < %d\n",
dev->prom_name, len, dev->parent->num_addrs);
panic(__FUNCTION__);
}
dev->base_address[i] = dev->parent->base_address[regs[i]];
}
len = prom_getproperty(node, "interrupts", (char *)&irqs, sizeof(irqs));
if ((len == -1) || (len == 0)) {
dev->num_irqs = 0;
} else {
dev->num_irqs = len / sizeof(irqs[0]);
for (i = 0; i < dev->num_irqs; i++)
dev->irqs[i] = psycho_irq_build(irqs[i]);
}
#ifdef DEBUG_FILL_EBUS_DEV
printk("child '%s': address%s\n", dev->prom_name,
dev->num_addrs > 1 ? "es" : "");
for (i = 0; i < dev->num_addrs; i++)
printk(" %016lx\n", dev->base_address[i]);
if (dev->num_irqs) {
printk(" IRQ%s", dev->num_irqs > 1 ? "s" : "");
for (i = 0; i < dev->num_irqs; i++)
printk(" %08x", dev->irqs[i]);
printk("\n");
}
#endif
}
__initfunc(unsigned long fill_ebus_device(int node, struct linux_ebus_device *dev,
unsigned long memory_start))
{
struct linux_prom_registers regs[PROMREG_MAX];
struct linux_ebus_child *child;
int irqs[PROMINTR_MAX];
char lbuf[128];
int i, n, len;
#ifndef CONFIG_PCI
return;
#endif
dev->prom_node = node;
prom_getstring(node, "name", lbuf, sizeof(lbuf));
strcpy(dev->prom_name, lbuf);
......@@ -90,6 +146,27 @@ __initfunc(void fill_ebus_device(int node, struct linux_ebus_device *dev))
printk("\n");
}
#endif
if ((node = prom_getchild(node))) {
dev->children = (struct linux_ebus_child *)
ebus_alloc(&memory_start, sizeof(struct linux_ebus_child));
child = dev->children;
child->next = 0;
child->parent = dev;
fill_ebus_child(node, child);
while ((node = prom_getsibling(node))) {
child->next = (struct linux_ebus_child *)
ebus_alloc(&memory_start, sizeof(struct linux_ebus_child));
child = child->next;
child->next = 0;
child->parent = dev;
fill_ebus_child(node, child);
}
}
return memory_start;
}
__initfunc(unsigned long ebus_init(unsigned long memory_start,
......@@ -100,31 +177,32 @@ __initfunc(unsigned long ebus_init(unsigned long memory_start,
struct linux_ebus_device *dev;
struct linux_ebus *ebus;
struct pci_dev *pdev;
struct pcidev_cookie *cookie;
char lbuf[128];
unsigned long addr, *base;
int nd, len, ebusnd, topnd;
unsigned short pci_command;
int nd, len, ebusnd;
int reg, rng, nreg;
int devfn;
int num_ebus = 0;
#ifndef CONFIG_PCI
return memory_start;
#endif
memory_start = ((memory_start + 7) & (~7));
topnd = psycho_root->pbm_B.prom_node;
if (!topnd)
if (!pcibios_present())
return memory_start;
ebusnd = prom_searchsiblings(prom_getchild(topnd), "ebus");
if (ebusnd == 0) {
printk("EBUS: No EBUS's found.\n");
for (pdev = pci_devices; pdev; pdev = pdev->next) {
if ((pdev->vendor == PCI_VENDOR_ID_SUN) &&
(pdev->device == PCI_DEVICE_ID_SUN_EBUS))
break;
}
if (!pdev) {
printk("ebus: No EBus's found.\n");
return memory_start;
}
ebus_chain = ebus = (struct linux_ebus *)memory_start;
memory_start += sizeof(struct linux_ebus);
cookie = pdev->sysdata;
ebusnd = cookie->prom_node;
ebus_chain = ebus = (struct linux_ebus *)
ebus_alloc(&memory_start, sizeof(struct linux_ebus));
ebus->next = 0;
while (ebusnd) {
......@@ -133,7 +211,16 @@ __initfunc(unsigned long ebus_init(unsigned long memory_start,
prom_getstring(ebusnd, "name", lbuf, sizeof(lbuf));
ebus->prom_node = ebusnd;
strcpy(ebus->prom_name, lbuf);
ebus->parent = pbm = &psycho_root->pbm_B;
ebus->self = pdev;
ebus->parent = pbm = cookie->pbm;
/* Enable BUS Master. */
pcibios_read_config_word(pdev->bus->number, pdev->devfn,
PCI_COMMAND, &pci_command);
pci_command |= PCI_COMMAND_MASTER;
pcibios_write_config_word(pdev->bus->number, pdev->devfn,
PCI_COMMAND, pci_command);
len = prom_getproperty(ebusnd, "reg", (void *)regs,
sizeof(regs));
......@@ -144,17 +231,6 @@ __initfunc(unsigned long ebus_init(unsigned long memory_start,
}
nreg = len / sizeof(struct linux_prom_pci_registers);
devfn = (regs[0].phys_hi >> 8) & 0xff;
for (pdev = pbm->pci_bus.devices; pdev; pdev = pdev->sibling)
if (pdev->devfn == devfn)
break;
if (!pdev) {
prom_printf("%s: can't find PCI device\n",
__FUNCTION__);
prom_halt();
}
ebus->self = pdev;
base = &ebus->self->base_address[0];
for (reg = 0; reg < nreg; reg++) {
if (!(regs[reg].phys_hi & 0x03000000))
......@@ -181,25 +257,41 @@ __initfunc(unsigned long ebus_init(unsigned long memory_start,
prom_ebus_ranges_init(ebus);
nd = prom_getchild(ebusnd);
ebus->devices = (struct linux_ebus_device *)memory_start;
memory_start += sizeof(struct linux_ebus_device);
ebus->devices = (struct linux_ebus_device *)
ebus_alloc(&memory_start, sizeof(struct linux_ebus_device));
dev = ebus->devices;
dev->next = 0;
dev->children = 0;
dev->parent = ebus;
fill_ebus_device(nd, dev);
memory_start = fill_ebus_device(nd, dev, memory_start);
while ((nd = prom_getsibling(nd))) {
dev->next = (struct linux_ebus_device *)memory_start;
memory_start += sizeof(struct linux_ebus_device);
dev->next = (struct linux_ebus_device *)
ebus_alloc(&memory_start, sizeof(struct linux_ebus_device));
dev = dev->next;
dev->next = 0;
dev->children = 0;
dev->parent = ebus;
fill_ebus_device(nd, dev);
memory_start = fill_ebus_device(nd, dev, memory_start);
}
ebusnd = prom_searchsiblings(prom_getsibling(ebusnd), "ebus");
for (pdev = pdev->next; pdev; pdev = pdev->next) {
if ((pdev->vendor == PCI_VENDOR_ID_SUN) &&
(pdev->device == PCI_DEVICE_ID_SUN_EBUS))
break;
}
if (!pdev)
break;
cookie = pdev->sysdata;
ebusnd = cookie->prom_node;
ebus->next = (struct linux_ebus *)
ebus_alloc(&memory_start, sizeof(struct linux_ebus));
ebus = ebus->next;
ebus->next = 0;
++num_ebus;
}
......
/* $Id: ioctl32.c,v 1.17 1997/09/03 11:54:49 ecd Exp $
/* $Id: ioctl32.c,v 1.18 1997/09/06 02:25:13 davem Exp $
* ioctl32.c: Conversion between 32bit and 64bit native ioctls.
*
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
......@@ -33,13 +33,6 @@
#include <asm/rtc.h>
#include <asm/openpromio.h>
/*
* XXX: for DaveM:
* This is the kludge to know what size of buffer to
* copy back to the user... (ecd)
*/
int ifr_data_len;
/* As gcc will warn about casting u32 to some ptr, we have to cast it to
* unsigned long first, and that's what is A() for.
* You just do (void *)A(x), instead of having to type (void *)((unsigned long)x)
......@@ -203,13 +196,17 @@ static inline int dev_ifsioc(unsigned int fd, unsigned int cmd, u32 arg)
case SIOCGPPPVER:
{
u32 data;
int len;
__get_user(data, &(((struct ifreq32 *)A(arg))->ifr_ifru.ifru_data));
/*
* XXX: for DaveM:
* Here we use 'ifr_data_len' to know what size of buffer to
* copy back to the user... (ecd)
*/
if (copy_to_user((char *)A(data), ifr.ifr_data, ifr_data_len))
if(cmd == SIOCGPPPVER)
len = strlen(PPP_VERSION) + 1;
else if(cmd == SIOCGPPPCSTATS)
len = sizeof(struct ppp_comp_stats);
else
len = sizeof(struct ppp_stats);
if (copy_to_user((char *)A(data), ifr.ifr_data, len))
return -EFAULT;
break;
}
......
......@@ -161,11 +161,6 @@ static inline int __get_order(unsigned long size);
#include <linux/blk.h>
#include <linux/cdrom.h> /* for the compatibility eject ioctl */
#ifndef FLOPPY_MOTOR_MASK
#define FLOPPY_MOTOR_MASK 0xf0
#endif
#ifndef fd_get_dma_residue
#define fd_get_dma_residue() get_dma_residue(FLOPPY_DMA)
#endif
......
......@@ -584,7 +584,7 @@ static int hd_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg)
{
struct hd_geometry *loc = (struct hd_geometry *) arg;
int dev, err;
int dev;
if ((!inode) || !(inode->i_rdev))
return -EINVAL;
......@@ -593,19 +593,15 @@ static int hd_ioctl(struct inode * inode, struct file * file,
return -EINVAL;
switch (cmd) {
case HDIO_GETGEO:
{
struct hd_geometry g;
if (!loc) return -EINVAL;
err = verify_area(VERIFY_WRITE, loc, sizeof(*loc));
if (err)
return err;
put_user(hd_info[dev].head,
(char *) &loc->heads);
put_user(hd_info[dev].sect,
(char *) &loc->sectors);
put_user(hd_info[dev].cyl,
(short *) &loc->cylinders);
put_user(hd[MINOR(inode->i_rdev)].start_sect,
(long *) &loc->start);
return 0;
g.heads = hd_info[dev].head;
g.sectors = hd_info[dev].sect;
g.cylinders = hd_info[dev].cyl;
g.start = hd[MINOR(inode->i_rdev)].start_sect;
return copy_to_user(loc, &g, sizeof g) ? -EFAULT : 0;
}
case BLKRASET:
if(!suser()) return -EACCES;
if(arg > 0xff) return -EINVAL;
......@@ -613,18 +609,12 @@ static int hd_ioctl(struct inode * inode, struct file * file,
return 0;
case BLKRAGET:
if (!arg) return -EINVAL;
err = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long));
if (err)
return err;
put_user(read_ahead[MAJOR(inode->i_rdev)],(long *) arg);
return 0;
return put_user(read_ahead[MAJOR(inode->i_rdev)],
(long *) arg);
case BLKGETSIZE: /* Return device size */
if (!arg) return -EINVAL;
err = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long));
if (err)
return err;
put_user(hd[MINOR(inode->i_rdev)].nr_sects, (long *) arg);
return 0;
return put_user(hd[MINOR(inode->i_rdev)].nr_sects,
(long *) arg);
case BLKFLSBUF:
if(!suser()) return -EACCES;
fsync_dev(inode->i_rdev);
......@@ -817,7 +807,7 @@ __initfunc(int hd_init(void))
/*
* This routine is called to flush all partitions and partition tables
* for a changed scsi disk, and then re-read the new partition table.
* for a changed disk, and then re-read the new partition table.
* If we are revalidating a disk because of a media change, then we
* enter with usage == 0. If we are using an ioctl, we automatically have
* usage == 1 (we need an open channel to use an ioctl :-), so this
......@@ -850,8 +840,11 @@ static int revalidate_hddisk(kdev_t dev, int maxusage)
for (i=max_p - 1; i >=0 ; i--) {
int minor = start + i;
kdev_t devi = MKDEV(MAJOR_NR, minor);
struct super_block *sb = get_super(devi);
sync_dev(devi);
invalidate_inodes(devi);
if (sb)
invalidate_inodes(sb);
invalidate_buffers(devi);
gdev->part[minor].start_sect = 0;
gdev->part[minor].nr_sects = 0;
......
......@@ -20,13 +20,13 @@
#include <linux/module.h>
#include <linux/md.h>
#include <linux/raid0.h>
#include <linux/malloc.h>
#include <linux/vmalloc.h>
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
static void create_strip_zones (int minor, struct md_dev *mddev)
static int create_strip_zones (int minor, struct md_dev *mddev)
{
int i, j, c=0;
int current_offset=0;
......@@ -50,8 +50,8 @@ static void create_strip_zones (int minor, struct md_dev *mddev)
c=0;
}
data->strip_zone=kmalloc (sizeof(struct strip_zone)*data->nr_strip_zones,
GFP_KERNEL);
if ((data->strip_zone=vmalloc(sizeof(struct strip_zone)*data->nr_strip_zones)) == NULL)
return 1;
data->smallest=NULL;
......@@ -81,6 +81,7 @@ static void create_strip_zones (int minor, struct md_dev *mddev)
data->strip_zone[i-1].size) : 0;
current_offset=smallest_by_zone->size;
}
return 0;
}
static int raid0_run (int minor, struct md_dev *mddev)
......@@ -90,17 +91,26 @@ static int raid0_run (int minor, struct md_dev *mddev)
MOD_INC_USE_COUNT;
mddev->private=kmalloc (sizeof (struct raid0_data), GFP_KERNEL);
if ((mddev->private=vmalloc (sizeof (struct raid0_data))) == NULL) return 1;
data=(struct raid0_data *) mddev->private;
create_strip_zones (minor, mddev);
if (create_strip_zones (minor, mddev))
{
vfree(data);
return 1;
}
nb_zone=data->nr_zones=
md_size[minor]/data->smallest->size +
(md_size[minor]%data->smallest->size ? 1 : 0);
data->hash_table=kmalloc (sizeof (struct raid0_hash)*nb_zone, GFP_KERNEL);
printk ("raid0 : Allocating %d bytes for hash.\n",sizeof(struct raid0_hash)*nb_zone);
if ((data->hash_table=vmalloc (sizeof (struct raid0_hash)*nb_zone)) == NULL)
{
vfree(data->strip_zone);
vfree(data);
return 1;
}
size=data->strip_zone[cur].size;
i=0;
......@@ -142,9 +152,9 @@ static int raid0_stop (int minor, struct md_dev *mddev)
{
struct raid0_data *data=(struct raid0_data *) mddev->private;
kfree (data->hash_table);
kfree (data->strip_zone);
kfree (data);
vfree (data->hash_table);
vfree (data->strip_zone);
vfree (data);
MOD_DEC_USE_COUNT;
return 0;
......
......@@ -447,7 +447,7 @@ __initfunc(static void rd_load_image(kdev_t device,int offset))
struct inode inode, out_inode;
struct file infile, outfile;
struct dentry in_dentry, out_dentry;
unsigned short fs;
unsigned long fs;
kdev_t ram_device;
int nblocks, i;
char *buf;
......
......@@ -101,8 +101,10 @@ if [ "$CONFIG_WATCHDOG" != "n" ]; then
fi
tristate ' Software Watchdog' CONFIG_SOFT_WATCHDOG
tristate ' Berkshire Products PC Watchdog' CONFIG_PCWATCHDOG
tristate ' Acquire SBC Watchdog Timer' CONFIG_ACQUIRE_WDT
fi
bool 'Enhanced Real Time Clock Support' CONFIG_RTC
bool 'Tadpole ANA H8 Support' CONFIG_H8
tristate '/dev/nvram support' CONFIG_NVRAM
tristate 'PC joystick support' CONFIG_JOYSTICK
endmenu
......@@ -204,6 +204,16 @@ else
endif
endif
ifeq ($(CONFIG_ACQUIRE_WDT),y)
M = y
L_OBJS += acquirewdt.o
else
ifeq ($(CONFIG_ACQUIRE_WDT),m)
M_OBJS += acquirewdt.o
MM = m
endif
endif
ifeq ($(CONFIG_AMIGAMOUSE),y)
M = y
L_OBJS += amigamouse.o
......@@ -293,6 +303,11 @@ LX_OBJS += apm_bios.o
M = y
endif
ifdef CONFIG_H8
LX_OBJS += h8.o
M = y
endif
ifdef M
LX_OBJS += misc.o
else
......
/*
* Acquire Single Board Computer Watchdog Timer driver for Linux 2.1.x
*
* Based on wdt.c. Original copyright messages:
*
* (c) Copyright 1996 Alan Cox <alan@cymru.net>, All Rights Reserved.
* http://www.cymru.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
* warranty for any of this software. This material is provided
* "AS-IS" and at no charge.
*
* (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/malloc.h>
#include <linux/ioport.h>
#include <linux/fcntl.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
static int acq_is_open=0;
/*
* You must set these - there is no sane way to probe for this board.
*/
#define WDT_STOP 0x43
#define WDT_START 0x443
#define WATCHDOG_MINOR 130
#define WD_TIMO (100*60) /* 1 minute */
/*
* Kernel methods.
*/
static void acq_ping(void)
{
/* Write a watchdog value */
inb_p(WDT_START);
}
static long acq_write(struct inode *inode, struct file *file, const char *buf, unsigned long count)
{
if(count)
{
acq_ping();
return 1;
}
return 0;
}
static long acq_read(struct inode *inode, struct file *file, char *buf, unsigned long count)
{
return -EINVAL;
}
static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
static struct watchdog_info ident=
{
WDIOF_KEEPALIVEPING, 1, "Acquire WDT"
};
switch(cmd)
{
case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
if (copy_to_user((int *)arg, &acq_is_open, sizeof(int)))
return -EFAULT;
break;
case WDIOC_KEEPALIVE:
acq_ping();
break;
default:
return -ENOIOCTLCMD;
}
return 0;
}
static int acq_open(struct inode *inode, struct file *file)
{
switch(MINOR(inode->i_rdev))
{
case WATCHDOG_MINOR:
if(acq_is_open)
return -EBUSY;
MOD_INC_USE_COUNT;
/*
* Activate
*/
acq_is_open=1;
inb_p(WDT_START);
return 0;
default:
return -ENODEV;
}
}
static int acq_close(struct inode *inode, struct file *file)
{
if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
{
#ifndef CONFIG_WATCHDOG_NOWAYOUT
inb_p(WDT_STOP);
#endif
acq_is_open=0;
}
MOD_DEC_USE_COUNT;
return 0;
}
/*
* Notifier for system down
*/
static int acq_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{
if(code==SYS_DOWN || code==SYS_HALT)
{
/* Turn the card off */
inb_p(WDT_STOP);
}
return NOTIFY_DONE;
}
/*
* Kernel Interfaces
*/
static struct file_operations acq_fops = {
NULL,
acq_read,
acq_write,
NULL, /* No Readdir */
NULL, /* No Select */
acq_ioctl,
NULL, /* No mmap */
acq_open,
acq_close
};
static struct miscdevice acq_miscdev=
{
WATCHDOG_MINOR,
"Acquire WDT",
&acq_fops
};
/*
* The WDT card needs to learn about soft shutdowns in order to
* turn the timebomb registers off.
*/
static struct notifier_block acq_notifier=
{
acq_notify_sys,
NULL,
0
};
#ifdef MODULE
#define acq_init init_module
void cleanup_module(void)
{
misc_deregister(&acq_miscdev);
unregister_reboot_notifier(&acq_notifier);
release_region(WDT_STOP,1);
release_region(WDT_START,1);
}
#endif
__initfunc(int acq_init(void))
{
printk("WDT driver for Acquire single board computer initialising.\n");
misc_register(&acq_miscdev);
request_region(WDT_STOP, 1, "Acquire WDT");
request_region(WDT_START, 1, "Acquire WDT");
unregister_reboot_notifier(&acq_notifier);
return 0;
}
This diff is collapsed.
/*
*/
#ifndef __H8_H__
#define __H8_H__
/*
* Register address and offsets
*/
#define H8_BASE_ADDR 0x170 /* default */
#define H8_IRQ 9 /* default */
#define H8_STATUS_REG_OFF 0x4
#define H8_CMD_REG_OFF 0x4
#define H8_DATA_REG_OFF 0x0
/* H8 register bit definitions */
/* status register */
#define H8_OFULL 0x1 /* output data register full */
#define H8_IFULL 0x2 /* input data register full */
#define H8_CMD 0x8 /* command / not data */
#define H8_INTR 0xfa
#define H8_NACK 0xfc
#define H8_BYTE_LEVEL_ACK 0xfd
#define H8_CMD_ACK 0xfe
#define H8_SYNC_BYTE 0x99
/*
* H8 command definitions
*/
/* System info commands */
#define H8_SYNC 0x0
#define H8_RD_SN 0x1
#define H8_RD_ENET_ADDR 0x2
#define H8_RD_HW_VER 0x3
#define H8_RD_MIC_VER 0x4
#define H8_RD_MAX_TEMP 0x5
#define H8_RD_MIN_TEMP 0x6
#define H8_RD_CURR_TEMP 0x7
#define H8_RD_SYS_VARIENT 0x8
#define H8_RD_PWR_ON_CYCLES 0x9
#define H8_RD_PWR_ON_SECS 0xa
#define H8_RD_RESET_STATUS 0xb
#define H8_RD_PWR_DN_STATUS 0xc
#define H8_RD_EVENT_STATUS 0xd
#define H8_RD_ROM_CKSM 0xe
#define H8_RD_EXT_STATUS 0xf
#define H8_RD_USER_CFG 0x10
#define H8_RD_INT_BATT_VOLT 0x11
#define H8_RD_DC_INPUT_VOLT 0x12
#define H8_RD_HORIZ_PTR_VOLT 0x13
#define H8_RD_VERT_PTR_VOLT 0x14
#define H8_RD_EEPROM_STATUS 0x15
#define H8_RD_ERR_STATUS 0x16
#define H8_RD_NEW_BUSY_SPEED 0x17
#define H8_RD_CONFIG_INTERFACE 0x18
#define H8_RD_INT_BATT_STATUS 0x19
#define H8_RD_EXT_BATT_STATUS 0x1a
#define H8_RD_PWR_UP_STATUS 0x1b
#define H8_RD_EVENT_STATUS_MASK 0x56
/* Read/write/modify commands */
#define H8_CTL_EMU_BITPORT 0x32
#define H8_DEVICE_CONTROL 0x21
#define H8_CTL_TFT_BRT_DC 0x22
#define H8_CTL_WATCHDOG 0x23
#define H8_CTL_MIC_PROT 0x24
#define H8_CTL_INT_BATT_CHG 0x25
#define H8_CTL_EXT_BATT_CHG 0x26
#define H8_CTL_MARK_SPACE 0x27
#define H8_CTL_MOUSE_SENSITIVITY 0x28
#define H8_CTL_DIAG_MODE 0x29
#define H8_CTL_IDLE_AND_BUSY_SPDS 0x2a
#define H8_CTL_TFT_BRT_BATT 0x2b
#define H8_CTL_UPPER_TEMP 0x2c
#define H8_CTL_LOWER_TEMP 0x2d
#define H8_CTL_TEMP_CUTOUT 0x2e
#define H8_CTL_WAKEUP 0x2f
#define H8_CTL_CHG_THRESHOLD 0x30
#define H8_CTL_TURBO_MODE 0x31
#define H8_SET_DIAG_STATUS 0x40
#define H8_SOFTWARE_RESET 0x41
#define H8_RECAL_PTR 0x42
#define H8_SET_INT_BATT_PERCENT 0x43
#define H8_WRT_CFG_INTERFACE_REG 0x45
#define H8_WRT_EVENT_STATUS_MASK 0x57
#define H8_ENTER_POST_MODE 0x46
#define H8_EXIT_POST_MODE 0x47
/* Block transfer commands */
#define H8_RD_EEPROM 0x50
#define H8_WRT_EEPROM 0x51
#define H8_WRT_TO_STATUS_DISP 0x52
#define H8_DEFINE_SPC_CHAR 0x53
/* Generic commands */
#define H8_DEFINE_TABLE_STRING_ENTRY 0x60
/* Battery control commands */
#define H8_PERFORM_EMU_CMD 0x70
#define H8_EMU_RD_REG 0x71
#define H8_EMU_WRT_REG 0x72
#define H8_EMU_RD_RAM 0x73
#define H8_EMU_WRT_RAM 0x74
#define H8_BQ_RD_REG 0x75
#define H8_BQ_WRT_REG 0x76
/* System admin commands */
#define H8_PWR_OFF 0x80
/*
* H8 command related definitions
*/
/* device control argument bits */
#define H8_ENAB_EXTSMI 0x1
#define H8_DISAB_IRQ 0x2
#define H8_ENAB_FLASH_WRT 0x4
#define H8_ENAB_THERM 0x8
#define H8_ENAB_INT_PTR 0x10
#define H8_ENAB_LOW_SPD_IND 0x20
#define H8_ENAB_EXT_PTR 0x40
#define H8_DISAB_PWR_OFF_SW 0x80
#define H8_POWER_OFF 0x80
/* H8 read event status bits */
#define H8_DC_CHANGE 0x1
#define H8_INT_BATT_LOW 0x2
#define H8_INT_BATT_CHARGE_THRESHOLD 0x4
#define H8_INT_BATT_CHARGE_STATE 0x8
#define H8_INT_BATT_STATUS 0x10
#define H8_EXT_BATT_CHARGE_STATE 0x20
#define H8_EXT_BATT_LOW 0x40
#define H8_EXT_BATT_STATUS 0x80
#define H8_THERMAL_THRESHOLD 0x100
#define H8_WATCHDOG 0x200
#define H8_DOCKING_STATION_STATUS 0x400
#define H8_EXT_MOUSE_OR_CASE_SWITCH 0x800
#define H8_KEYBOARD 0x1000
#define H8_BATT_CHANGE_OVER 0x2000
#define H8_POWER_BUTTON 0x4000
#define H8_SHUTDOWN 0x8000
/* H8 control idle and busy speeds */
#define H8_SPEED_LOW 0x1
#define H8_SPEED_MED 0x2
#define H8_SPEED_HI 0x3
#define H8_SPEED_LOCKED 0x80
#define H8_MAX_CMD_SIZE 18
#define H8_Q_ALLOC_AMOUNT 10
/* H8 state field values */
#define H8_IDLE 1
#define H8_XMIT 2
#define H8_RCV 3
#define H8_RESYNC 4
#define H8_INTR_MODE 5
/* Mask values for control functions */
#define UTH_HYSTERESIS 5
#define DEFAULT_UTHERMAL_THRESHOLD 115
#define H8_TIMEOUT_INTERVAL 30
#define H8_RUN 4
#define H8_GET_MAX_TEMP 0x1
#define H8_GET_CURR_TEMP 0x2
#define H8_GET_UPPR_THRMAL_THOLD 0x4
#define H8_GET_ETHERNET_ADDR 0x8
#define H8_SYNC_OP 0x10
#define H8_SET_UPPR_THRMAL_THOLD 0x20
#define H8_GET_INT_BATT_STAT 0x40
#define H8_GET_CPU_SPD 0x80
#define H8_MANAGE_UTHERM 0x100
#define H8_MANAGE_LTHERM 0x200
#define H8_HALT 0x400
#define H8_CRASH 0x800
#define H8_GET_EXT_STATUS 0x10000
#define H8_MANAGE_QUIET 0x20000
#define H8_MANAGE_SPEEDUP 0x40000
#define H8_MANAGE_BATTERY 0x80000
#define H8_SYSTEM_DELAY_TEST 0x100000
#define H8_POWER_SWITCH_TEST 0x200000
/* cpu speeds and clock divisor values */
#define MHZ_14 5
#define MHZ_28 4
#define MHZ_57 3
#define MHZ_115 2
#define MHZ_230 0
/*
* H8 data
*/
struct h8_data {
u_int ser_num;
u_char ether_add[6];
u_short hw_ver;
u_short mic_ver;
u_short max_tmp;
u_short min_tmp;
u_short cur_tmp;
u_int sys_var;
u_int pow_on;
u_int pow_on_secs;
u_char reset_status;
u_char pwr_dn_status;
u_short event_status;
u_short rom_cksm;
u_short ext_status;
u_short u_cfg;
u_char ibatt_volt;
u_char dc_volt;
u_char ptr_horiz;
u_char ptr_vert;
u_char eeprom_status;
u_char error_status;
u_char new_busy_speed;
u_char cfg_interface;
u_short int_batt_status;
u_short ext_batt_status;
u_char pow_up_status;
u_char event_status_mask;
};
/*
* H8 command buffers
*/
typedef struct h8_cmd_q {
DLNODE(struct h8_cmd_q) link; /* double linked list */
int ncmd; /* number of bytes in command */
int nrsp; /* number of bytes in response */
int cnt; /* number of bytes sent/received */
int nacks; /* number of byte level acks */
u_char cmdbuf[H8_MAX_CMD_SIZE]; /* buffer to store command */
u_char rcvbuf[H8_MAX_CMD_SIZE]; /* buffer to store response */
} h8_cmd_q_t;
typedef struct __queue_head {
DLNODE(struct h8_cmd_q) link;
} queue_head_t;
union intr_buf {
u_char byte[2];
u_int word;
};
#endif /* __H8_H_ */
......@@ -339,13 +339,6 @@ static int mmap_zero(struct inode * inode, struct file * file, struct vm_area_st
return 0;
}
static long read_full(struct inode * node, struct file * file,
char * buf, unsigned long count)
{
file->f_pos += count;
return count;
}
static long write_full(struct inode * inode, struct file * file,
const char * buf, unsigned long count)
{
......@@ -390,7 +383,9 @@ static long long memory_lseek(struct inode * inode, struct file * file,
#define mmap_kmem mmap_mem
#define zero_lseek null_lseek
#define full_lseek null_lseek
#define write_zero write_null
#define read_full read_zero
static struct file_operations mem_fops = {
memory_lseek,
......@@ -457,7 +452,7 @@ static struct file_operations zero_fops = {
};
static struct file_operations full_fops = {
memory_lseek,
full_lseek,
read_full,
write_full,
NULL, /* full_readdir */
......
......@@ -71,10 +71,12 @@ extern int atari_mouse_init(void);
extern int sun_mouse_init(void);
extern void watchdog_init(void);
extern void wdt_init(void);
extern void acq_init(void);
extern void pcwatchdog_init(void);
extern int rtc_init(void);
extern int dsp56k_init(void);
extern int nvram_init(void);
extern void hfmodem_init(void);
#ifdef CONFIG_PROC_FS
static int misc_read_proc(char *buf, char **start, off_t offset,
......@@ -231,18 +233,27 @@ __initfunc(int misc_init(void))
#ifdef CONFIG_WDT
wdt_init();
#endif
#ifdef CONFIG_ACQUIRE_WDT
acq_init();
#endif
#ifdef CONFIG_SOFT_WATCHDOG
watchdog_init();
#endif
#ifdef CONFIG_APM
apm_bios_init();
#endif
#ifdef CONFIG_H8
h8_init();
#endif
#ifdef CONFIG_RTC
rtc_init();
#endif
#ifdef CONFIG_ATARI_DSP56K
dsp56k_init();
#endif
#ifdef CONFIG_HFMODEM
hfmodem_init();
#endif
#ifdef CONFIG_NVRAM
nvram_init();
#endif
......
......@@ -18,6 +18,8 @@
#include <linux/kernel.h>
#include <linux/malloc.h>
#include <linux/config.h>
#ifdef CONFIG_KERNELD
#include <linux/kerneld.h>
#endif
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -462,14 +462,17 @@ static void set_rx_mode(struct device *dev);
/* 'options' is used to pass a transceiver override or full-duplex flag
e.g. "options=16" for FD, "options=32" for 100mbps-only. */
static int full_duplex[] = {-1, -1, -1, -1, -1, -1, -1, -1};
#ifdef MODULE
static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1};
static int debug = -1; /* The debug level */
#endif
/* A list of all installed Speedo devices, for removing the driver module. */
static struct device *root_speedo_dev = NULL;
#endif
int eepro100_init(struct device *dev)
{
int cards_found = 0;
......
......@@ -521,7 +521,7 @@ ppp_free_buf (struct ppp_buffer *ptr)
extern inline int
lock_buffer (register struct ppp_buffer *buf)
{
register int state;
register long state;
int flags;
/*
* Save the current state and if free then set it to the "busy" state
......@@ -1071,6 +1071,7 @@ ppp_tty_receive (struct tty_struct *tty, const __u8 * data,
*/
if (ppp->flags & SC_LOG_RAWIN)
ppp_print_buffer ("receive buffer", data, count);
/*
* Collect the character and error condition for the character. Set the toss
* flag for the first character error.
......@@ -1083,6 +1084,7 @@ ppp_tty_receive (struct tty_struct *tty, const __u8 * data,
ppp->toss = *flags;
++flags;
}
/*
* Set the flags for 8 data bits and no parity.
*
......@@ -1467,6 +1469,7 @@ static void ppp_doframe_lower (struct ppp *ppp, __u8 *data, int count)
{
__u16 proto = PPP_PROTOCOL (data);
ppp_proto_type *proto_ptr;
/*
* Ignore empty frames
*/
......@@ -1507,6 +1510,7 @@ ppp_doframe (struct ppp *ppp)
int addr, ctrl, proto;
int new_count;
__u8 *new_data;
/*
* If there is a pending error from the receiver then log it and discard
* the damaged frame.
......
/*
* drivers/pci/pci.c
* $Id: pci.c,v 1.44 1997/09/03 05:08:22 richard Exp $
*
* PCI services that are built on top of the BIOS32 service.
*
......@@ -20,7 +20,6 @@
struct pci_bus pci_root;
struct pci_dev *pci_devices = 0;
/*
* The bridge_id field is an offset of an item into the array
* BRIDGE_MAPPING_TYPE. 0xff indicates that the device is not a PCI
......@@ -68,6 +67,7 @@ struct pci_dev_info dev_info[] = {
DEVICE( VLSI, VLSI_82C597, "82C597-AFC2"),
DEVICE( VLSI, VLSI_VAS96011, "VAS96011 PowerPC"),
DEVICE( ADL, ADL_2301, "2301"),
DEVICE( NS, NS_87415, "87415"),
DEVICE( NS, NS_87410, "87410"),
DEVICE( TSENG, TSENG_W32P_2, "ET4000W32P"),
DEVICE( TSENG, TSENG_W32P_b, "ET4000W32P rev B"),
......@@ -78,8 +78,9 @@ struct pci_dev_info dev_info[] = {
DEVICE( WEITEK, WEITEK_P9100, "P9100"),
BRIDGE( DEC, DEC_BRD, "DC21050", 0x00),
DEVICE( DEC, DEC_TULIP, "DC21040"),
DEVICE( DEC, DEC_TGA, "DC21030"),
DEVICE( DEC, DEC_TGA, "TGA"),
DEVICE( DEC, DEC_TULIP_FAST, "DC21140"),
DEVICE( DEC, DEC_TGA2, "TGA2"),
DEVICE( DEC, DEC_FDDI, "DEFPA"),
DEVICE( DEC, DEC_TULIP_PLUS, "DC21041"),
DEVICE( DEC, DEC_21142, "DC21142"),
......@@ -181,6 +182,9 @@ struct pci_dev_info dev_info[] = {
DEVICE( OLICOM, OLICOM_OC2183, "OC-2183/2185"),
DEVICE( OLICOM, OLICOM_OC2326, "OC-2326"),
DEVICE( OLICOM, OLICOM_OC6151, "OC-6151/6152"),
DEVICE( SUN, SUN_EBUS, "EBUS"),
DEVICE( SUN, SUN_HAPPYMEAL, "Happy Meal"),
BRIDGE( SUN, SUN_PBM, "PCI Bus Module", 0x02),
DEVICE( CMD, CMD_640, "640 (buggy)"),
DEVICE( CMD, CMD_643, "643"),
DEVICE( CMD, CMD_646, "646"),
......@@ -596,6 +600,7 @@ const char *pci_strvendor(unsigned int vendor)
case PCI_VENDOR_ID_CONTAQ: return "Contaq";
case PCI_VENDOR_ID_FOREX: return "Forex";
case PCI_VENDOR_ID_OLICOM: return "Olicom";
case PCI_VENDOR_ID_SUN: return "Sun Microsystems";
case PCI_VENDOR_ID_CMD: return "CMD";
case PCI_VENDOR_ID_VISION: return "Vision";
case PCI_VENDOR_ID_BROOKTREE: return "Brooktree";
......@@ -668,6 +673,36 @@ const char *pci_strdev(unsigned int vendor, unsigned int device)
}
const char *pcibios_strerror(int error)
{
static char buf[32];
switch (error) {
case PCIBIOS_SUCCESSFUL:
case PCIBIOS_BAD_VENDOR_ID:
return "SUCCESSFUL";
case PCIBIOS_FUNC_NOT_SUPPORTED:
return "FUNC_NOT_SUPPORTED";
case PCIBIOS_DEVICE_NOT_FOUND:
return "DEVICE_NOT_FOUND";
case PCIBIOS_BAD_REGISTER_NUMBER:
return "BAD_REGISTER_NUMBER";
case PCIBIOS_SET_FAILED:
return "SET_FAILED";
case PCIBIOS_BUFFER_TOO_SMALL:
return "BUFFER_TOO_SMALL";
default:
sprintf (buf, "PCI ERROR 0x%x", error);
return buf;
}
}
/*
* Turn on/off PCI bridge optimization. This should allow benchmarking.
......@@ -793,7 +828,7 @@ static int sprint_dev_config(struct pci_dev *dev, char *buf, int size)
if (len + 40 > size) {
return -1;
}
len += sprintf(buf + len, "IRQ %d. ", dev->irq);
len += sprintf(buf + len, "IRQ %x. ", dev->irq);
}
if (dev->master) {
......@@ -811,20 +846,24 @@ static int sprint_dev_config(struct pci_dev *dev, char *buf, int size)
len += sprintf(buf + len, "Max Lat=%d.", max_lat);
}
for (reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4) {
for (reg = 0; reg < 6; reg++) {
if (len + 40 > size) {
return -1;
}
pcibios_read_config_dword(bus, devfn, reg, &l);
base = l;
if (!base) {
pcibios_read_config_dword(bus, devfn,
PCI_BASE_ADDRESS_0 + (reg << 2), &l);
if (l == 0xffffffff)
base = 0;
else
base = l;
if (!base)
continue;
}
if (base & PCI_BASE_ADDRESS_SPACE_IO) {
len += sprintf(buf + len,
"\n I/O at 0x%lx.",
base & PCI_BASE_ADDRESS_IO_MASK);
"\n I/O at 0x%lx [0x%lx].",
base & PCI_BASE_ADDRESS_IO_MASK,
dev->base_address[reg]);
} else {
const char *pref, *type = "unknown";
......@@ -848,8 +887,9 @@ static int sprint_dev_config(struct pci_dev *dev, char *buf, int size)
}
len += sprintf(buf + len,
"\n %srefetchable %s memory at "
"0x%lx.", pref, type,
base & PCI_BASE_ADDRESS_MEM_MASK);
"0x%lx [0x%lx].", pref, type,
base & PCI_BASE_ADDRESS_MEM_MASK,
dev->base_address[reg]);
}
}
......@@ -892,7 +932,7 @@ __initfunc(static void *pci_malloc(long size, unsigned long *mem_startp))
void *mem;
#ifdef DEBUG
printk("...pci_malloc(size=%ld,mem=%p)", size, *mem_startp);
printk("...pci_malloc(size=%ld,mem=%p)", size, (void *)*mem_startp);
#endif
mem = (void*) *mem_startp;
*mem_startp += (size + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
......@@ -901,16 +941,18 @@ __initfunc(static void *pci_malloc(long size, unsigned long *mem_startp))
}
__initfunc(static unsigned int scan_bus(struct pci_bus *bus, unsigned long *mem_startp))
unsigned int pci_scan_bus(struct pci_bus *bus, unsigned long *mem_startp)
{
unsigned int devfn, l, max;
unsigned char cmd, tmp, hdr_type = 0;
unsigned char cmd, tmp, irq, hdr_type = 0;
struct pci_dev_info *info;
struct pci_dev *dev;
struct pci_bus *child;
int reg;
#ifdef DEBUG
printk("...scan_bus(busno=%d,mem=%p)\n", bus->number, *mem_startp);
printk("...pci_scan_bus(busno=%d,mem=%p)\n", bus->number,
(void *)*mem_startp);
#endif
max = bus->secondary;
......@@ -952,7 +994,7 @@ __initfunc(static unsigned int scan_bus(struct pci_bus *bus, unsigned long *mem_
*/
info = pci_lookup_dev(dev->vendor, dev->device);
if (!info) {
printk("Warning : Unknown PCI device (%x:%x). Please read include/linux/pci.h \n",
printk("PCI: Warning: Unknown PCI device (%x:%x). Please read include/linux/pci.h\n",
dev->vendor, dev->device);
} else {
/* Some BIOS' are lazy. Let's do their job: */
......@@ -975,7 +1017,20 @@ __initfunc(static unsigned int scan_bus(struct pci_bus *bus, unsigned long *mem_
/* read irq level (may be changed during pcibios_fixup()): */
pcibios_read_config_byte(bus->number, devfn,
PCI_INTERRUPT_LINE, &dev->irq);
PCI_INTERRUPT_LINE, &irq);
dev->irq = irq;
/* read base address registers, again pcibios_fixup() can
* tweak these
*/
for (reg = 0; reg < 6; reg++) {
pcibios_read_config_dword(bus->number, devfn,
PCI_BASE_ADDRESS_0 + (reg << 2), &l);
if (l == 0xffffffff)
dev->base_address[reg] = 0;
else
dev->base_address[reg] = l;
}
/* check to see if this device is a PCI-PCI bridge: */
pcibios_read_config_dword(bus->number, devfn,
......@@ -1033,7 +1088,7 @@ __initfunc(static unsigned int scan_bus(struct pci_bus *bus, unsigned long *mem_
child->secondary = (buses >> 8) & 0xFF;
child->subordinate = (buses >> 16) & 0xFF;
child->number = child->secondary;
max = scan_bus(child, mem_startp);
max = pci_scan_bus(child, mem_startp);
}
else
{
......@@ -1050,7 +1105,7 @@ __initfunc(static unsigned int scan_bus(struct pci_bus *bus, unsigned long *mem_
/*
* Now we can scan all subordinate buses:
*/
max = scan_bus(child, mem_startp);
max = pci_scan_bus(child, mem_startp);
/*
* Set the subordinate bus number to its real
* value:
......@@ -1081,14 +1136,14 @@ __initfunc(unsigned long pci_init (unsigned long mem_start, unsigned long mem_en
mem_start = pcibios_init(mem_start, mem_end);
if (!pcibios_present()) {
printk("pci_init: no PCI BIOS detected\n");
printk("PCI: No PCI bus detected\n");
return mem_start;
}
printk("Probing PCI hardware.\n");
memset(&pci_root, 0, sizeof(pci_root));
pci_root.subordinate = scan_bus(&pci_root, &mem_start);
pci_root.subordinate = pci_scan_bus(&pci_root, &mem_start);
/* give BIOS a chance to apply platform specific fixes: */
mem_start = pcibios_fixup(mem_start, mem_end);
......
This diff is collapsed.
This diff is collapsed.
......@@ -736,4 +736,11 @@ Scsi_Host_Template driver_template = GENERIC_NCR5380;
#include <linux/module.h>
#include "scsi_module.c"
MODULE_PARM(ncr_irq, "i");
MODULE_PARM(ncr_dma, "i");
MODULE_PARM(ncr_addr, "i");
MODULE_PARM(ncr_5380, "i");
MODULE_PARM(ncr_53c400, "i");
#endif
......@@ -7,9 +7,7 @@
* Paul Mackerras, August 1996.
* Copyright (C) 1996 Paul Mackerras.
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/types.h>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment