Commit c00e184c authored by Anton Altaparmakov's avatar Anton Altaparmakov

Merge cantab.net:/usr/src/bklinux-2.5 into cantab.net:/usr/src/tng

parents a83bd903 65f0361a
......@@ -77,13 +77,11 @@ instead if you wish, although it may cause problems. Later versions of gcc
have not received much testing for Linux kernel compilation, and there are
almost certainly bugs (mainly, but not exclusively, in the kernel) that
will need to be fixed in order to use these compilers. In any case, using
pgcc instead of egcs or plain gcc is just asking for trouble.
pgcc instead of plain gcc is just asking for trouble.
Note that gcc 2.7.2.3 is no longer a supported kernel compiler. The kernel
no longer works around bugs in gcc 2.7.2.3 and, in fact, will refuse to
be compiled with it. egcs-1.1.2 has register allocation problems in very
obscure cases. We have ensured the kernel does not trip these in any known
situation. The 2.5 tree is likely to drop egcs-1.1.2 workarounds.
Note that gcc 2.7.2.3 and gcc 2.91.66 (egcs-1.1.2) are no longer supported
kernel compilers. The kernel no longer works around bugs in these versions,
and, in fact, will refuse to be compiled with it.
The Red Hat gcc 2.96 compiler subtree can also be used to build this tree.
You should ensure you use gcc-2.96-74 or later. gcc-2.96-54 will not build
......@@ -275,10 +273,6 @@ Getting updated software
Kernel compilation
******************
egcs 1.1.2 (gcc 2.91.66)
------------------------
o <ftp://sourceware.cygnus.com/pub/gcc/releases/egcs-1.1.2/egcs-1.1.2.tar.bz2>
gcc 2.95.3
----------
o <ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3.tar.gz>
......
......@@ -153,8 +153,9 @@ CONFIGURING the kernel:
COMPILING the kernel:
- Make sure you have gcc 2.95.3 available. gcc 2.91.66 (egcs-1.1.2) may
also work but is not as safe, and *gcc 2.7.2.3 is no longer supported*.
- Make sure you have gcc 2.95.3 available.
gcc 2.91.66 (egcs-1.1.2), and gcc 2.7.2.3 are known to miscompile
some parts of the kernel, and are *no longer supported*.
Also remember to upgrade your binutils package (for as/ld/nm and company)
if necessary. For more information, refer to ./Documentation/Changes.
......
......@@ -1792,7 +1792,7 @@ static int __init apm_setup(char *str)
idle_threshold = simple_strtol(str + 15, NULL, 0);
if ((strncmp(str, "idle-period=", 12) == 0) ||
(strncmp(str, "idle_period=", 12) == 0))
idle_threshold = simple_strtol(str + 15, NULL, 0);
idle_period = simple_strtol(str + 12, NULL, 0);
invert = (strncmp(str, "no-", 3) == 0) ||
(strncmp(str, "no_", 3) == 0);
if (invert)
......
......@@ -174,7 +174,12 @@ void __init smp_store_cpu_info(int id)
if ((c->x86_model==7) && (c->x86_mask==0))
goto valid_k7;
/* Athlon 662, Duron 671, and Athlon >model 7 have capability bit */
/*
* Athlon 662, Duron 671, and Athlon >model 7 have capability bit.
* It's worth noting that the A5 stepping (662) of some Athlon XP's
* have the MP bit set.
* See http://www.heise.de/newsticker/data/jow-18.10.01-000 for more.
*/
if (((c->x86_model==6) && (c->x86_mask>=2)) ||
((c->x86_model==7) && (c->x86_mask>=1)) ||
(c->x86_model> 7))
......@@ -632,7 +637,7 @@ static inline void inquire_remote_apic(int apicid)
}
#endif
static int wakeup_secondary_via_NMI(int logical_apicid)
static int __init wakeup_secondary_via_NMI(int logical_apicid)
/*
* Poke the other CPU in the eye to wake it up. Remember that the normal
* INIT, INIT, STARTUP sequence will reset the chip hard for us, and this
......@@ -680,7 +685,7 @@ static int wakeup_secondary_via_NMI(int logical_apicid)
return (send_status | accept_status);
}
static int wakeup_secondary_via_INIT(int phys_apicid, unsigned long start_eip)
static int __init wakeup_secondary_via_INIT(int phys_apicid, unsigned long start_eip)
{
unsigned long send_status = 0, accept_status = 0;
int maxlvt, timeout, num_starts, j;
......
......@@ -31,7 +31,7 @@ void *_mmx_memcpy(void *to, const void *from, size_t len)
void *p;
int i;
if (in_interrupt())
if (unlikely(in_interrupt()))
return __memcpy(to, from, len);
p = to;
......@@ -57,7 +57,7 @@ void *_mmx_memcpy(void *to, const void *from, size_t len)
: : "r" (from) );
for(; i>0; i--)
for(; i>5; i--)
{
__asm__ __volatile__ (
"1: prefetch 320(%0)\n"
......@@ -372,7 +372,7 @@ static void slow_zero_page(void * page)
void mmx_clear_page(void * page)
{
if(in_interrupt())
if(unlikely(in_interrupt()))
slow_zero_page(page);
else
fast_clear_page(page);
......@@ -392,7 +392,7 @@ static void slow_copy_page(void *to, void *from)
void mmx_copy_page(void *to, void *from)
{
if(in_interrupt())
if(unlikely(in_interrupt()))
slow_copy_page(to, from);
else
fast_copy_page(to, from);
......
......@@ -98,7 +98,7 @@ static void device_unbind(struct device * dev)
{
/* unbind from driver */
if (dev->driver && dev->driver->remove)
dev->driver->remove(dev,REMOVE_NOTIFY);
dev->driver->remove(dev);
}
static int do_driver_bind(struct device * dev, void * data)
......@@ -126,7 +126,7 @@ static int do_driver_unbind(struct device * dev, void * data)
dev->driver = NULL;
unlock_device(dev);
if (drv->remove)
drv->remove(dev,REMOVE_NOTIFY);
drv->remove(dev);
} else
unlock_device(dev);
return 0;
......@@ -134,7 +134,7 @@ static int do_driver_unbind(struct device * dev, void * data)
void driver_unbind(struct device_driver * drv)
{
// driver_for_each_dev(drv,drv,do_driver_unbind);
driver_for_each_dev(drv,drv,do_driver_unbind);
}
/**
......
......@@ -8,6 +8,39 @@
#include <linux/errno.h>
#include "base.h"
int driver_for_each_dev(struct device_driver * drv, void * data, int (*callback)(struct device *, void * ))
{
struct device * next;
struct device * dev = NULL;
struct list_head * node;
int error = 0;
get_driver(drv);
read_lock(&drv->lock);
node = drv->devices.next;
while (node != &drv->devices) {
next = list_entry(node,struct device,driver_list);
get_device(next);
read_unlock(&drv->lock);
if (dev)
put_device(dev);
dev = next;
if ((error = callback(dev,data))) {
put_device(dev);
break;
}
read_lock(&drv->lock);
node = dev->driver_list.next;
}
read_unlock(&drv->lock);
if (dev)
put_device(dev);
put_driver(drv);
return error;
}
/**
* driver_make_dir - create a driverfs directory for a driver
* @drv: driver in question
......@@ -68,5 +101,6 @@ void put_driver(struct device_driver * drv)
drv->release(drv);
}
EXPORT_SYMBOL(driver_for_each_dev);
EXPORT_SYMBOL(driver_register);
EXPORT_SYMBOL(put_driver);
......@@ -9,75 +9,6 @@
#include <linux/err.h>
#include <linux/stat.h>
/**
* device_read_status - report some device information
* @page: page-sized buffer to write into
* @count: number of bytes requested
* @off: offset into buffer
* @data: device-specific data
*
* Report some human-readable information about the device.
* This includes the name, the bus id, and the current power state.
*/
static ssize_t device_read_status(struct device * dev, char * page, size_t count, loff_t off)
{
return off ? 0 : sprintf(page,"%s\n",dev->bus_id);
}
/**
* device_write_status - forward a command to a driver
* @buf: encoded command
* @count: number of bytes in buffer
* @off: offset into buffer to start with
* @data: device-specific data
*
* Send a comamnd to a device driver.
* The following actions are supported:
* probe - scan slot for device
* remove - detach driver from slot
* suspend <state> <stage> - perform <stage> for entering <state>
* resume <stage> - perform <stage> for waking device up.
* (See Documentation/driver-model.txt for the theory of an n-stage
* suspend sequence).
*/
static ssize_t device_write_status(struct device * dev, const char* buf, size_t count, loff_t off)
{
char command[20];
int num;
int arg = 0;
int error = 0;
if (off)
return 0;
/* everything involves dealing with the driver. */
if (!dev->driver)
return 0;
num = sscanf(buf,"%10s %d",command,&arg);
if (!num)
return 0;
if (!strcmp(command,"probe")) {
if (dev->driver->probe)
error = dev->driver->probe(dev);
} else if (!strcmp(command,"remove")) {
if (dev->driver->remove)
error = dev->driver->remove(dev,REMOVE_NOTIFY);
} else
error = -EFAULT;
return error < 0 ? error : count;
}
static struct driver_file_entry device_status_entry = {
name: "status",
mode: S_IWUSR | S_IRUGO,
show: device_read_status,
store: device_write_status,
};
static ssize_t device_read_name(struct device * dev, char * buf, size_t count, loff_t off)
{
return off ? 0 : sprintf(buf,"%s\n",dev->name);
......@@ -166,7 +97,6 @@ static struct driver_file_entry device_power_entry = {
};
struct driver_file_entry * device_default_files[] = {
&device_status_entry,
&device_name_entry,
&device_power_entry,
NULL,
......
......@@ -113,7 +113,7 @@ void device_shutdown(void)
put_device(prev);
if (dev->driver && dev->driver->remove)
dev->driver->remove(dev,REMOVE_FREE_RESOURCES);
dev->driver->remove(dev);
spin_lock(&device_lock);
prev = dev;
......
......@@ -1485,10 +1485,11 @@ static int revalidate_allvol(kdev_t dev)
int ctlr, i;
unsigned long flags;
ctlr = major(dev) - MAJOR_NR;
if (minor(dev) != 0)
return -ENXIO;
ctlr = major(dev) - MAJOR_NR;
spin_lock_irqsave(IDA_LOCK(ctlr), flags);
if (hba[ctlr]->usage_count > 1) {
spin_unlock_irqrestore(IDA_LOCK(ctlr), flags);
......
......@@ -1924,9 +1924,11 @@ int __init blk_dev_init(void)
* Free request slots per queue.
* (Half for reads, half for writes)
*/
queue_nr_requests = 64;
if (total_ram > MB(32))
queue_nr_requests = 256;
queue_nr_requests = (total_ram >> 8) & ~15; /* One per quarter-megabyte */
if (queue_nr_requests < 32)
queue_nr_requests = 32;
if (queue_nr_requests > 512)
queue_nr_requests = 512;
/*
* Batch frees according to queue length
......
......@@ -24,6 +24,8 @@
* 01-3-11 Make nbd work with new Linux block layer code. It now supports
* plugging like all the other block devices. Also added in MSG_MORE to
* reduce number of partial TCP segments sent. <steve@chygwyn.com>
* 01-12-6 Fix deadlock condition by making queue locks independant of
* the transmit lock. <steve@chygwyn.com>
*
* possible FIXME: make set_sock / set_blksize / set_size / do_it one syscall
* why not: would need verify_area and friends, would share yet another
......@@ -148,27 +150,28 @@ static int nbd_xmit(int send, struct socket *sock, char *buf, int size, int msg_
#define FAIL( s ) { printk( KERN_ERR "NBD: " s "(result %d)\n", result ); goto error_out; }
void nbd_send_req(struct socket *sock, struct request *req)
void nbd_send_req(struct nbd_device *lo, struct request *req)
{
int result, rw, i, flags;
int result, i, flags;
struct nbd_request request;
unsigned long size = req->nr_sectors << 9;
struct socket *sock = lo->sock;
DEBUG("NBD: sending control, ");
rw = rq_data_dir(req);
request.magic = htonl(NBD_REQUEST_MAGIC);
request.type = htonl((rw & WRITE) ? 1 : 0);
request.type = htonl(nbd_cmd(req));
request.from = cpu_to_be64( (u64) req->sector << 9);
request.len = htonl(size);
memcpy(request.handle, &req, sizeof(req));
result = nbd_xmit(1, sock, (char *) &request, sizeof(request), rw & WRITE ? MSG_MORE : 0);
down(&lo->tx_lock);
result = nbd_xmit(1, sock, (char *) &request, sizeof(request), nbd_cmd(req) == NBD_CMD_WRITE ? MSG_MORE : 0);
if (result <= 0)
FAIL("Sendmsg failed for control.");
if (rw & WRITE) {
if (nbd_cmd(req) == NBD_CMD_WRITE) {
struct bio *bio;
/*
* we are really probing at internals to determine
......@@ -187,37 +190,59 @@ void nbd_send_req(struct socket *sock, struct request *req)
}
}
}
up(&lo->tx_lock);
return;
error_out:
up(&lo->tx_lock);
req->errors++;
}
static struct request *nbd_find_request(struct nbd_device *lo, char *handle)
{
struct request *req;
struct list_head *tmp;
struct request *xreq;
memcpy(&xreq, handle, sizeof(xreq));
spin_lock(&lo->queue_lock);
list_for_each(tmp, &lo->queue_head) {
req = list_entry(tmp, struct request, queuelist);
if (req != xreq)
continue;
list_del(&req->queuelist);
spin_unlock(&lo->queue_lock);
return req;
}
spin_unlock(&lo->queue_lock);
return NULL;
}
#define HARDFAIL( s ) { printk( KERN_ERR "NBD: " s "(result %d)\n", result ); lo->harderror = result; return NULL; }
struct request *nbd_read_stat(struct nbd_device *lo)
/* NULL returned = something went wrong, inform userspace */
{
int result;
struct nbd_reply reply;
struct request *xreq, *req;
struct request *req;
DEBUG("reading control, ");
reply.magic = 0;
result = nbd_xmit(0, lo->sock, (char *) &reply, sizeof(reply), MSG_WAITALL);
if (result <= 0)
HARDFAIL("Recv control failed.");
memcpy(&xreq, reply.handle, sizeof(xreq));
req = blkdev_entry_to_request(lo->queue_head.prev);
if (xreq != req)
FAIL("Unexpected handle received.\n");
req = nbd_find_request(lo, reply.handle);
if (req == NULL)
HARDFAIL("Unexpected reply");
DEBUG("ok, ");
if (ntohl(reply.magic) != NBD_REPLY_MAGIC)
HARDFAIL("Not enough magic.");
if (ntohl(reply.error))
FAIL("Other side returned error.");
if (rq_data_dir(req) == READ) {
if (nbd_cmd(req) == NBD_CMD_READ) {
struct bio *bio = req->bio;
DEBUG("data, ");
do {
......@@ -240,20 +265,14 @@ void nbd_do_it(struct nbd_device *lo)
{
struct request *req;
down (&lo->tx_lock);
while (1) {
up (&lo->tx_lock);
req = nbd_read_stat(lo);
down (&lo->tx_lock);
if (!req) {
printk(KERN_ALERT "req should never be null\n" );
goto out;
}
#ifdef PARANOIA
if (req != blkdev_entry_to_request(lo->queue_head.prev)) {
printk(KERN_ALERT "NBD: I have problem...\n");
}
if (lo != &nbd_dev[minor(req->rq_dev)]) {
printk(KERN_ALERT "NBD: request corrupted!\n");
continue;
......@@ -263,15 +282,10 @@ void nbd_do_it(struct nbd_device *lo)
goto out;
}
#endif
blkdev_dequeue_request(req);
up (&lo->tx_lock);
nbd_end_request(req);
down (&lo->tx_lock);
}
out:
up (&lo->tx_lock);
}
void nbd_clear_que(struct nbd_device *lo)
......@@ -285,26 +299,19 @@ void nbd_clear_que(struct nbd_device *lo)
}
#endif
while (!list_empty(&lo->queue_head)) {
req = blkdev_entry_to_request(lo->queue_head.prev);
#ifdef PARANOIA
if (!req) {
printk( KERN_ALERT "NBD: panic, panic, panic\n" );
break;
do {
req = NULL;
spin_lock(&lo->queue_lock);
if (!list_empty(&lo->queue_head)) {
req = list_entry(lo->queue_head.next, struct request, queuelist);
list_del(&req->queuelist);
}
if (lo != &nbd_dev[minor(req->rq_dev)]) {
printk(KERN_ALERT "NBD: request corrupted when clearing!\n");
continue;
spin_unlock(&lo->queue_lock);
if (req) {
req->errors++;
nbd_end_request(req);
}
#endif
req->errors++;
blkdev_dequeue_request(req);
up(&lo->tx_lock);
nbd_end_request(req);
down(&lo->tx_lock);
}
} while(req);
}
/*
......@@ -340,8 +347,12 @@ static void do_nbd_request(request_queue_t * q)
lo = &nbd_dev[dev];
if (!lo->file)
FAIL("Request when not-ready.");
if ((rq_data_dir(req) == WRITE) && (lo->flags & NBD_READ_ONLY))
FAIL("Write on read-only");
nbd_cmd(req) = NBD_CMD_READ;
if (rq_data_dir(req) == WRITE) {
nbd_cmd(req) = NBD_CMD_WRITE;
if (lo->flags & NBD_READ_ONLY)
FAIL("Write on read-only");
}
#ifdef PARANOIA
if (lo->magic != LO_MAGIC)
FAIL("nbd[] is not magical!");
......@@ -351,10 +362,11 @@ static void do_nbd_request(request_queue_t * q)
blkdev_dequeue_request(req);
spin_unlock_irq(q->queue_lock);
down (&lo->tx_lock);
spin_lock(&lo->queue_lock);
list_add(&req->queuelist, &lo->queue_head);
nbd_send_req(lo->sock, req); /* Why does this block? */
up (&lo->tx_lock);
spin_unlock(&lo->queue_lock);
nbd_send_req(lo, req);
spin_lock_irq(q->queue_lock);
continue;
......@@ -389,21 +401,23 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
lo = &nbd_dev[dev];
switch (cmd) {
case NBD_DISCONNECT:
printk("NBD_DISCONNECT\n") ;
sreq.flags = REQ_SPECIAL; /* FIXME: interpet as shutdown cmd */
if (!lo->sock) return -EINVAL ;
nbd_send_req(lo->sock,&sreq) ;
printk(KERN_INFO "NBD_DISCONNECT\n");
sreq.flags = REQ_SPECIAL;
nbd_cmd(&sreq) = NBD_CMD_DISC;
if (!lo->sock)
return -EINVAL;
nbd_send_req(lo, &sreq);
return 0 ;
case NBD_CLEAR_SOCK:
down(&lo->tx_lock);
nbd_clear_que(lo);
spin_lock(&lo->queue_lock);
if (!list_empty(&lo->queue_head)) {
up(&lo->tx_lock);
spin_unlock(&lo->queue_lock);
printk(KERN_ERR "nbd: Some requests are in progress -> can not turn off.\n");
return -EBUSY;
}
up(&lo->tx_lock);
spin_unlock(&lo->queue_lock);
file = lo->file;
if (!file)
return -EINVAL;
......@@ -525,6 +539,7 @@ static int __init nbd_init(void)
nbd_dev[i].file = NULL;
nbd_dev[i].magic = LO_MAGIC;
nbd_dev[i].flags = 0;
spin_lock_init(&nbd_dev[i].queue_lock);
INIT_LIST_HEAD(&nbd_dev[i].queue_head);
init_MUTEX(&nbd_dev[i].tx_lock);
nbd_blksizes[i] = 1024;
......
......@@ -69,7 +69,7 @@ static void reset_ctrl(void);
int ps2esdi_init(void);
static void ps2esdi_geninit(void);
static int ps2esdi_geninit(void);
static void do_ps2esdi_request(request_queue_t * q);
......@@ -168,6 +168,8 @@ static struct gendisk ps2esdi_gendisk =
int __init ps2esdi_init(void)
{
int error = 0;
/* register the device - pass the name, major number and operations
vector . */
if (devfs_register_blkdev(MAJOR_NR, "ed", &ps2esdi_fops)) {
......@@ -180,7 +182,16 @@ int __init ps2esdi_init(void)
/* some minor housekeeping - setup the global gendisk structure */
add_gendisk(&ps2esdi_gendisk);
ps2esdi_geninit();
error = ps2esdi_geninit();
if (error) {
printk(KERN_WARNING "PS2ESDI: error initialising"
" device, releasing resources\n");
devfs_unregister_blkdev(MAJOR_NR, "ed");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
del_gendisk(&ps2esdi_gendisk);
blk_clear(MAJOR_NR);
return error;
}
return 0;
} /* ps2esdi_init */
......@@ -225,7 +236,7 @@ cleanup_module(void) {
}
release_region(io_base, 4);
free_dma(dma_arb_level);
free_irq(PS2ESDI_IRQ, NULL);
free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk);
devfs_unregister_blkdev(MAJOR_NR, "ed");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
del_gendisk(&ps2esdi_gendisk);
......@@ -289,7 +300,7 @@ static int ps2esdi_getinfo(char *buf, int slot, void *d)
}
/* ps2 esdi specific initialization - called thru the gendisk chain */
static void __init ps2esdi_geninit(void)
static int __init ps2esdi_geninit(void)
{
/*
The first part contains the initialization code
......@@ -307,6 +318,7 @@ static void __init ps2esdi_geninit(void)
int slot = 0, i, reset_start, reset_end;
u_char status;
unsigned short adapterID;
int error = 0;
if ((slot = mca_find_adapter(INTG_ESDI_ID, 0)) != MCA_NOTFOUND) {
adapterID = INTG_ESDI_ID;
......@@ -321,7 +333,7 @@ static void __init ps2esdi_geninit(void)
DEVICE_NAME, slot+1);
mca_set_adapter_name(slot, "PS/2 ESDI");
} else {
return;
return -ENODEV;
}
ps2esdi_slot = slot;
......@@ -347,7 +359,8 @@ static void __init ps2esdi_geninit(void)
/* is it enabled ? */
if (!(status & STATUS_ENABLED)) {
printk("%s: ESDI adapter disabled\n", DEVICE_NAME);
return;
error = -ENODEV;
goto err_out1;
}
/* try to grab IRQ, and try to grab a slow IRQ if it fails, so we can
share with the SCSI driver */
......@@ -357,7 +370,8 @@ static void __init ps2esdi_geninit(void)
SA_SHIRQ, "PS/2 ESDI", &ps2esdi_gendisk)
) {
printk("%s: Unable to get IRQ %d\n", DEVICE_NAME, PS2ESDI_IRQ);
return;
error = -EBUSY;
goto err_out1;
}
if (status & STATUS_ALTERNATE)
io_base = ALT_IO_BASE;
......@@ -366,8 +380,8 @@ static void __init ps2esdi_geninit(void)
if (!request_region(io_base, 4, "ed")) {
printk(KERN_WARNING"Unable to request region 0x%x\n", io_base);
free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk);
return;
error = -EBUSY;
goto err_out2;
}
/* get the dma arbitration level */
dma_arb_level = (status >> 2) & 0xf;
......@@ -417,8 +431,12 @@ static void __init ps2esdi_geninit(void)
ps2esdi_gendisk.nr_real = ps2esdi_drives;
request_dma(dma_arb_level, "ed");
if (request_dma(dma_arb_level, "ed") !=0) {
printk(KERN_WARNING "PS2ESDI: Can't request dma-channel %d\n"
,(int) dma_arb_level);
error = -EBUSY;
goto err_out3;
}
blk_queue_max_sectors(BLK_DEFAULT_QUEUE(MAJOR_NR), 128);
for (i = 0; i < ps2esdi_drives; i++) {
......@@ -428,6 +446,18 @@ static void __init ps2esdi_geninit(void)
ps2esdi_info[i].cyl);
ps2esdi_valid[i] = 1;
}
return 0;
err_out3:
release_region(io_base, 4);
err_out2:
free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk);
err_out1:
if(ps2esdi_slot) {
mca_mark_as_unused(ps2esdi_slot);
mca_set_adapter_procfn(ps2esdi_slot, NULL, NULL);
}
return error;
}
static void __init ps2esdi_get_device_cfg(void)
......
......@@ -107,6 +107,8 @@ static XD_SIGNATURE xd_sigs[] __initdata = {
{ 0x0010,"ST11 BIOS v1.7",xd_seagate_init_controller,xd_seagate_init_drive," Seagate ST11R" }, /* Alan Hourihane, alanh@fairlite.demon.co.uk */
{ 0x1000,"(c)Copyright 1987 SMS",xd_omti_init_controller,xd_omti_init_drive,"n OMTI 5520" }, /* Dirk Melchers, dirk@merlin.nbg.sub.org */
{ 0x0006,"COPYRIGHT XEBEC (C) 1984",xd_xebec_init_controller,xd_xebec_init_drive," XEBEC" }, /* Andrzej Krzysztofowicz, ankry@mif.pg.gda.pl */
{ 0x0008,"(C) Copyright 1984 Western Digital Corp", xd_wd_init_controller, xd_wd_init_drive," Western Dig. 1002s-wx2" },
{ 0x0008,"(C) Copyright 1986 Western Digital Corporation", xd_wd_init_controller, xd_wd_init_drive," 1986 Western Digital" }, /* jfree@sovereign.org */
};
static unsigned int xd_bases[] __initdata =
......
......@@ -1724,16 +1724,18 @@ int __init aztcd_init(void)
long int count, max_count;
unsigned char result[50];
int st;
void* status = NULL;
int i = 0;
int ret = 0;
if (azt_port == 0) {
printk("aztcd: no Aztech CD-ROM Initialization");
printk(KERN_INFO "aztcd: no Aztech CD-ROM Initialization");
return -EIO;
}
printk
("aztcd: AZTECH, ORCHID, OKANO, WEARNES, TXC, CyDROM CD-ROM Driver\n");
printk("aztcd: (C) 1994-98 W.Zimmermann\n");
printk(KERN_INFO "aztcd: AZTECH, ORCHID, OKANO, WEARNES, TXC, CyDROM "
"CD-ROM Driver\n");
printk(KERN_INFO "aztcd: (C) 1994-98 W.Zimmermann\n");
if (azt_port == -1) {
printk
("aztcd: KernelVersion=%s DriverVersion=%s For IDE/ATAPI-drives use ide-cd.c\n",
......@@ -1742,8 +1744,8 @@ int __init aztcd_init(void)
printk
("aztcd: DriverVersion=%s BaseAddress=0x%x For IDE/ATAPI-drives use ide-cd.c\n",
AZT_VERSION, azt_port);
printk
("aztcd: If you have problems, read /usr/src/linux/Documentation/cdrom/aztcd\n");
printk(KERN_INFO "aztcd: If you have problems, read /usr/src/linux/"
"Documentation/cdrom/aztcd\n");
#ifdef AZT_SW32 /*CDROM connected to Soundwave32 card */
......@@ -1764,15 +1766,15 @@ int __init aztcd_init(void)
/* check for presence of drive */
if (azt_port == -1) { /* autoprobing */
if (azt_port == -1) { /* autoprobing for proprietary interface */
for (i = 0; (azt_port_auto[i] != 0) && (i < 16); i++) {
azt_port = azt_port_auto[i];
printk("aztcd: Autoprobing BaseAddress=0x%x \n",
azt_port);
st = check_region(azt_port, 4); /*proprietary interfaces need 4 bytes */
if (st)
printk(KERN_INFO "aztcd: Autoprobing BaseAddress=0x%x"
"\n", azt_port);
/*proprietary interfaces need 4 bytes */
if (!request_region(azt_port, 4, "aztcd")) {
continue;
}
outb(POLLED, MODE_PORT);
inb(CMD_PORT);
inb(CMD_PORT);
......@@ -1785,22 +1787,25 @@ int __init aztcd_init(void)
if (aztTimeOutCount >= AZT_FAST_TIMEOUT)
break;
} while (aztIndatum & AFL_STATUS);
if (inb(DATA_PORT) == AFL_OP_OK)
if (inb(DATA_PORT) == AFL_OP_OK) { /* OK drive found */
break;
}
else { /* Drive not found on this port - try next one */
release_region(azt_port, 4);
}
}
if ((azt_port_auto[i] == 0) || (i == 16)) {
printk("aztcd: no AZTECH CD-ROM drive found\n");
printk(KERN_INFO "aztcd: no AZTECH CD-ROM drive found\n");
return -EIO;
}
} else { /* no autoprobing */
if ((azt_port == 0x1f0) || (azt_port == 0x170))
st = check_region(azt_port, 8); /*IDE-interfaces need 8 bytes */
status = request_region(azt_port, 8, "aztcd"); /*IDE-interfaces need 8 bytes */
else
st = check_region(azt_port, 4); /*proprietary interfaces need 4 bytes */
if (st) {
printk
("aztcd: conflict, I/O port (%X) already used\n",
azt_port);
status = request_region(azt_port, 4, "aztcd"); /*proprietary interfaces need 4 bytes */
if (!status) {
printk(KERN_WARNING "aztcd: conflict, I/O port (%X) "
"already used\n", azt_port);
return -EIO;
}
......@@ -1823,17 +1828,19 @@ int __init aztcd_init(void)
if (inb(DATA_PORT) != AFL_OP_OK) { /*OP_OK? If not, reset and try again */
#ifndef MODULE
if (azt_cont != 0x79) {
printk
("aztcd: no AZTECH CD-ROM drive found-Try boot parameter aztcd=<BaseAddress>,0x79\n");
return -EIO;
printk(KERN_WARNING "aztcd: no AZTECH CD-ROM "
"drive found-Try boot parameter aztcd="
"<BaseAddress>,0x79\n");
ret = -EIO;
goto err_out;
}
#else
if (0) {
}
#endif
else {
printk
("aztcd: drive reset - please wait\n");
printk(KERN_INFO "aztcd: drive reset - "
"please wait\n");
for (count = 0; count < 50; count++) {
inb(STATUS_PORT); /*removing all data from earlier tries */
inb(DATA_PORT);
......@@ -1845,9 +1852,10 @@ int __init aztcd_init(void)
outb(ACMD_SOFT_RESET, CMD_PORT); /*send reset */
STEN_LOW;
if (inb(DATA_PORT) != AFL_OP_OK) { /*OP_OK? */
printk
("aztcd: no AZTECH CD-ROM drive found\n");
return -EIO;
printk(KERN_WARNING "aztcd: no AZTECH "
"CD-ROM drive found\n");
ret = -EIO;
goto err_out;
}
for (count = 0; count < AZT_TIMEOUT;
......@@ -1855,13 +1863,13 @@ int __init aztcd_init(void)
barrier(); /* Stop gcc 2.96 being smart */
if ((st = getAztStatus()) == -1) {
printk
("aztcd: Drive Status Error Status=%x\n",
st);
return -EIO;
printk(KERN_WARNING "aztcd: Drive Status"
" Error Status=%x\n", st);
ret = -EIO;
goto err_out;
}
#ifdef AZT_DEBUG
printk("aztcd: Status = %x\n", st);
printk(KERN_DEBUG "aztcd: Status = %x\n", st);
#endif
outb(POLLED, MODE_PORT);
inb(CMD_PORT);
......@@ -1916,29 +1924,34 @@ int __init aztcd_init(void)
printk("%c", result[count]);
printk("<<>> ");
printk("Aborted\n");
return -EIO;
ret = -EIO;
goto err_out;
}
}
devfs_register(NULL, "aztcd", DEVFS_FL_DEFAULT, MAJOR_NR, 0,
S_IFBLK | S_IRUGO | S_IWUGO, &azt_fops, NULL);
if (devfs_register_blkdev(MAJOR_NR, "aztcd", &azt_fops) != 0) {
printk("aztcd: Unable to get major %d for Aztech CD-ROM\n",
MAJOR_NR);
return -EIO;
printk(KERN_WARNING "aztcd: Unable to get major %d for Aztech"
" CD-ROM\n", MAJOR_NR);
ret = -EIO;
goto err_out;
}
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_aztcd_request, &aztSpin);
blk_queue_hardsect_size(BLK_DEFAULT_QUEUE(MAJOR_NR), 2048);
register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &azt_fops, 0);
if ((azt_port == 0x1f0) || (azt_port == 0x170))
request_region(azt_port, 8, "aztcd"); /*IDE-interface */
else
request_region(azt_port, 4, "aztcd"); /*proprietary interface */
azt_invalidate_buffers();
aztPresent = 1;
aztCloseDoor();
return (0);
err_out:
if ((azt_port == 0x1f0) || (azt_port == 0x170)) {
SWITCH_IDE_MASTER;
release_region(azt_port, 8); /*IDE-interface */
} else
release_region(azt_port, 4); /*proprietary interface */
return ret;
}
void __exit aztcd_exit(void)
......
......@@ -941,7 +941,7 @@ void __exit exit_gscd(void)
return;
}
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
release_region(gscd_port, 4);
release_region(gscd_port, GSCD_IO_EXTENT);
printk(KERN_INFO "GoldStar-module released.\n");
}
......@@ -964,16 +964,16 @@ int __init my_gscd_init(void)
{
int i;
int result;
int ret=0;
printk(KERN_INFO "GSCD: version %s\n", GSCD_VERSION);
printk(KERN_INFO
"GSCD: Trying to detect a Goldstar R420 CD-ROM drive at 0x%X.\n",
gscd_port);
if (check_region(gscd_port, 4)) {
printk
("GSCD: Init failed, I/O port (%X) already in use.\n",
gscd_port);
if (!request_region(gscd_port, GSCD_IO_EXTENT, "gscd")) {
printk(KERN_WARNING "GSCD: Init failed, I/O port (%X) already"
" in use.\n", gscd_port);
return -EIO;
}
......@@ -981,24 +981,27 @@ int __init my_gscd_init(void)
/* check for card */
result = wait_drv_ready();
if (result == 0x09) {
printk("GSCD: DMA kann ich noch nicht!\n");
return -EIO;
printk(KERN_WARNING "GSCD: DMA kann ich noch nicht!\n");
ret = -EIO;
goto err_out1;
}
if (result == 0x0b) {
drv_mode = result;
i = find_drives();
if (i == 0) {
printk
("GSCD: GoldStar CD-ROM Drive is not found.\n");
return -EIO;
printk(KERN_WARNING "GSCD: GoldStar CD-ROM Drive is"
" not found.\n");
ret = -EIO;
goto err_out1;
}
}
if ((result != 0x0b) && (result != 0x09)) {
printk
("GSCD: GoldStar Interface Adapter does not exist or H/W error\n");
return -EIO;
printk(KERN_WARNING "GSCD: GoldStar Interface Adapter does not "
"exist or H/W error\n");
ret = -EIO;
goto err_out1;
}
/* reset all drives */
......@@ -1012,10 +1015,10 @@ int __init my_gscd_init(void)
}
if (devfs_register_blkdev(MAJOR_NR, "gscd", &gscd_fops) != 0) {
printk
("GSCD: Unable to get major %d for GoldStar CD-ROM\n",
MAJOR_NR);
return -EIO;
printk(KERN_WARNING "GSCD: Unable to get major %d for GoldStar "
"CD-ROM\n", MAJOR_NR);
ret = -EIO;
goto err_out1;
}
devfs_register(NULL, "gscd", DEVFS_FL_DEFAULT, MAJOR_NR, 0,
S_IFBLK | S_IRUGO | S_IWUGO, &gscd_fops, NULL);
......@@ -1025,11 +1028,13 @@ int __init my_gscd_init(void)
disk_state = 0;
gscdPresent = 1;
request_region(gscd_port, 4, "gscd");
register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &gscd_fops, 0);
printk(KERN_INFO "GSCD: GoldStar CD-ROM Drive found.\n");
return 0;
err_out1:
release_region(gscd_port, GSCD_IO_EXTENT);
return ret;
}
static void gscd_hsg2msf(long hsg, struct msf *msf)
......
......@@ -15,11 +15,10 @@
Appropriate settings are: 0x300, 0x310, 0x320, 0x330, 0x340, 0x350, 0x360
0x370, 0x380, 0x390, 0x3A0, 0x3B0, 0x3C0, 0x3D0, 0x3E0, 0x3F0 */
/* insert here the I/O port address */
/* insert here the I/O port address and extent */
#define GSCD_BASE_ADDR 0x340
#define GSCD_IO_EXTENT 4
/* change this to set the dma-channel */
#define GSCD_DMA_CHANNEL 3 /* not used */
/************** nothing to set up below here *********************/
......
......@@ -172,6 +172,12 @@ struct agp_bridge_data {
#ifndef PCI_DEVICE_ID_INTEL_810_0
#define PCI_DEVICE_ID_INTEL_810_0 0x7120
#endif
#ifndef PCI_DEVICE_ID_INTEL_845_G_0
#define PCI_DEVICE_ID_INTEL_845_G_0 0x2560
#endif
#ifndef PCI_DEVICE_ID_INTEL_845_G_1
#define PCI_DEVICE_ID_INTEL_845_G_1 0x2562
#endif
#ifndef PCI_DEVICE_ID_INTEL_830_M_0
#define PCI_DEVICE_ID_INTEL_830_M_0 0x3575
#endif
......
This diff is collapsed.
......@@ -418,12 +418,11 @@ static int __init dtlk_dev_probe(void)
dtlk_portlist[i], (testval = inw_p(dtlk_portlist[i])));
#endif
if (check_region(dtlk_portlist[i], DTLK_IO_EXTENT))
if (!request_region(dtlk_portlist[i], DTLK_IO_EXTENT,
"dtlk"))
continue;
testval = inw_p(dtlk_portlist[i]);
if ((testval &= 0xfbff) == 0x107f) {
request_region(dtlk_portlist[i], DTLK_IO_EXTENT,
"dtlk");
dtlk_port_lpc = dtlk_portlist[i];
dtlk_port_tts = dtlk_port_lpc + 1;
......@@ -508,6 +507,7 @@ for (i = 0; i < 10; i++) \
return 0;
}
release_region(dtlk_portlist[i], DTLK_IO_EXTENT);
}
printk(KERN_INFO "\nDoubleTalk PC - not found\n");
......
......@@ -375,9 +375,14 @@ efi_rtc_read_proc(char *page, char **start, off_t off,
static int __init
efi_rtc_init(void)
{
int ret =0;
printk(KERN_INFO "EFI Time Services Driver v%s\n", EFI_RTC_VERSION);
misc_register(&efi_rtc_dev);
ret = misc_register(&efi_rtc_dev);
if (ret) {
printk(KERN_ERR "driver/efirtc: can't misc_register on minor=%d\n", EFI_RTC_MINOR);
return ret;
}
create_proc_read_entry ("driver/efirtc", 0, NULL, efi_rtc_read_proc, NULL);
......
......@@ -2022,7 +2022,8 @@ static void post_fep_init(unsigned int crd)
(*(ushort *)((ulong)memaddr + XEPORTS) < 3))
shrinkmem = 1;
if (bd->type < PCIXEM)
request_region((int)bd->port, 4, board_desc[bd->type]);
if (!request_region((int)bd->port, 4, board_desc[bd->type]))
return;
memwinon(bd, 0);
......@@ -2186,9 +2187,13 @@ static void post_fep_init(unsigned int crd)
if (!(ch->tmp_buf))
{
printk(KERN_ERR "POST FEP INIT : kmalloc failed for port 0x%x\n",i);
release_region((int)bd->port, 4);
while(i-- > 0)
kfree((ch--)->tmp_buf);
return;
}
memset((void *)ch->tmp_buf,0,ch->txbufsize);
else
memset((void *)ch->tmp_buf,0,ch->txbufsize);
} /* End for each port */
printk(KERN_INFO
......
......@@ -2476,9 +2476,13 @@ static _INLINE_ int autoconfig(struct esp_struct * info, int *region_start)
} else
*region_start = info->port;
request_region(*region_start,
if (!request_region(*region_start,
info->port - *region_start + 8,
"esp serial");
"esp serial"))
{
restore_flags(flags);
return -EIO;
}
/* put card in enhanced mode */
/* this prevents access through */
......
......@@ -299,9 +299,13 @@ static int __init h8_init(void)
}
printk(KERN_INFO "H8 at 0x%x IRQ %d\n", h8_base, h8_irq);
create_proc_info_entry("driver/h8", 0, NULL, h8_get_info);
if (!request_region(h8_base, 8, "h8"))
{
free_irq(h8_irq, NULL);
return -EIO;
}
request_region(h8_base, 8, "h8");
create_proc_info_entry("driver/h8", 0, NULL, h8_get_info);
h8_alloc_queues();
......
......@@ -271,11 +271,21 @@ ibwdt_init(void)
ibwdt_validate_timeout();
spin_lock_init(&ibwdt_lock);
misc_register(&ibwdt_miscdev);
if (misc_register(&ibwdt_miscdev))
return -ENODEV;
#if WDT_START != WDT_STOP
request_region(WDT_STOP, 1, "IB700 WDT");
if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
misc_deregister(&ibwdt_miscdev);
return -EIO;
}
#endif
if (!request_region(WDT_START, 1, "IB700 WDT")) {
#if WDT_START != WDT_STOP
release_region(WDT_STOP, 1);
#endif
request_region(WDT_START, 1, "IB700 WDT");
misc_deregister(&ibwdt_miscdev);
return -EIO;
}
register_reboot_notifier(&ibwdt_notifier);
return 0;
}
......
......@@ -1680,20 +1680,13 @@ static int register_ioregion(void)
{
int count, done=0;
for (count=0; count < BOARD_COUNT; count++ ) {
if (isi_card[count].base) {
if (check_region(isi_card[count].base,16)) {
if (isi_card[count].base)
if (!request_region(isi_card[count].base,16,ISICOM_NAME)) {
printk(KERN_DEBUG "ISICOM: I/O Region 0x%x-0x%x is busy. Card%d will be disabled.\n",
isi_card[count].base,isi_card[count].base+15,count+1);
isi_card[count].base=0;
}
else {
request_region(isi_card[count].base,16,ISICOM_NAME);
#ifdef ISICOM_DEBUG
printk(KERN_DEBUG "ISICOM: I/O Region 0x%x-0x%x requested for Card%d.\n",isi_card[count].base,isi_card[count].base+15,count+1);
#endif
done++;
}
}
}
return done;
}
......
......@@ -3972,17 +3972,16 @@ static inline int stli_initecp(stlibrd_t *brdp)
printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp);
#endif
/*
* Do a basic sanity check on the IO and memory addresses.
*/
if (!request_region(brdp->iobase, brdp->iosize, name))
return -EIO;
if ((brdp->iobase == 0) || (brdp->memaddr == 0))
{
release_region(brdp->iobase, brdp->iosize);
return(-ENODEV);
}
brdp->iosize = ECP_IOSIZE;
if (check_region(brdp->iobase, brdp->iosize))
printk(KERN_ERR "STALLION: Warning, board %d I/O address %x "
"conflicts with another device\n",
brdp->brdnr, brdp->iobase);
/*
* Based on the specific board type setup the common vars to access
......@@ -4047,6 +4046,7 @@ static inline int stli_initecp(stlibrd_t *brdp)
break;
default:
release_region(brdp->iobase, brdp->iosize);
return(-EINVAL);
}
......@@ -4060,7 +4060,10 @@ static inline int stli_initecp(stlibrd_t *brdp)
brdp->membase = ioremap(brdp->memaddr, brdp->memsize);
if (brdp->membase == (void *) NULL)
{
release_region(brdp->iobase, brdp->iosize);
return(-ENOMEM);
}
/*
* Now that all specific code is set up, enable the shared memory and
......@@ -4082,7 +4085,10 @@ static inline int stli_initecp(stlibrd_t *brdp)
#endif
if (sig.magic != ECP_MAGIC)
{
release_region(brdp->iobase, brdp->iosize);
return(-ENODEV);
}
/*
* Scan through the signature looking at the panels connected to the
......@@ -4103,7 +4109,7 @@ static inline int stli_initecp(stlibrd_t *brdp)
brdp->nrpanels++;
}
request_region(brdp->iobase, brdp->iosize, name);
brdp->state |= BST_FOUND;
return(0);
}
......@@ -4133,10 +4139,9 @@ static inline int stli_initonb(stlibrd_t *brdp)
return(-ENODEV);
brdp->iosize = ONB_IOSIZE;
if (check_region(brdp->iobase, brdp->iosize))
printk(KERN_ERR "STALLION: Warning, board %d I/O address %x "
"conflicts with another device\n",
brdp->brdnr, brdp->iobase);
if (!request_region(brdp->iobase, brdp->iosize, name))
return -EIO;
/*
* Based on the specific board type setup the common vars to access
......@@ -4211,6 +4216,7 @@ static inline int stli_initonb(stlibrd_t *brdp)
break;
default:
release_region(brdp->iobase, brdp->iosize);
return(-EINVAL);
}
......@@ -4224,7 +4230,10 @@ static inline int stli_initonb(stlibrd_t *brdp)
brdp->membase = ioremap(brdp->memaddr, brdp->memsize);
if (brdp->membase == (void *) NULL)
{
release_region(brdp->iobase, brdp->iosize);
return(-ENOMEM);
}
/*
* Now that all specific code is set up, enable the shared memory and
......@@ -4244,7 +4253,10 @@ static inline int stli_initonb(stlibrd_t *brdp)
if ((sig.magic0 != ONB_MAGIC0) || (sig.magic1 != ONB_MAGIC1) ||
(sig.magic2 != ONB_MAGIC2) || (sig.magic3 != ONB_MAGIC3))
{
release_region(brdp->iobase, brdp->iosize);
return(-ENODEV);
}
/*
* Scan through the signature alive mask and calculate how many ports
......@@ -4262,7 +4274,7 @@ static inline int stli_initonb(stlibrd_t *brdp)
}
brdp->panels[0] = brdp->nrports;
request_region(brdp->iobase, brdp->iosize, name);
brdp->state |= BST_FOUND;
return(0);
}
......
......@@ -391,13 +391,14 @@ int __init ite_gpio_init(void)
{
int i;
misc_register(&ite_gpio_miscdev);
if (misc_register(&ite_gpio_miscdev))
return -ENODEV;
if (check_region(ite_gpio_base, 0x1c) < 0 ) {
return -ENODEV;
} else {
request_region(ite_gpio_base, 0x1c, "ITE GPIO");
}
if (!request_region(ite_gpio_base, 0x1c, "ITE GPIO"))
{
misc_deregister(&ite_gpio_miscdev);
return -EIO;
}
/* initialize registers */
ITE_GPACR = 0xffff;
......@@ -407,13 +408,18 @@ int __init ite_gpio_init(void)
ITE_GPBICR = 0x00ff;
ITE_GPCICR = 0x00ff;
ITE_GCR = 0;
for (i = 0; i < MAX_GPIO_LINE; i++) {
ite_gpio_irq_pending[i]=0;
init_waitqueue_head(&ite_gpio_wait[i]);
}
if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, SA_SHIRQ, "gpio", 0) < 0)
if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, SA_SHIRQ, "gpio", 0) < 0) {
misc_deregister(&ite_gpio_miscdev);
release_region(ite_gpio_base, 0x1c);
return 0;
}
printk("GPIO at 0x%x (irq = %d)\n", ite_gpio_base, ite_gpio_irq);
return 0;
......
......@@ -247,11 +247,15 @@ static int __init mixcomwd_init(void)
return -ENODEV;
}
request_region(watchdog_port,1,"MixCOM watchdog");
if (!request_region(watchdog_port,1,"MixCOM watchdog"))
return -EIO;
ret = misc_register(&mixcomwd_miscdev);
if (ret)
{
release_region(watchdog_port, 1);
return ret;
}
printk(KERN_INFO "MixCOM watchdog driver v%s, watchdog port at 0x%3x\n",VERSION,watchdog_port);
......
......@@ -34,6 +34,7 @@ ssize_t raw_write(struct file *, const char *, size_t, loff_t *);
int raw_open(struct inode *, struct file *);
int raw_release(struct inode *, struct file *);
int raw_ctl_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
int raw_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
static struct file_operations raw_fops = {
......@@ -41,6 +42,7 @@ static struct file_operations raw_fops = {
write: raw_write,
open: raw_open,
release: raw_release,
ioctl: raw_ioctl,
};
static struct file_operations raw_ctl_fops = {
......@@ -143,6 +145,25 @@ int raw_release(struct inode *inode, struct file *filp)
/* Forward ioctls to the underlying block device. */
int raw_ioctl(struct inode *inode,
struct file *flip,
unsigned int command,
unsigned long arg)
{
int minor = minor(inode->i_rdev), err;
struct block_device *b;
if (minor < 1 && minor > 255)
return -ENODEV;
b = raw_devices[minor].binding;
err = -EINVAL;
if (b && b->bd_inode && b->bd_op && b->bd_op->ioctl) {
err = b->bd_op->ioctl(b->bd_inode, NULL, command, arg);
}
return err;
}
/*
* Deal with ioctls against the raw-device control interface, to bind
* and unbind other raw devices.
......
......@@ -69,6 +69,7 @@
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <linux/sysctl.h>
#include <asm/io.h>
#include <asm/uaccess.h>
......@@ -140,6 +141,7 @@ static int rtc_read_proc(char *page, char **start, off_t off,
static unsigned long rtc_status = 0; /* bitmapped status byte. */
static unsigned long rtc_freq = 0; /* Current periodic IRQ rate */
static unsigned long rtc_irq_data = 0; /* our output to the world */
static unsigned long rtc_max_user_freq = 64; /* > this, need CAP_SYS_RESOURCE */
#if RTC_IRQ
static spinlock_t rtc_task_lock = SPIN_LOCK_UNLOCKED;
......@@ -197,6 +199,38 @@ static void rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
#endif
/*
* sysctl-tuning infrastructure.
*/
static ctl_table rtc_table[] = {
{ 1, "max-user-freq", &rtc_max_user_freq, sizeof(int), 0644, NULL,
&proc_dointvec, NULL, },
{ 0, }
};
static ctl_table rtc_root[] = {
{ 1, "rtc", NULL, 0, 0555, rtc_table, },
{ 0, }
};
static ctl_table dev_root[] = {
{ CTL_DEV, "dev", NULL, 0, 0555, rtc_root, },
{ 0, }
};
static struct ctl_table_header *sysctl_header;
static int __init init_sysctl(void)
{
sysctl_header = register_sysctl_table(dev_root, 0);
return 0;
}
static void __exit cleanup_sysctl(void)
{
unregister_sysctl_table(sysctl_header);
}
/*
* Now all the various file operations that we export.
*/
......@@ -305,7 +339,8 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
* We don't really want Joe User enabling more
* than 64Hz of interrupts on a multi-user machine.
*/
if (!kernel && (rtc_freq > 64) && (!capable(CAP_SYS_RESOURCE)))
if (!kernel && (rtc_freq > rtc_max_user_freq) &&
(!capable(CAP_SYS_RESOURCE)))
return -EACCES;
if (!(rtc_status & RTC_TIMER_ON)) {
......@@ -503,7 +538,7 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
* We don't really want Joe User generating more
* than 64Hz of interrupts on a multi-user machine.
*/
if (!kernel && (arg > 64) && (!capable(CAP_SYS_RESOURCE)))
if (!kernel && (arg > rtc_max_user_freq) && (!capable(CAP_SYS_RESOURCE)))
return -EACCES;
while (arg > (1<<tmp))
......@@ -833,7 +868,12 @@ static int __init rtc_init(void)
#endif /* __sparc__ vs. others */
misc_register(&rtc_dev);
if (misc_register(&rtc_dev))
{
free_irq(RTC_IRQ, NULL);
release_region(RTC_PORT(0), RTC_IO_EXTENT);
return -ENODEV;
}
create_proc_read_entry ("driver/rtc", 0, 0, rtc_read_proc, NULL);
#if defined(__alpha__) || defined(__mips__)
......@@ -893,6 +933,8 @@ static int __init rtc_init(void)
no_irq2:
#endif
(void) init_sysctl();
printk(KERN_INFO "Real Time Clock Driver v" RTC_VERSION "\n");
return 0;
......@@ -900,6 +942,7 @@ static int __init rtc_init(void)
static void __exit rtc_exit (void)
{
cleanup_sysctl();
remove_proc_entry ("driver/rtc", NULL);
misc_deregister(&rtc_dev);
......
......@@ -13,9 +13,10 @@
* any of this software. This material is provided "AS-IS" in
* the hope that it may be useful for others.
*
* (c) Copyright 2001 Scott Jennings <management@oro.net>
* (c) Copyright 2001 Scott Jennings <linuxdrivers@oro.net>
*
* 4/19 - 2001 [Initial revision]
* 9/27 - 2001 Added spinlocking
*
*
* Theory of operation:
......@@ -88,8 +89,9 @@
static void wdt_timer_ping(unsigned long);
static struct timer_list timer;
static unsigned long next_heartbeat;
static int wdt_is_open;
static unsigned long wdt_is_open;
static int wdt_expect_close;
static spinlock_t wdt_spinlock;
/*
* Whack the dog
......@@ -102,11 +104,18 @@ static void wdt_timer_ping(unsigned long data)
*/
if(time_before(jiffies, next_heartbeat))
{
/* Ping the WDT */
spin_lock(&wdt_spinlock);
/* Ping the WDT by reading from WDT_PING */
inb_p(WDT_PING);
/* Re-set the timer interval */
timer.expires = jiffies + WDT_INTERVAL;
add_timer(&timer);
spin_unlock(&wdt_spinlock);
} else {
printk(OUR_NAME ": Heartbeat lost! Will not ping the watchdog\n");
}
......@@ -118,19 +127,24 @@ static void wdt_timer_ping(unsigned long data)
static void wdt_change(int writeval)
{
unsigned long flags;
spin_lock_irqsave(&wdt_spinlock, flags);
/* buy some time */
inb_p(WDT_PING);
/* make W83877F available */
outb_p(ENABLE_W83877F,ENABLE_W83877F_PORT);
outb_p(ENABLE_W83877F,ENABLE_W83877F_PORT);
outb_p(ENABLE_W83877F, ENABLE_W83877F_PORT);
outb_p(ENABLE_W83877F, ENABLE_W83877F_PORT);
/* enable watchdog */
outb_p(WDT_REGISTER,ENABLE_W83877F_PORT);
outb_p(writeval,ENABLE_W83877F_PORT+1);
outb_p(WDT_REGISTER, ENABLE_W83877F_PORT);
outb_p(writeval, ENABLE_W83877F_PORT+1);
/* lock the W8387FF away */
outb_p(DISABLE_W83877F,ENABLE_W83877F_PORT);
outb_p(DISABLE_W83877F, ENABLE_W83877F_PORT);
spin_unlock_irqrestore(&wdt_spinlock, flags);
}
static void wdt_startup(void)
......@@ -178,7 +192,7 @@ static ssize_t fop_write(struct file * file, const char * buf, size_t count, lof
/* now scan */
for(ofs = 0; ofs != count; ofs++)
if(buf[ofs] == 'V')
if(buf[ofs] == 'V')
wdt_expect_close = 1;
/* someone wrote to us, we should restart timer */
......@@ -200,10 +214,10 @@ static int fop_open(struct inode * inode, struct file * file)
{
case WATCHDOG_MINOR:
/* Just in case we're already talking to someone... */
if(wdt_is_open)
if(test_and_set_bit(0, &wdt_is_open)) {
return -EBUSY;
}
/* Good, fire up the show */
wdt_is_open = 1;
wdt_startup();
return 0;
......@@ -305,6 +319,8 @@ static int __init w83877f_wdt_init(void)
{
int rc = -EBUSY;
spin_lock_init(&wdt_spinlock);
if (!request_region(ENABLE_W83877F_PORT, 2, "W83877F WDT"))
goto err_out;
if (!request_region(WDT_PING, 1, "W8387FF WDT"))
......@@ -339,4 +355,7 @@ static int __init w83877f_wdt_init(void)
module_init(w83877f_wdt_init);
module_exit(w83877f_wdt_unload);
MODULE_AUTHOR("Scott and Bill Jennings");
MODULE_DESCRIPTION("Driver for watchdog timer in w83877f chip");
MODULE_LICENSE("GPL");
EXPORT_NO_SYMBOLS;
......@@ -29,215 +29,9 @@
#include "ata-timing.h"
#include "pcihost.h"
#undef DISPLAY_ALI_TIMINGS
#if defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
static int ali_get_info(char *buffer, char **addr, off_t offset, int count);
extern int (*ali_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static struct pci_dev *bmide_dev;
char *fifo[4] = {
"FIFO Off",
"FIFO On ",
"DMA mode",
"PIO mode" };
char *udmaT[8] = {
"1.5T",
" 2T",
"2.5T",
" 3T",
"3.5T",
" 4T",
" 6T",
" 8T"
};
char *channel_status[8] = {
"OK ",
"busy ",
"DRQ ",
"DRQ busy ",
"error ",
"error busy ",
"error DRQ ",
"error DRQ busy"
};
static int ali_get_info (char *buffer, char **addr, off_t offset, int count)
{
byte reg53h, reg5xh, reg5yh, reg5xh1, reg5yh1;
unsigned int bibma;
byte c0, c1;
byte rev, tmp;
char *p = buffer;
char *q;
/* fetch rev. */
pci_read_config_byte(bmide_dev, 0x08, &rev);
if (rev >= 0xc1) /* M1543C or newer */
udmaT[7] = " ???";
else
fifo[3] = " ??? ";
/* first fetch bibma: */
pci_read_config_dword(bmide_dev, 0x20, &bibma);
bibma = (bibma & 0xfff0) ;
/*
* at that point bibma+0x2 et bibma+0xa are byte
* registers to investigate:
*/
c0 = inb((unsigned short)bibma + 0x02);
c1 = inb((unsigned short)bibma + 0x0a);
p += sprintf(p,
"\n Ali M15x3 Chipset.\n");
p += sprintf(p,
" ------------------\n");
pci_read_config_byte(bmide_dev, 0x78, &reg53h);
p += sprintf(p, "PCI Clock: %d.\n", reg53h);
pci_read_config_byte(bmide_dev, 0x53, &reg53h);
p += sprintf(p,
"CD_ROM FIFO:%s, CD_ROM DMA:%s\n",
(reg53h & 0x02) ? "Yes" : "No ",
(reg53h & 0x01) ? "Yes" : "No " );
pci_read_config_byte(bmide_dev, 0x74, &reg53h);
p += sprintf(p,
"FIFO Status: contains %d Words, runs%s%s\n\n",
(reg53h & 0x3f),
(reg53h & 0x40) ? " OVERWR" : "",
(reg53h & 0x80) ? " OVERRD." : "." );
p += sprintf(p,
"-------------------primary channel-------------------secondary channel---------\n\n");
pci_read_config_byte(bmide_dev, 0x09, &reg53h);
p += sprintf(p,
"channel status: %s %s\n",
(reg53h & 0x20) ? "On " : "Off",
(reg53h & 0x10) ? "On " : "Off" );
p += sprintf(p,
"both channels togth: %s %s\n",
(c0&0x80) ? "No " : "Yes",
(c1&0x80) ? "No " : "Yes" );
pci_read_config_byte(bmide_dev, 0x76, &reg53h);
p += sprintf(p,
"Channel state: %s %s\n",
channel_status[reg53h & 0x07],
channel_status[(reg53h & 0x70) >> 4] );
pci_read_config_byte(bmide_dev, 0x58, &reg5xh);
pci_read_config_byte(bmide_dev, 0x5c, &reg5yh);
p += sprintf(p,
"Add. Setup Timing: %dT %dT\n",
(reg5xh & 0x07) ? (reg5xh & 0x07) : 8,
(reg5yh & 0x07) ? (reg5yh & 0x07) : 8 );
pci_read_config_byte(bmide_dev, 0x59, &reg5xh);
pci_read_config_byte(bmide_dev, 0x5d, &reg5yh);
p += sprintf(p,
"Command Act. Count: %dT %dT\n"
"Command Rec. Count: %dT %dT\n\n",
(reg5xh & 0x70) ? ((reg5xh & 0x70) >> 4) : 8,
(reg5yh & 0x70) ? ((reg5yh & 0x70) >> 4) : 8,
(reg5xh & 0x0f) ? (reg5xh & 0x0f) : 16,
(reg5yh & 0x0f) ? (reg5yh & 0x0f) : 16 );
p += sprintf(p,
"----------------drive0-----------drive1------------drive0-----------drive1------\n\n");
p += sprintf(p,
"DMA enabled: %s %s %s %s\n",
(c0&0x20) ? "Yes" : "No ",
(c0&0x40) ? "Yes" : "No ",
(c1&0x20) ? "Yes" : "No ",
(c1&0x40) ? "Yes" : "No " );
pci_read_config_byte(bmide_dev, 0x54, &reg5xh);
pci_read_config_byte(bmide_dev, 0x55, &reg5yh);
q = "FIFO threshold: %2d Words %2d Words %2d Words %2d Words\n";
if (rev < 0xc1) {
if ((rev == 0x20) && (pci_read_config_byte(bmide_dev, 0x4f, &tmp), (tmp &= 0x20))) {
p += sprintf(p, q, 8, 8, 8, 8);
} else {
p += sprintf(p, q,
(reg5xh & 0x03) + 12,
((reg5xh & 0x30)>>4) + 12,
(reg5yh & 0x03) + 12,
((reg5yh & 0x30)>>4) + 12 );
}
} else {
int t1 = (tmp = (reg5xh & 0x03)) ? (tmp << 3) : 4;
int t2 = (tmp = ((reg5xh & 0x30)>>4)) ? (tmp << 3) : 4;
int t3 = (tmp = (reg5yh & 0x03)) ? (tmp << 3) : 4;
int t4 = (tmp = ((reg5yh & 0x30)>>4)) ? (tmp << 3) : 4;
p += sprintf(p, q, t1, t2, t3, t4);
}
#if 0
p += sprintf(p,
"FIFO threshold: %2d Words %2d Words %2d Words %2d Words\n",
(reg5xh & 0x03) + 12,
((reg5xh & 0x30)>>4) + 12,
(reg5yh & 0x03) + 12,
((reg5yh & 0x30)>>4) + 12 );
#endif
p += sprintf(p,
"FIFO mode: %s %s %s %s\n",
fifo[((reg5xh & 0x0c) >> 2)],
fifo[((reg5xh & 0xc0) >> 6)],
fifo[((reg5yh & 0x0c) >> 2)],
fifo[((reg5yh & 0xc0) >> 6)] );
pci_read_config_byte(bmide_dev, 0x5a, &reg5xh);
pci_read_config_byte(bmide_dev, 0x5b, &reg5xh1);
pci_read_config_byte(bmide_dev, 0x5e, &reg5yh);
pci_read_config_byte(bmide_dev, 0x5f, &reg5yh1);
p += sprintf(p,/*
"------------------drive0-----------drive1------------drive0-----------drive1------\n")*/
"Dt RW act. Cnt %2dT %2dT %2dT %2dT\n"
"Dt RW rec. Cnt %2dT %2dT %2dT %2dT\n\n",
(reg5xh & 0x70) ? ((reg5xh & 0x70) >> 4) : 8,
(reg5xh1 & 0x70) ? ((reg5xh1 & 0x70) >> 4) : 8,
(reg5yh & 0x70) ? ((reg5yh & 0x70) >> 4) : 8,
(reg5yh1 & 0x70) ? ((reg5yh1 & 0x70) >> 4) : 8,
(reg5xh & 0x0f) ? (reg5xh & 0x0f) : 16,
(reg5xh1 & 0x0f) ? (reg5xh1 & 0x0f) : 16,
(reg5yh & 0x0f) ? (reg5yh & 0x0f) : 16,
(reg5yh1 & 0x0f) ? (reg5yh1 & 0x0f) : 16 );
p += sprintf(p,
"-----------------------------------UDMA Timings--------------------------------\n\n");
pci_read_config_byte(bmide_dev, 0x56, &reg5xh);
pci_read_config_byte(bmide_dev, 0x57, &reg5yh);
p += sprintf(p,
"UDMA: %s %s %s %s\n"
"UDMA timings: %s %s %s %s\n\n",
(reg5xh & 0x08) ? "OK" : "No",
(reg5xh & 0x80) ? "OK" : "No",
(reg5yh & 0x08) ? "OK" : "No",
(reg5yh & 0x80) ? "OK" : "No",
udmaT[(reg5xh & 0x07)],
udmaT[(reg5xh & 0x70) >> 4],
udmaT[reg5yh & 0x07],
udmaT[(reg5yh & 0x70) >> 4] );
return p-buffer; /* => must be less than 4k! */
}
#endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */
static byte m5229_revision;
static byte chip_is_1543c_e;
byte ali_proc = 0;
static struct pci_dev *isa_dev;
static void ali15x3_tune_drive(struct ata_device *drive, byte pio)
......@@ -503,14 +297,6 @@ static unsigned int __init ali15x3_init_chipset(struct pci_dev *dev)
printk("%s: simplex device: DMA will fail!!\n", dev->name);
}
#if defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS)
if (!ali_proc) {
ali_proc = 1;
bmide_dev = dev;
ali_display_info = &ali_get_info;
}
#endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */
return 0;
}
......
......@@ -89,108 +89,10 @@ static unsigned char amd_enabled;
static unsigned int amd_80w;
static unsigned char amd_cyc2udma[] = { 6, 6, 5, 4, 0, 1, 1, 2, 2, 3, 3 };
#if 0
static unsigned char amd_udma2cyc[] = { 4, 6, 8, 10, 3, 2, 1, 1 };
static char *amd_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100" };
/*
* AMD /proc entry.
*/
#if 0 && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
byte amd74xx_proc;
int amd_base;
static struct pci_dev *bmide_dev;
extern int (*amd74xx_display_info)(char *, char **, off_t, int); /* ide-proc.c */
#define amd_print(format, arg...) p += sprintf(p, format "\n" , ## arg)
#define amd_print_drive(name, format, arg...)\
p += sprintf(p, name); for (i = 0; i < 4; i++) p += sprintf(p, format, ## arg); p += sprintf(p, "\n");
static int amd_get_info(char *buffer, char **addr, off_t offset, int count)
{
int speed[4], cycle[4], setup[4], active[4], recover[4], den[4],
uen[4], udma[4], active8b[4], recover8b[4];
struct pci_dev *dev = bmide_dev;
unsigned int v, u, i;
unsigned short c, w;
unsigned char t;
char *p = buffer;
amd_print("----------AMD BusMastering IDE Configuration----------------");
amd_print("Driver Version: 2.8");
amd_print("South Bridge: %s", bmide_dev->name);
pci_read_config_byte(dev, PCI_REVISION_ID, &t);
amd_print("Revision: IDE %#x", t);
amd_print("Highest DMA rate: %s", amd_dma[amd_config->flags & AMD_UDMA]);
amd_print("BM-DMA base: %#x", amd_base);
amd_print("PCI clock: %d.%dMHz", system_bus_speed / 1000, system_bus_speed / 100 % 10);
amd_print("-----------------------Primary IDE-------Secondary IDE------");
pci_read_config_byte(dev, AMD_IDE_CONFIG, &t);
amd_print("Prefetch Buffer: %10s%20s", (t & 0x80) ? "yes" : "no", (t & 0x20) ? "yes" : "no");
amd_print("Post Write Buffer: %10s%20s", (t & 0x40) ? "yes" : "no", (t & 0x10) ? "yes" : "no");
pci_read_config_byte(dev, AMD_IDE_ENABLE, &t);
amd_print("Enabled: %10s%20s", (t & 0x02) ? "yes" : "no", (t & 0x01) ? "yes" : "no");
c = inb(amd_base + 0x02) | (inb(amd_base + 0x0a) << 8);
amd_print("Simplex only: %10s%20s", (c & 0x80) ? "yes" : "no", (c & 0x8000) ? "yes" : "no");
amd_print("Cable Type: %10s%20s", (amd_80w & 1) ? "80w" : "40w", (amd_80w & 2) ? "80w" : "40w");
if (!system_bus_speed)
return p - buffer;
amd_print("-------------------drive0----drive1----drive2----drive3-----");
pci_read_config_byte(dev, AMD_ADDRESS_SETUP, &t);
pci_read_config_dword(dev, AMD_DRIVE_TIMING, &v);
pci_read_config_word(dev, AMD_8BIT_TIMING, &w);
pci_read_config_dword(dev, AMD_UDMA_TIMING, &u);
for (i = 0; i < 4; i++) {
setup[i] = ((t >> ((3 - i) << 1)) & 0x3) + 1;
recover8b[i] = ((w >> ((1 - (i >> 1)) << 3)) & 0xf) + 1;
active8b[i] = ((w >> (((1 - (i >> 1)) << 3) + 4)) & 0xf) + 1;
active[i] = ((v >> (((3 - i) << 3) + 4)) & 0xf) + 1;
recover[i] = ((v >> ((3 - i) << 3)) & 0xf) + 1;
udma[i] = amd_udma2cyc[((u >> ((3 - i) << 3)) & 0x7)];
uen[i] = ((u >> ((3 - i) << 3)) & 0x40) ? 1 : 0;
den[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2));
if (den[i] && uen[i] && udma[i] == 1) {
speed[i] = system_bus_speed * 3;
cycle[i] = 666666 / system_bus_speed;
continue;
}
speed[i] = 4 * system_bus_speed / ((den[i] && uen[i]) ? udma[i] : (active[i] + recover[i]) * 2);
cycle[i] = 1000000 * ((den[i] && uen[i]) ? udma[i] : (active[i] + recover[i]) * 2) / system_bus_speed / 2;
}
amd_print_drive("Transfer Mode: ", "%10s", den[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO");
amd_print_drive("Address Setup: ", "%8dns", 1000000 * setup[i] / system_bus_speed);
amd_print_drive("Cmd Active: ", "%8dns", 1000000 * active8b[i] / system_bus_speed);
amd_print_drive("Cmd Recovery: ", "%8dns", 1000000 * recover8b[i] / system_bus_speed);
amd_print_drive("Data Active: ", "%8dns", 1000000 * active[i] / system_bus_speed);
amd_print_drive("Data Recovery: ", "%8dns", 1000000 * recover[i] / system_bus_speed);
amd_print_drive("Cycle Time: ", "%8dns", cycle[i]);
amd_print_drive("Transfer Rate: ", "%4d.%dMB/s", speed[i] / 1000, speed[i] / 100 % 10);
return p - buffer; /* hoping it is less than 4K... */
}
#endif
static char *amd_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100" };
/*
* amd_set_speed() writes timing values to the chipset registers
......@@ -362,19 +264,6 @@ static unsigned int __init amd74xx_init_chipset(struct pci_dev *dev)
printk(KERN_INFO "AMD_IDE: %s (rev %02x) %s controller on pci%s\n",
dev->name, t, amd_dma[amd_config->flags & AMD_UDMA], dev->slot_name);
/*
* Register /proc/ide/amd74xx entry
*/
#if 0 && defined(CONFIG_PROC_FS)
if (!amd74xx_proc) {
amd_base = pci_resource_start(dev, 4);
bmide_dev = dev;
amd74xx_display_info = &amd_get_info;
amd74xx_proc = 1;
}
#endif
return 0;
}
......
......@@ -82,123 +82,6 @@
#define UDIDETCR1 0x7B
#define DTPR1 0x7C
#undef DISPLAY_CMD64X_TIMINGS
#if defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
static int cmd64x_get_info(char *, char **, off_t, int);
static int cmd680_get_info(char *, char **, off_t, int);
extern int (*cmd64x_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static struct pci_dev *bmide_dev;
static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count)
{
char *p = buffer;
u8 reg53 = 0, reg54 = 0, reg55 = 0, reg56 = 0; /* primary */
u8 reg57 = 0, reg58 = 0, reg5b; /* secondary */
u8 reg72 = 0, reg73 = 0; /* primary */
u8 reg7a = 0, reg7b = 0; /* secondary */
u8 reg50 = 0, reg71 = 0; /* extra */
u8 hi_byte = 0, lo_byte = 0;
switch(bmide_dev->device) {
case PCI_DEVICE_ID_CMD_649:
p += sprintf(p, "\n CMD649 Chipset.\n");
break;
case PCI_DEVICE_ID_CMD_648:
p += sprintf(p, "\n CMD648 Chipset.\n");
break;
case PCI_DEVICE_ID_CMD_646:
p += sprintf(p, "\n CMD646 Chipset.\n");
break;
case PCI_DEVICE_ID_CMD_643:
p += sprintf(p, "\n CMD643 Chipset.\n");
break;
default:
p += sprintf(p, "\n CMD64? Chipse.\n");
break;
}
(void) pci_read_config_byte(bmide_dev, CFR, &reg50);
(void) pci_read_config_byte(bmide_dev, ARTTIM0, &reg53);
(void) pci_read_config_byte(bmide_dev, DRWTIM0, &reg54);
(void) pci_read_config_byte(bmide_dev, ARTTIM1, &reg55);
(void) pci_read_config_byte(bmide_dev, DRWTIM1, &reg56);
(void) pci_read_config_byte(bmide_dev, ARTTIM2, &reg57);
(void) pci_read_config_byte(bmide_dev, DRWTIM2, &reg58);
(void) pci_read_config_byte(bmide_dev, DRWTIM3, &reg5b);
(void) pci_read_config_byte(bmide_dev, MRDMODE, &reg71);
(void) pci_read_config_byte(bmide_dev, BMIDESR0, &reg72);
(void) pci_read_config_byte(bmide_dev, UDIDETCR0, &reg73);
(void) pci_read_config_byte(bmide_dev, BMIDESR1, &reg7a);
(void) pci_read_config_byte(bmide_dev, UDIDETCR1, &reg7b);
p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
p += sprintf(p, " %sabled %sabled\n",
(reg72&0x80)?"dis":" en",(reg7a&0x80)?"dis":" en");
p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n");
p += sprintf(p, "DMA enabled: %s %s %s %s\n",
(reg72&0x20)?"yes":"no ",(reg72&0x40)?"yes":"no ",(reg7a&0x20)?"yes":"no ",(reg7a&0x40)?"yes":"no ");
p += sprintf(p, "DMA Mode: %s(%s) %s(%s) %s(%s) %s(%s)\n",
(reg72&0x20)?((reg73&0x01)?"UDMA":" DMA"):" PIO",
(reg72&0x20)?( ((reg73&0x30)==0x30)?(((reg73&0x35)==0x35)?"3":"0"):
((reg73&0x20)==0x20)?(((reg73&0x25)==0x25)?"3":"1"):
((reg73&0x10)==0x10)?(((reg73&0x15)==0x15)?"4":"2"):
((reg73&0x00)==0x00)?(((reg73&0x05)==0x05)?"5":"2"):"X"):"?",
(reg72&0x40)?((reg73&0x02)?"UDMA":" DMA"):" PIO",
(reg72&0x40)?( ((reg73&0xC0)==0xC0)?(((reg73&0xC5)==0xC5)?"3":"0"):
((reg73&0x80)==0x80)?(((reg73&0x85)==0x85)?"3":"1"):
((reg73&0x40)==0x40)?(((reg73&0x4A)==0x4A)?"4":"2"):
((reg73&0x00)==0x00)?(((reg73&0x0A)==0x0A)?"5":"2"):"X"):"?",
(reg7a&0x20)?((reg7b&0x01)?"UDMA":" DMA"):" PIO",
(reg7a&0x20)?( ((reg7b&0x30)==0x30)?(((reg7b&0x35)==0x35)?"3":"0"):
((reg7b&0x20)==0x20)?(((reg7b&0x25)==0x25)?"3":"1"):
((reg7b&0x10)==0x10)?(((reg7b&0x15)==0x15)?"4":"2"):
((reg7b&0x00)==0x00)?(((reg7b&0x05)==0x05)?"5":"2"):"X"):"?",
(reg7a&0x40)?((reg7b&0x02)?"UDMA":" DMA"):" PIO",
(reg7a&0x40)?( ((reg7b&0xC0)==0xC0)?(((reg7b&0xC5)==0xC5)?"3":"0"):
((reg7b&0x80)==0x80)?(((reg7b&0x85)==0x85)?"3":"1"):
((reg7b&0x40)==0x40)?(((reg7b&0x4A)==0x4A)?"4":"2"):
((reg7b&0x00)==0x00)?(((reg7b&0x0A)==0x0A)?"5":"2"):"X"):"?" );
p += sprintf(p, "PIO Mode: %s %s %s %s\n",
"?", "?", "?", "?");
p += sprintf(p, " %s %s\n",
(reg50 & CFR_INTR_CH0) ? "interrupting" : "polling ",
(reg57 & ARTTIM23_INTR_CH1) ? "interrupting" : "polling");
p += sprintf(p, " %s %s\n",
(reg71 & MRDMODE_INTR_CH0) ? "pending" : "clear ",
(reg71 & MRDMODE_INTR_CH1) ? "pending" : "clear");
p += sprintf(p, " %s %s\n",
(reg71 & MRDMODE_BLK_CH0) ? "blocked" : "enabled",
(reg71 & MRDMODE_BLK_CH1) ? "blocked" : "enabled");
SPLIT_BYTE(reg50, hi_byte, lo_byte);
p += sprintf(p, "CFR = 0x%02x, HI = 0x%02x, LOW = 0x%02x\n", reg50, hi_byte, lo_byte);
SPLIT_BYTE(reg57, hi_byte, lo_byte);
p += sprintf(p, "ARTTIM23 = 0x%02x, HI = 0x%02x, LOW = 0x%02x\n", reg57, hi_byte, lo_byte);
SPLIT_BYTE(reg71, hi_byte, lo_byte);
p += sprintf(p, "MRDMODE = 0x%02x, HI = 0x%02x, LOW = 0x%02x\n", reg71, hi_byte, lo_byte);
return p-buffer; /* => must be less than 4k! */
}
static int cmd680_get_info (char *buffer, char **addr, off_t offset, int count)
{
char *p = buffer;
p += sprintf(p, "\n CMD680 Chipset.\n");
p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n");
p += sprintf(p, "PIO Mode: %s %s %s %s\n",
"?", "?", "?", "?");
return p-buffer; /* => must be less than 4k! */
}
#endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */
byte cmd64x_proc = 0;
byte cmd680_proc = 0;
/*
* Registers and masks for easy access by drive index:
*/
......@@ -887,13 +770,6 @@ static unsigned int cmd680_pci_init(struct pci_dev *dev)
pci_write_config_dword(dev, 0xB8, 0x4392);
pci_write_config_dword(dev, 0xBC, 0x4009);
#if defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS)
if (!cmd64x_proc) {
cmd64x_proc = 1;
bmide_dev = dev;
cmd64x_display_info = &cmd680_get_info;
}
#endif /* DISPLAY_CMD64X_TIMINGS && CONFIG_PROC_FS */
return 0;
}
......@@ -975,14 +851,6 @@ static unsigned int cmd64x_pci_init(struct pci_dev *dev)
(void) pci_write_config_byte(dev, UDIDETCR0, 0xf0);
#endif /* CONFIG_PPC */
#if defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS)
if (!cmd64x_proc) {
cmd64x_proc = 1;
bmide_dev = dev;
cmd64x_display_info = &cmd64x_get_info;
}
#endif
return 0;
}
......
......@@ -32,50 +32,6 @@
#include "ata-timing.h"
#include "pcihost.h"
#undef DISPLAY_CS5530_TIMINGS
#if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
static int cs5530_get_info(char *, char **, off_t, int);
extern int (*cs5530_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static struct pci_dev *bmide_dev;
static int cs5530_get_info (char *buffer, char **addr, off_t offset, int count)
{
char *p = buffer;
u32 bibma = pci_resource_start(bmide_dev, 4);
u8 c0 = 0, c1 = 0;
/*
* at that point bibma+0x2 et bibma+0xa are byte registers
* to investigate:
*/
c0 = inb_p((unsigned short)bibma + 0x02);
c1 = inb_p((unsigned short)bibma + 0x0a);
p += sprintf(p, "\n Cyrix 5530 Chipset.\n");
p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
p += sprintf(p, " %sabled %sabled\n",
(c0&0x80) ? "dis" : " en",
(c1&0x80) ? "dis" : " en");
p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n");
p += sprintf(p, "DMA enabled: %s %s %s %s\n",
(c0&0x20) ? "yes" : "no ", (c0&0x40) ? "yes" : "no ",
(c1&0x20) ? "yes" : "no ", (c1&0x40) ? "yes" : "no " );
p += sprintf(p, "UDMA\n");
p += sprintf(p, "DMA\n");
p += sprintf(p, "PIO\n");
return p-buffer;
}
#endif /* DISPLAY_CS5530_TIMINGS && CONFIG_PROC_FS */
byte cs5530_proc = 0;
/*
* Set a new transfer mode at the drive
*/
......@@ -250,14 +206,6 @@ static unsigned int __init pci_init_cs5530(struct pci_dev *dev)
unsigned short pcicmd = 0;
unsigned long flags;
#if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS)
if (!cs5530_proc) {
cs5530_proc = 1;
bmide_dev = dev;
cs5530_display_info = &cs5530_get_info;
}
#endif /* DISPLAY_CS5530_TIMINGS && CONFIG_PROC_FS */
pci_for_each_dev (dev) {
if (dev->vendor == PCI_VENDOR_ID_CYRIX) {
switch (dev->device) {
......@@ -374,7 +322,7 @@ static struct ata_pci_device chipset __initdata = {
init_chipset: pci_init_cs5530,
init_channel: ide_init_cs5530,
bootable: ON_BOARD,
flags: ATA_F_DMA | ATA_F_FDMA
flags: ATA_F_DMA
};
int __init init_cs5530(void)
......
......@@ -66,6 +66,7 @@ static spinlock_t hd_lock = SPIN_LOCK_UNLOCKED;
static int revalidate_hddisk(kdev_t, int);
#define TIMEOUT_VALUE (6*HZ)
#define HD_DELAY 0
#define MAX_ERRORS 16 /* Max read/write errors/sector */
......@@ -833,7 +834,7 @@ int __init hd_init(void)
printk("hd: unable to get major %d for hard disk\n",MAJOR_NR);
return -1;
}
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &hd_lock);
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_hd_request, &hd_lock);
blk_queue_max_sectors(BLK_DEFAULT_QUEUE(MAJOR_NR), 255);
add_gendisk(&hd_gendisk);
init_timer(&device_timer);
......
......@@ -51,49 +51,6 @@
#define HPT343_DEBUG_DRIVE_INFO 0
#undef DISPLAY_HPT34X_TIMINGS
#if defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
static int hpt34x_get_info(char *, char **, off_t, int);
extern int (*hpt34x_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static struct pci_dev *bmide_dev;
static int hpt34x_get_info (char *buffer, char **addr, off_t offset, int count)
{
char *p = buffer;
u32 bibma = pci_resource_start(bmide_dev, 4);
u8 c0 = 0, c1 = 0;
/*
* at that point bibma+0x2 et bibma+0xa are byte registers
* to investigate:
*/
c0 = inb_p((unsigned short)bibma + 0x02);
c1 = inb_p((unsigned short)bibma + 0x0a);
p += sprintf(p, "\n HPT34X Chipset.\n");
p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
p += sprintf(p, " %sabled %sabled\n",
(c0&0x80) ? "dis" : " en",
(c1&0x80) ? "dis" : " en");
p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n");
p += sprintf(p, "DMA enabled: %s %s %s %s\n",
(c0&0x20) ? "yes" : "no ", (c0&0x40) ? "yes" : "no ",
(c1&0x20) ? "yes" : "no ", (c1&0x40) ? "yes" : "no " );
p += sprintf(p, "UDMA\n");
p += sprintf(p, "DMA\n");
p += sprintf(p, "PIO\n");
return p-buffer; /* => must be less than 4k! */
}
#endif /* defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS) */
byte hpt34x_proc = 0;
static void hpt34x_clear_chipset(struct ata_device *drive)
{
unsigned int reg1 = 0, tmp1 = 0;
......@@ -380,14 +337,6 @@ static unsigned int __init pci_init_hpt34x(struct pci_dev *dev)
__restore_flags(flags); /* local CPU only */
#if defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS)
if (!hpt34x_proc) {
hpt34x_proc = 1;
bmide_dev = dev;
hpt34x_display_info = &hpt34x_get_info;
}
#endif
return dev->irq;
}
......
......@@ -68,18 +68,11 @@
#include "pcihost.h"
#undef DISPLAY_HPT366_TIMINGS
/* various tuning parameters */
#define HPT_RESET_STATE_ENGINE
/*#define HPT_DELAY_INTERRUPT*/
/*#define HPT_SERIALIZE_IO*/
#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
#endif /* defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) */
static const char *quirk_drives[] = {
"QUANTUM FIREBALLlct08 08",
"QUANTUM FIREBALLP KA6.4",
......@@ -483,99 +476,8 @@ static struct chipset_bus_clock_list_entry sixty_six_base_hpt374[] = {
#define F_LOW_PCI_50 0x2d
#define F_LOW_PCI_66 0x42
static struct pci_dev *hpt_devs[HPT366_MAX_DEVS];
static int n_hpt_devs;
static unsigned int hpt_min_rev(struct pci_dev *dev, int rev);
#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
static u8 hpt366_proc = 0;
static int hpt366_get_info(char *, char **, off_t, int);
extern int (*hpt366_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static int hpt366_get_info (char *buffer, char **addr, off_t offset, int count)
{
char *p = buffer;
char *chipset_nums[] = {"366", "366", "368",
"370", "370A", "372",
"??", "374" };
int i;
p += sprintf(p, "\n "
"HighPoint HPT366/368/370/372/374\n");
for (i = 0; i < n_hpt_devs; i++) {
struct pci_dev *dev = hpt_devs[i];
unsigned short iobase = dev->resource[4].start;
u32 class_rev;
u8 c0, c1;
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xff;
p += sprintf(p, "\nController: %d\n", i);
p += sprintf(p, "Chipset: HPT%s\n",
class_rev < sizeof(chipset_nums) / sizeof(char *) ? chipset_nums[class_rev] : "???");
p += sprintf(p, "--------------- Primary Channel "
"--------------- Secondary Channel "
"--------------\n");
/* get the bus master status registers */
c0 = inb_p(iobase + 0x2);
c1 = inb_p(iobase + 0xa);
p += sprintf(p, "Enabled: %s"
" %s\n",
(c0 & 0x80) ? "no" : "yes",
(c1 & 0x80) ? "no" : "yes");
if (hpt_min_rev(dev, 3)) {
u8 cbl;
cbl = inb_p(iobase + 0x7b);
outb_p(cbl | 1, iobase + 0x7b);
outb_p(cbl & ~1, iobase + 0x7b);
cbl = inb_p(iobase + 0x7a);
p += sprintf(p, "Cable: ATA-%d"
" ATA-%d\n",
(cbl & 0x02) ? 33 : 66,
(cbl & 0x01) ? 33 : 66);
p += sprintf(p, "\n");
}
p += sprintf(p, "--------------- drive0 --------- drive1 "
"------- drive0 ---------- drive1 -------\n");
p += sprintf(p, "DMA capable: %s %s"
" %s %s\n",
(c0 & 0x20) ? "yes" : "no ",
(c0 & 0x40) ? "yes" : "no ",
(c1 & 0x20) ? "yes" : "no ",
(c1 & 0x40) ? "yes" : "no ");
{
u8 c2, c3;
/* older revs don't have these registers mapped
* into io space */
pci_read_config_byte(dev, 0x43, &c0);
pci_read_config_byte(dev, 0x47, &c1);
pci_read_config_byte(dev, 0x4b, &c2);
pci_read_config_byte(dev, 0x4f, &c3);
p += sprintf(p, "Mode: %s %s"
" %s %s\n",
(c0 & 0x10) ? "UDMA" : (c0 & 0x20) ? "DMA " :
(c0 & 0x80) ? "PIO " : "off ",
(c1 & 0x10) ? "UDMA" : (c1 & 0x20) ? "DMA " :
(c1 & 0x80) ? "PIO " : "off ",
(c2 & 0x10) ? "UDMA" : (c2 & 0x20) ? "DMA " :
(c2 & 0x80) ? "PIO " : "off ",
(c3 & 0x10) ? "UDMA" : (c3 & 0x20) ? "DMA " :
(c3 & 0x80) ? "PIO " : "off ");
}
}
p += sprintf(p, "\n");
return p-buffer;/* => must be less than 4k! */
}
#endif /* defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) */
static int check_in_drive_lists(struct ata_device *drive, const char **list)
{
struct hd_driveid *id = drive->id;
......@@ -1420,16 +1322,6 @@ static unsigned int __init hpt366_init_chipset(struct pci_dev *dev)
else
hpt366_init(dev);
if (n_hpt_devs < HPT366_MAX_DEVS)
hpt_devs[n_hpt_devs++] = dev;
#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
if (!hpt366_proc) {
hpt366_proc = 1;
hpt366_display_info = &hpt366_get_info;
}
#endif
return dev->irq;
}
......
......@@ -133,17 +133,6 @@
*/
#define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES)
/*
* Packet command flag bits.
*/
#define PC_ABORT 0 /* Set when an error is considered normal - We won't retry */
#define PC_DMA_RECOMMENDED 2 /* 1 when we prefer to use DMA if possible */
#define PC_DMA_IN_PROGRESS 3 /* 1 while DMA in progress */
#define PC_DMA_ERROR 4 /* 1 when encountered problem during DMA */
#define PC_WRITING 5 /* Data direction */
#define PC_SUPPRESS_ERROR 6 /* Suppress error reporting */
/*
* Removable Block Access Capabilities Page
*/
......
......@@ -168,8 +168,7 @@ static int __init setup_host_channel(struct pci_dev *dev,
int port,
u8 class_rev,
int pciirq,
int autodma,
unsigned short *pcicmd)
int autodma)
{
unsigned long base = 0;
unsigned long dma_base;
......@@ -319,23 +318,12 @@ static int __init setup_host_channel(struct pci_dev *dev,
goto no_dma;
}
if (!(*pcicmd & PCI_COMMAND_MASTER)) {
/*
* Set up BM-DMA capability (PnP BIOS should have done this
* already). Default to DMA off on the drive, if we had to
* configure it here. This should most propably be enabled no
* all chipsets which can be expected to be used on systems
* without a BIOS equivalent.
*/
if (!(d->flags | ATA_F_FDMA))
ch->autodma = 0;
pci_write_config_word(dev, PCI_COMMAND, *pcicmd | PCI_COMMAND_MASTER);
if (pci_read_config_word(dev, PCI_COMMAND, pcicmd) || !(*pcicmd & PCI_COMMAND_MASTER)) {
printk("%s: %s error updating PCICMD\n",
ch->name, dev->name);
dma_base = 0;
}
}
/* The function below will check itself whatever there is something to
* be done or not. We don't have therefore to care whatever it was
* already enabled by the primary channel run.
*/
pci_set_master(dev);
if (d->init_dma)
d->init_dma(ch, dma_base);
else
......@@ -472,8 +460,8 @@ static void __init setup_pci_device(struct pci_dev *dev, struct ata_pci_device *
/*
* Set up IDE chanells. First the primary, then the secondary.
*/
setup_host_channel(dev, d, ATA_PRIMARY, class_rev, pciirq, autodma, &pcicmd);
setup_host_channel(dev, d, ATA_SECONDARY, class_rev, pciirq, autodma, &pcicmd);
setup_host_channel(dev, d, ATA_PRIMARY, class_rev, pciirq, autodma);
setup_host_channel(dev, d, ATA_SECONDARY, class_rev, pciirq, autodma);
}
/*
......
......@@ -701,16 +701,6 @@ typedef enum {
idetape_direction_write
} idetape_chrdev_direction_t;
/*
* Packet command flag bits.
*/
#define PC_ABORT 0 /* Set when an error is considered normal - We won't retry */
#define PC_WAIT_FOR_DSC 1 /* 1 When polling for DSC on a media access command */
#define PC_DMA_RECOMMENDED 2 /* 1 when we prefer to use DMA if possible */
#define PC_DMA_IN_PROGRESS 3 /* 1 while DMA in progress */
#define PC_DMA_ERROR 4 /* 1 when encountered problem during DMA */
#define PC_WRITING 5 /* Data direction */
/*
* Capabilities and Mechanical Status Page
*/
......
......@@ -105,13 +105,12 @@ typedef struct ide_pci_enablebit_s {
#define ATA_F_DMA 0x001
#define ATA_F_NODMA 0x002 /* no DMA mode supported at all */
#define ATA_F_NOADMA 0x004 /* DMA has to be enabled explicitely */
#define ATA_F_FDMA 0x008 /* force autodma */
#define ATA_F_FIXIRQ 0x010 /* fixed irq wiring */
#define ATA_F_SER 0x020 /* serialize on first and second channel interrupts */
#define ATA_F_IRQ 0x040 /* trust IRQ information from config */
#define ATA_F_PHACK 0x080 /* apply PROMISE hacks */
#define ATA_F_HPTHACK 0x100 /* apply HPT366 hacks */
#define ATA_F_SIMPLEX 0x200 /* force treatment as simple device */
#define ATA_F_FIXIRQ 0x008 /* fixed irq wiring */
#define ATA_F_SER 0x010 /* serialize on first and second channel interrupts */
#define ATA_F_IRQ 0x020 /* trust IRQ information from config */
#define ATA_F_PHACK 0x040 /* apply PROMISE hacks */
#define ATA_F_HPTHACK 0x080 /* apply HPT366 hacks */
#define ATA_F_SIMPLEX 0x100 /* force treatment as simple device */
struct ata_pci_device {
......
......@@ -108,129 +108,6 @@ static unsigned int piix_80w;
static char *piix_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" };
/*
* PIIX/ICH /proc entry.
*/
#if 0 && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
byte piix_proc;
int piix_base;
static struct pci_dev *bmide_dev;
extern int (*piix_display_info)(char *, char **, off_t, int); /* ide-proc.c */
#define piix_print(format, arg...) p += sprintf(p, format "\n" , ## arg)
#define piix_print_drive(name, format, arg...)\
p += sprintf(p, name); for (i = 0; i < 4; i++) p += sprintf(p, format, ## arg); p += sprintf(p, "\n");
static int piix_get_info(char *buffer, char **addr, off_t offset, int count)
{
int speed[4], cycle[4], active[4], recover[4], dmaen[4], uen[4], udma[4], umul;
struct pci_dev *dev = bmide_dev;
unsigned int i, u;
unsigned short c, d, e;
unsigned char t;
char *p = buffer;
piix_print("----------PIIX BusMastering IDE Configuration---------------");
piix_print("Driver Version: 1.3");
piix_print("South Bridge: %s", bmide_dev->name);
pci_read_config_byte(dev, PCI_REVISION_ID, &t);
piix_print("Revision: IDE %#x", t);
piix_print("Highest DMA rate: %s", piix_config->flags & PIIX_NODMA ? "No DMA"
: piix_dma[piix_config->flags & PIIX_UDMA]);
piix_print("BM-DMA base: %#x", piix_base);
piix_print("PCI clock: %d.%dMHz", system_bus_speed / 1000, system_bus_speed / 100 % 10);
piix_print("-----------------------Primary IDE-------Secondary IDE------");
pci_read_config_word(dev, PIIX_IDETIM0, &d);
pci_read_config_word(dev, PIIX_IDETIM1, &e);
piix_print("Enabled: %10s%20s", (d & 0x8000) ? "yes" : "no", (e & 0x8000) ? "yes" : "no");
c = inb(piix_base + 0x02) | (inb(piix_base + 0x0a) << 8);
piix_print("Simplex only: %10s%20s", (c & 0x80) ? "yes" : "no", (c & 0x8000) ? "yes" : "no");
piix_print("Cable Type: %10s%20s", (piix_80w & 1) ? "80w" : "40w", (piix_80w & 2) ? "80w" : "40w");
if (!system_bus_speed)
return p - buffer;
piix_print("-------------------drive0----drive1----drive2----drive3-----");
piix_print_drive("Prefetch+Post: ", "%10s", (((i & 2) ? d : e) & (1 << (2 + ((i & 1) << 2)))) ? "yes" : "no");
for (i = 0; i < 4; i++) {
pci_read_config_word(dev, PIIX_IDETIM0 + (i & 2), &d);
if (~piix_config->flags & PIIX_NO_SITRE)
pci_read_config_byte(dev, PIIX_SIDETIM, &t);
umul = 4;
udma[i] = uen[i] = 0;
active[i] = 12;
recover[i] = 18;
switch (i & 1) {
case 1: if (~d & 0x10) break;
if ((~piix_config->flags & PIIX_NO_SITRE) && (d & 0x4000)) {
active[i] = 5 - ((t >> (((i & 2) << 1) + 2)) & 3);
recover[i] = 4 - ((t >> (((i & 2) << 1) + 0)) & 3);
break;
}
case 0: if (~d & 0x01) break;
active[i] = 5 - ((d >> 12) & 3);
recover[i] = 4 - ((d >> 8) & 3);
}
dmaen[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2));
cycle[i] = 1000000 / system_bus_speed * (active[i] + recover[i]);
speed[i] = 2 * system_bus_speed / (active[i] + recover[i]);
if (!(piix_config->flags & PIIX_UDMA))
continue;
pci_read_config_byte(dev, PIIX_UDMACTL, &t);
uen[i] = (t & (1 << i)) ? dmaen[i] : 0;
if (!uen[i])
continue;
pci_read_config_word(dev, PIIX_UDMATIM, &e);
pci_read_config_dword(dev, PIIX_IDECFG, &u);
if (~piix_config->flags & PIIX_VICTORY) {
if ((piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_66 && (u & (1 << i))) umul = 2;
if ((piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_100 && (u & (1 << (i + 12)))) umul = 1;
udma[i] = (4 - ((e >> (i << 2)) & 3)) * umul;
} else udma[i] = (8 - ((e >> (i << 2)) & 7)) * 2;
speed[i] = 8 * system_bus_speed / udma[i];
cycle[i] = 250000 * udma[i] / system_bus_speed;
}
piix_print_drive("Transfer Mode: ", "%10s", dmaen[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO");
piix_print_drive("Address Setup: ", "%8dns", (1000000 / system_bus_speed) * 3);
piix_print_drive("Cmd Active: ", "%8dns", (1000000 / system_bus_speed) * 12);
piix_print_drive("Cmd Recovery: ", "%8dns", (1000000 / system_bus_speed) * 18);
piix_print_drive("Data Active: ", "%8dns", (1000000 / system_bus_speed) * active[i]);
piix_print_drive("Data Recovery: ", "%8dns", (1000000 / system_bus_speed) * recover[i]);
piix_print_drive("Cycle Time: ", "%8dns", cycle[i]);
piix_print_drive("Transfer Rate: ", "%4d.%dMB/s", speed[i] / 1000, speed[i] / 100 % 10);
return p - buffer; /* hoping it is less than 4K... */
}
#endif
/*
* piix_set_speed() writes timing values to the chipset registers
*/
......@@ -497,19 +374,6 @@ static unsigned int __init piix_init_chipset(struct pci_dev *dev)
printk(KERN_INFO "PIIX: %s %s controller on pci%s\n",
dev->name, piix_dma[piix_config->flags & PIIX_UDMA], dev->slot_name);
/*
* Register /proc/ide/piix entry
*/
#if 0 && defined(CONFIG_PROC_FS)
if (!piix_proc) {
piix_base = pci_resource_start(dev, 4);
bmide_dev = dev;
piix_display_info = &piix_get_info;
piix_proc = 1;
}
#endif
return 0;
}
......
......@@ -37,10 +37,8 @@
#include <asm/uaccess.h>
#include <asm/io.h>
extern struct ata_device * get_info_ptr(kdev_t);
/*
* This is called from the partition-table code in pt/msdos.c.
*
......@@ -532,7 +530,7 @@ static inline void do_identify(struct ata_device *drive, u8 cmd)
}
}
drive->type = ATA_DISK;
printk("ATA DISK drive\n");
printk("DISK drive\n");
/* Initialize our quirk list. */
if (drive->channel->quirkproc)
......@@ -614,7 +612,7 @@ static int identify(struct ata_device *drive, u8 cmd)
goto out;
} else
#endif
OUT_BYTE(cmd,IDE_COMMAND_REG); /* ask drive for ID */
OUT_BYTE(cmd, IDE_COMMAND_REG); /* ask drive for ID */
timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
timeout += jiffies;
do {
......@@ -673,29 +671,31 @@ static int identify(struct ata_device *drive, u8 cmd)
static int do_probe(struct ata_device *drive, u8 cmd)
{
int rc;
struct ata_channel *hwif = drive->channel;
struct ata_channel *ch = drive->channel;
u8 select;
if (drive->present) { /* avoid waiting for inappropriate probes */
if ((drive->type != ATA_DISK) && (cmd == WIN_IDENTIFY))
return 4;
}
#ifdef DEBUG
printk("probing for %s: present=%d, type=%d, probetype=%s\n",
printk("probing for %s: present=%d, type=%02x, probetype=%s\n",
drive->name, drive->present, drive->type,
(cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI");
#endif
mdelay(50); /* needed for some systems (e.g. crw9624 as drive0 with disk as slave) */
SELECT_DRIVE(hwif,drive);
SELECT_DRIVE(ch, drive);
mdelay(50);
if (IN_BYTE(IDE_SELECT_REG) != drive->select.all && !drive->present) {
select = IN_BYTE(IDE_SELECT_REG);
if (select != drive->select.all && !drive->present) {
if (drive->select.b.unit != 0) {
SELECT_DRIVE(hwif,&hwif->drives[0]); /* exit with drive0 selected */
SELECT_DRIVE(ch, &ch->drives[0]); /* exit with drive0 selected */
mdelay(50); /* allow BUSY_STAT to assert & clear */
}
return 3; /* no i/f present: mmm.. this should be a 4 -ml */
}
if (OK_STAT(GET_STAT(),READY_STAT,BUSY_STAT) || drive->present || cmd == WIN_PIDENTIFY)
if (OK_STAT(GET_STAT(), READY_STAT, BUSY_STAT) || drive->present || cmd == WIN_PIDENTIFY)
{
if ((rc = identify(drive,cmd))) /* send cmd and wait */
rc = identify(drive,cmd); /* failed: try again */
......@@ -713,12 +713,12 @@ static int do_probe(struct ata_device *drive, u8 cmd)
}
if (rc == 1)
printk("%s: no response (status = 0x%02x)\n", drive->name, GET_STAT());
(void) GET_STAT(); /* ensure drive irq is clear */
GET_STAT(); /* ensure drive irq is clear */
} else
rc = 3; /* not present or maybe ATAPI */
if (drive->select.b.unit != 0) {
SELECT_DRIVE(hwif,&hwif->drives[0]); /* exit with drive0 selected */
SELECT_DRIVE(ch, &ch->drives[0]); /* exit with drive0 selected */
mdelay(50);
GET_STAT(); /* ensure drive irq is clear */
}
......
......@@ -95,146 +95,10 @@
#include "ata-timing.h"
#include "pcihost.h"
#undef DISPLAY_SVWKS_TIMINGS
#undef SVWKS_DEBUG_DRIVE_INFO
static u8 svwks_revision;
#if defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
static struct pci_dev *bmide_dev;
static int svwks_get_info(char *, char **, off_t, int);
extern int (*svwks_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static int svwks_get_info (char *buffer, char **addr, off_t offset, int count)
{
char *p = buffer;
u32 bibma = pci_resource_start(bmide_dev, 4);
u32 reg40, reg44;
u16 reg48, reg56;
u8 reg54, c0=0, c1=0;
pci_read_config_dword(bmide_dev, 0x40, &reg40);
pci_read_config_dword(bmide_dev, 0x44, &reg44);
pci_read_config_word(bmide_dev, 0x48, &reg48);
pci_read_config_byte(bmide_dev, 0x54, &reg54);
pci_read_config_word(bmide_dev, 0x56, &reg56);
/*
* at that point bibma+0x2 et bibma+0xa are byte registers
* to investigate:
*/
c0 = inb_p((unsigned short)bibma + 0x02);
c1 = inb_p((unsigned short)bibma + 0x0a);
switch(bmide_dev->device) {
case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
p += sprintf(p, "\n "
"ServerWorks CSB5 Chipset (rev %02x)\n",
svwks_revision);
break;
case PCI_DEVICE_ID_SERVERWORKS_OSB4IDE:
p += sprintf(p, "\n "
"ServerWorks OSB4 Chipset (rev %02x)\n",
svwks_revision);
break;
default:
p += sprintf(p, "\n "
"ServerWorks %04x Chipset (rev %02x)\n",
bmide_dev->device, svwks_revision);
break;
}
p += sprintf(p, "------------------------------- General Status ---------------------------------\n");
p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
p += sprintf(p, " %sabled %sabled\n",
(c0&0x80) ? "dis" : " en",
(c1&0x80) ? "dis" : " en");
p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n");
p += sprintf(p, "DMA enabled: %s %s %s %s\n",
(c0&0x20) ? "yes" : "no ",
(c0&0x40) ? "yes" : "no ",
(c1&0x20) ? "yes" : "no ",
(c1&0x40) ? "yes" : "no " );
p += sprintf(p, "UDMA enabled: %s %s %s %s\n",
(reg54 & 0x01) ? "yes" : "no ",
(reg54 & 0x02) ? "yes" : "no ",
(reg54 & 0x04) ? "yes" : "no ",
(reg54 & 0x08) ? "yes" : "no " );
p += sprintf(p, "UDMA enabled: %s %s %s %s\n",
((reg56&0x0005)==0x0005)?"5":
((reg56&0x0004)==0x0004)?"4":
((reg56&0x0003)==0x0003)?"3":
((reg56&0x0002)==0x0002)?"2":
((reg56&0x0001)==0x0001)?"1":
((reg56&0x000F))?"?":"0",
((reg56&0x0050)==0x0050)?"5":
((reg56&0x0040)==0x0040)?"4":
((reg56&0x0030)==0x0030)?"3":
((reg56&0x0020)==0x0020)?"2":
((reg56&0x0010)==0x0010)?"1":
((reg56&0x00F0))?"?":"0",
((reg56&0x0500)==0x0500)?"5":
((reg56&0x0400)==0x0400)?"4":
((reg56&0x0300)==0x0300)?"3":
((reg56&0x0200)==0x0200)?"2":
((reg56&0x0100)==0x0100)?"1":
((reg56&0x0F00))?"?":"0",
((reg56&0x5000)==0x5000)?"5":
((reg56&0x4000)==0x4000)?"4":
((reg56&0x3000)==0x3000)?"3":
((reg56&0x2000)==0x2000)?"2":
((reg56&0x1000)==0x1000)?"1":
((reg56&0xF000))?"?":"0");
p += sprintf(p, "DMA enabled: %s %s %s %s\n",
((reg44&0x00002000)==0x00002000)?"2":
((reg44&0x00002100)==0x00002100)?"1":
((reg44&0x00007700)==0x00007700)?"0":
((reg44&0x0000FF00)==0x0000FF00)?"X":"?",
((reg44&0x00000020)==0x00000020)?"2":
((reg44&0x00000021)==0x00000021)?"1":
((reg44&0x00000077)==0x00000077)?"0":
((reg44&0x000000FF)==0x000000FF)?"X":"?",
((reg44&0x20000000)==0x20000000)?"2":
((reg44&0x21000000)==0x21000000)?"1":
((reg44&0x77000000)==0x77000000)?"0":
((reg44&0xFF000000)==0xFF000000)?"X":"?",
((reg44&0x00200000)==0x00200000)?"2":
((reg44&0x00210000)==0x00210000)?"1":
((reg44&0x00770000)==0x00770000)?"0":
((reg44&0x00FF0000)==0x00FF0000)?"X":"?");
p += sprintf(p, "PIO enabled: %s %s %s %s\n",
((reg40&0x00002000)==0x00002000)?"4":
((reg40&0x00002200)==0x00002200)?"3":
((reg40&0x00003400)==0x00003400)?"2":
((reg40&0x00004700)==0x00004700)?"1":
((reg40&0x00005D00)==0x00005D00)?"0":"?",
((reg40&0x00000020)==0x00000020)?"4":
((reg40&0x00000022)==0x00000022)?"3":
((reg40&0x00000034)==0x00000034)?"2":
((reg40&0x00000047)==0x00000047)?"1":
((reg40&0x0000005D)==0x0000005D)?"0":"?",
((reg40&0x20000000)==0x20000000)?"4":
((reg40&0x22000000)==0x22000000)?"3":
((reg40&0x34000000)==0x34000000)?"2":
((reg40&0x47000000)==0x47000000)?"1":
((reg40&0x5D000000)==0x5D000000)?"0":"?",
((reg40&0x00200000)==0x00200000)?"4":
((reg40&0x00220000)==0x00220000)?"3":
((reg40&0x00340000)==0x00340000)?"2":
((reg40&0x00470000)==0x00470000)?"1":
((reg40&0x005D0000)==0x005D0000)?"0":"?");
return p-buffer; /* => must be less than 4k! */
}
static byte svwks_proc;
#endif /* defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS) */
#define SVWKS_CSB5_REVISION_NEW 0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */
static struct pci_dev *isa_dev;
......@@ -570,13 +434,6 @@ static unsigned int __init svwks_init_chipset(struct pci_dev *dev)
pci_write_config_byte(dev, 0x5A, btr);
}
#if defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS)
if (!svwks_proc) {
svwks_proc = 1;
bmide_dev = dev;
svwks_display_info = &svwks_get_info;
}
#endif /* DISPLAY_SVWKS_TIMINGS && CONFIG_PROC_FS */
return 0;
}
......
......@@ -59,7 +59,6 @@
/* When BROKEN_LEVEL is defined it limits the DMA mode
at boot time to its value */
// #define BROKEN_LEVEL XFER_SW_DMA_0
#undef DISPLAY_SIS_TIMINGS
/* Miscellaneaous flags */
#define SIS5513_LATENCY 0x01
......@@ -208,207 +207,6 @@ static byte cycle_time_value[][XFER_UDMA_5 - XFER_UDMA_0 + 1] = {
static struct pci_dev *host_dev = NULL;
/*
* Printing configuration
*/
#if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
static int sis_get_info(char *, char **, off_t, int);
extern int (*sis_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static struct pci_dev *bmide_dev;
static char* cable_type[] = {
"80 pins",
"40 pins"
};
static char* recovery_time[] ={
"12 PCICLK", "1 PCICLK",
"2 PCICLK", "3 PCICLK",
"4 PCICLK", "5 PCICLCK",
"6 PCICLK", "7 PCICLCK",
"8 PCICLK", "9 PCICLCK",
"10 PCICLK", "11 PCICLK",
"13 PCICLK", "14 PCICLK",
"15 PCICLK", "15 PCICLK"
};
static char* active_time[] = {
"8 PCICLK", "1 PCICLCK",
"2 PCICLK", "3 PCICLK",
"4 PCICLK", "5 PCICLK",
"6 PCICLK", "12 PCICLK"
};
static char* cycle_time[] = {
"Reserved", "2 CLK",
"3 CLK", "4 CLK",
"5 CLK", "6 CLK",
"7 CLK", "8 CLK",
"9 CLK", "10 CLK",
"11 CLK", "12 CLK",
"Reserved", "Reserved",
"Reserved", "Reserved"
};
/* Generic add master or slave info function */
static char* get_drives_info (char *buffer, byte pos)
{
byte reg00, reg01, reg10, reg11; /* timing registers */
char* p = buffer;
/* Postwrite/Prefetch */
pci_read_config_byte(bmide_dev, 0x4b, &reg00);
p += sprintf(p, "Drive %d: Postwrite %s \t \t Postwrite %s\n",
pos, (reg00 & (0x10 << pos)) ? "Enabled" : "Disabled",
(reg00 & (0x40 << pos)) ? "Enabled" : "Disabled");
p += sprintf(p, " Prefetch %s \t \t Prefetch %s\n",
(reg00 & (0x01 << pos)) ? "Enabled" : "Disabled",
(reg00 & (0x04 << pos)) ? "Enabled" : "Disabled");
pci_read_config_byte(bmide_dev, 0x40+2*pos, &reg00);
pci_read_config_byte(bmide_dev, 0x41+2*pos, &reg01);
pci_read_config_byte(bmide_dev, 0x44+2*pos, &reg10);
pci_read_config_byte(bmide_dev, 0x45+2*pos, &reg11);
/* UDMA */
if (chipset_family >= ATA_33) {
p += sprintf(p, " UDMA %s \t \t \t UDMA %s\n",
(reg01 & 0x80) ? "Enabled" : "Disabled",
(reg11 & 0x80) ? "Enabled" : "Disabled");
p += sprintf(p, " UDMA Cycle Time ");
switch(chipset_family) {
case ATA_33: p += sprintf(p, cycle_time[(reg01 & 0x60) >> 5]); break;
case ATA_66:
case ATA_100a: p += sprintf(p, cycle_time[(reg01 & 0x70) >> 4]); break;
case ATA_100: p += sprintf(p, cycle_time[reg01 & 0x0F]); break;
case ATA_133:
default: p += sprintf(p, "133+ ?"); break;
}
p += sprintf(p, " \t UDMA Cycle Time ");
switch(chipset_family) {
case ATA_33: p += sprintf(p, cycle_time[(reg11 & 0x60) >> 5]); break;
case ATA_66:
case ATA_100a: p += sprintf(p, cycle_time[(reg11 & 0x70) >> 4]); break;
case ATA_100: p += sprintf(p, cycle_time[reg11 & 0x0F]); break;
case ATA_133:
default: p += sprintf(p, "133+ ?"); break;
}
p += sprintf(p, "\n");
}
/* Data Active */
p += sprintf(p, " Data Active Time ");
switch(chipset_family) {
case ATA_00:
case ATA_16: /* confirmed */
case ATA_33:
case ATA_66:
case ATA_100a: p += sprintf(p, active_time[reg01 & 0x07]); break;
case ATA_100: p += sprintf(p, active_time[(reg00 & 0x70) >> 4]); break;
case ATA_133:
default: p += sprintf(p, "133+ ?"); break;
}
p += sprintf(p, " \t Data Active Time ");
switch(chipset_family) {
case ATA_00:
case ATA_16:
case ATA_33:
case ATA_66:
case ATA_100a: p += sprintf(p, active_time[reg11 & 0x07]); break;
case ATA_100: p += sprintf(p, active_time[(reg10 & 0x70) >> 4]); break;
case ATA_133:
default: p += sprintf(p, "133+ ?"); break;
}
p += sprintf(p, "\n");
/* Data Recovery */
/* warning: may need (reg&0x07) for pre ATA66 chips */
p += sprintf(p, " Data Recovery Time %s \t Data Recovery Time %s\n",
recovery_time[reg00 & 0x0f], recovery_time[reg10 & 0x0f]);
return p;
}
static char* get_masters_info(char* buffer)
{
return get_drives_info(buffer, 0);
}
static char* get_slaves_info(char* buffer)
{
return get_drives_info(buffer, 1);
}
/* Main get_info, called on /proc/ide/sis reads */
static int sis_get_info (char *buffer, char **addr, off_t offset, int count)
{
char *p = buffer;
byte reg;
u16 reg2, reg3;
p += sprintf(p, "\nSiS 5513 ");
switch(chipset_family) {
case ATA_00: p += sprintf(p, "Unknown???"); break;
case ATA_16: p += sprintf(p, "DMA 16"); break;
case ATA_33: p += sprintf(p, "Ultra 33"); break;
case ATA_66: p += sprintf(p, "Ultra 66"); break;
case ATA_100a:
case ATA_100: p += sprintf(p, "Ultra 100"); break;
case ATA_133:
default: p+= sprintf(p, "Ultra 133+"); break;
}
p += sprintf(p, " chipset\n");
p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
/* Status */
pci_read_config_byte(bmide_dev, 0x4a, &reg);
p += sprintf(p, "Channel Status: ");
if (chipset_family < ATA_66) {
p += sprintf(p, "%s \t \t \t \t %s\n",
(reg & 0x04) ? "On" : "Off",
(reg & 0x02) ? "On" : "Off");
} else {
p += sprintf(p, "%s \t \t \t \t %s \n",
(reg & 0x02) ? "On" : "Off",
(reg & 0x04) ? "On" : "Off");
}
/* Operation Mode */
pci_read_config_byte(bmide_dev, 0x09, &reg);
p += sprintf(p, "Operation Mode: %s \t \t \t %s \n",
(reg & 0x01) ? "Native" : "Compatible",
(reg & 0x04) ? "Native" : "Compatible");
/* 80-pin cable ? */
if (chipset_family > ATA_33) {
pci_read_config_byte(bmide_dev, 0x48, &reg);
p += sprintf(p, "Cable Type: %s \t \t \t %s\n",
(reg & 0x10) ? cable_type[1] : cable_type[0],
(reg & 0x20) ? cable_type[1] : cable_type[0]);
}
/* Prefetch Count */
pci_read_config_word(bmide_dev, 0x4c, &reg2);
pci_read_config_word(bmide_dev, 0x4e, &reg3);
p += sprintf(p, "Prefetch Count: %d \t \t \t \t %d\n",
reg2, reg3);
p = get_masters_info(p);
p = get_slaves_info(p);
return p-buffer;
}
byte sis_proc = 0;
#endif
static int sis5513_ratemask(struct ata_device *drive)
{
int map = 0;
......@@ -800,14 +598,6 @@ static unsigned int __init pci_init_sis5513(struct pci_dev *dev)
case ATA_00:
default: break;
}
#if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS)
if (!sis_proc) {
sis_proc = 1;
bmide_dev = dev;
sis_display_info = &sis_get_info;
}
#endif
}
#ifdef DEBUG
sis5513_load_verify_registers(dev, "pci_init_sis5513 end");
......
......@@ -134,139 +134,6 @@ static unsigned char via_enabled;
static unsigned int via_80w;
static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" };
/*
* VIA /proc entry.
*/
#if 0 && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
int via_proc, via_base;
static struct pci_dev *bmide_dev, *isa_dev;
extern int (*via_display_info)(char *, char **, off_t, int); /* ide-proc.c */
static char *via_control3[] = { "No limit", "64", "128", "192" };
#define via_print(format, arg...) p += sprintf(p, format "\n" , ## arg)
#define via_print_drive(name, format, arg...)\
p += sprintf(p, name); for (i = 0; i < 4; i++) p += sprintf(p, format, ## arg); p += sprintf(p, "\n");
static int via_get_info(char *buffer, char **addr, off_t offset, int count)
{
int speed[4], cycle[4], setup[4], active[4], recover[4], den[4],
uen[4], udma[4], umul[4], active8b[4], recover8b[4];
struct pci_dev *dev = bmide_dev;
unsigned int v, u, i;
unsigned short c, w;
unsigned char t, x;
char *p = buffer;
via_print("----------VIA BusMastering IDE Configuration----------------");
via_print("Driver Version: 3.34");
via_print("South Bridge: VIA %s", via_config->name);
pci_read_config_byte(isa_dev, PCI_REVISION_ID, &t);
pci_read_config_byte(dev, PCI_REVISION_ID, &x);
via_print("Revision: ISA %#x IDE %#x", t, x);
via_print("Highest DMA rate: %s", via_dma[via_config->flags & VIA_UDMA]);
via_print("BM-DMA base: %#x", via_base);
via_print("PCI clock: %d.%dMHz", system_bus_speed / 1000, system_bus_speed / 100 % 10);
pci_read_config_byte(dev, VIA_MISC_1, &t);
via_print("Master Read Cycle IRDY: %dws", (t & 64) >> 6);
via_print("Master Write Cycle IRDY: %dws", (t & 32) >> 5);
via_print("BM IDE Status Register Read Retry: %s", (t & 8) ? "yes" : "no");
pci_read_config_byte(dev, VIA_MISC_3, &t);
via_print("Max DRDY Pulse Width: %s%s", via_control3[(t & 0x03)], (t & 0x03) ? " PCI clocks" : "");
via_print("-----------------------Primary IDE-------Secondary IDE------");
via_print("Read DMA FIFO flush: %10s%20s", (t & 0x80) ? "yes" : "no", (t & 0x40) ? "yes" : "no");
via_print("End Sector FIFO flush: %10s%20s", (t & 0x20) ? "yes" : "no", (t & 0x10) ? "yes" : "no");
pci_read_config_byte(dev, VIA_IDE_CONFIG, &t);
via_print("Prefetch Buffer: %10s%20s", (t & 0x80) ? "yes" : "no", (t & 0x20) ? "yes" : "no");
via_print("Post Write Buffer: %10s%20s", (t & 0x40) ? "yes" : "no", (t & 0x10) ? "yes" : "no");
pci_read_config_byte(dev, VIA_IDE_ENABLE, &t);
via_print("Enabled: %10s%20s", (t & 0x02) ? "yes" : "no", (t & 0x01) ? "yes" : "no");
c = inb(via_base + 0x02) | (inb(via_base + 0x0a) << 8);
via_print("Simplex only: %10s%20s", (c & 0x80) ? "yes" : "no", (c & 0x8000) ? "yes" : "no");
via_print("Cable Type: %10s%20s", (via_80w & 1) ? "80w" : "40w", (via_80w & 2) ? "80w" : "40w");
via_print("-------------------drive0----drive1----drive2----drive3-----");
pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t);
pci_read_config_dword(dev, VIA_DRIVE_TIMING, &v);
pci_read_config_word(dev, VIA_8BIT_TIMING, &w);
if (via_config->flags & VIA_UDMA)
pci_read_config_dword(dev, VIA_UDMA_TIMING, &u);
else u = 0;
for (i = 0; i < 4; i++) {
setup[i] = ((t >> ((3 - i) << 1)) & 0x3) + 1;
recover8b[i] = ((w >> ((1 - (i >> 1)) << 3)) & 0xf) + 1;
active8b[i] = ((w >> (((1 - (i >> 1)) << 3) + 4)) & 0xf) + 1;
active[i] = ((v >> (((3 - i) << 3) + 4)) & 0xf) + 1;
recover[i] = ((v >> ((3 - i) << 3)) & 0xf) + 1;
udma[i] = ((u >> ((3 - i) << 3)) & 0x7) + 2;
umul[i] = ((u >> (((3 - i) & 2) << 3)) & 0x8) ? 1 : 2;
uen[i] = ((u >> ((3 - i) << 3)) & 0x20);
den[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2));
speed[i] = 2 * system_bus_speed / (active[i] + recover[i]);
cycle[i] = 1000000 * (active[i] + recover[i]) / system_bus_speed;
if (!uen[i] || !den[i])
continue;
switch (via_config->flags & VIA_UDMA) {
case VIA_UDMA_33:
speed[i] = 2 * system_bus_speed / udma[i];
cycle[i] = 1000000 * udma[i] / system_bus_speed;
break;
case VIA_UDMA_66:
speed[i] = 4 * system_bus_speed / (udma[i] * umul[i]);
cycle[i] = 500000 * (udma[i] * umul[i]) / system_bus_speed;
break;
case VIA_UDMA_100:
speed[i] = 6 * system_bus_speed / udma[i];
cycle[i] = 333333 * udma[i] / system_bus_speed;
break;
case VIA_UDMA_133:
speed[i] = 8 * system_bus_speed / udma[i];
cycle[i] = 250000 * udma[i] / system_bus_speed;
break;
}
}
via_print_drive("Transfer Mode: ", "%10s", den[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO");
via_print_drive("Address Setup: ", "%8dns", 1000000 * setup[i] / system_bus_speed);
via_print_drive("Cmd Active: ", "%8dns", 1000000 * active8b[i] / system_bus_speed);
via_print_drive("Cmd Recovery: ", "%8dns", 1000000 * recover8b[i] / system_bus_speed);
via_print_drive("Data Active: ", "%8dns", 1000000 * active[i] / system_bus_speed);
via_print_drive("Data Recovery: ", "%8dns", 1000000 * recover[i] / system_bus_speed);
via_print_drive("Cycle Time: ", "%8dns", cycle[i]);
via_print_drive("Transfer Rate: ", "%4d.%dMB/s", speed[i] / 1000, speed[i] / 100 % 10);
return p - buffer; /* hoping it is less than 4K... */
}
#endif
/*
* via_set_speed() writes timing values to the chipset registers
*/
......
......@@ -196,17 +196,15 @@ setup_avm_a1(struct IsdnCard *card)
cs->hw.avm.hscxfifo[0] = card->para[1];
cs->hw.avm.hscxfifo[1] = card->para[1] + 0x800;
cs->irq = card->para[0];
if (check_region((cs->hw.avm.cfg_reg), 8)) {
if (!request_region(cs->hw.avm.cfg_reg, 8, "avm cfg")) {
printk(KERN_WARNING
"HiSax: %s config port %x-%x already in use\n",
CardType[card->typ],
cs->hw.avm.cfg_reg,
cs->hw.avm.cfg_reg + 8);
return (0);
} else {
request_region(cs->hw.avm.cfg_reg, 8, "avm cfg");
}
if (check_region((cs->hw.avm.isac + 32), 32)) {
if (!request_region(cs->hw.avm.isac + 32, 32, "HiSax isac")) {
printk(KERN_WARNING
"HiSax: %s isac ports %x-%x already in use\n",
CardType[cs->typ],
......@@ -214,20 +212,16 @@ setup_avm_a1(struct IsdnCard *card)
cs->hw.avm.isac + 64);
release_ioregs(cs, 0);
return (0);
} else {
request_region(cs->hw.avm.isac + 32, 32, "HiSax isac");
}
if (check_region((cs->hw.avm.isacfifo), 1)) {
if (!request_region(cs->hw.avm.isacfifo, 1, "HiSax isac fifo")) {
printk(KERN_WARNING
"HiSax: %s isac fifo port %x already in use\n",
CardType[cs->typ],
cs->hw.avm.isacfifo);
release_ioregs(cs, 1);
return (0);
} else {
request_region(cs->hw.avm.isacfifo, 1, "HiSax isac fifo");
}
if (check_region((cs->hw.avm.hscx[0]) + 32, 32)) {
if (!request_region(cs->hw.avm.hscx[0] + 32, 32, "HiSax hscx A")) {
printk(KERN_WARNING
"HiSax: %s hscx A ports %x-%x already in use\n",
CardType[cs->typ],
......@@ -235,20 +229,16 @@ setup_avm_a1(struct IsdnCard *card)
cs->hw.avm.hscx[0] + 64);
release_ioregs(cs, 3);
return (0);
} else {
request_region(cs->hw.avm.hscx[0] + 32, 32, "HiSax hscx A");
}
if (check_region(cs->hw.avm.hscxfifo[0], 1)) {
if (!request_region(cs->hw.avm.hscxfifo[0], 1, "HiSax hscx A fifo")) {
printk(KERN_WARNING
"HiSax: %s hscx A fifo port %x already in use\n",
CardType[cs->typ],
cs->hw.avm.hscxfifo[0]);
release_ioregs(cs, 7);
return (0);
} else {
request_region(cs->hw.avm.hscxfifo[0], 1, "HiSax hscx A fifo");
}
if (check_region(cs->hw.avm.hscx[1] + 32, 32)) {
if (!request_region(cs->hw.avm.hscx[1] + 32, 32, "HiSax hscx B")) {
printk(KERN_WARNING
"HiSax: %s hscx B ports %x-%x already in use\n",
CardType[cs->typ],
......@@ -256,18 +246,14 @@ setup_avm_a1(struct IsdnCard *card)
cs->hw.avm.hscx[1] + 64);
release_ioregs(cs, 0xf);
return (0);
} else {
request_region(cs->hw.avm.hscx[1] + 32, 32, "HiSax hscx B");
}
if (check_region(cs->hw.avm.hscxfifo[1], 1)) {
if (!request_region(cs->hw.avm.hscxfifo[1], 1, "HiSax hscx B fifo")) {
printk(KERN_WARNING
"HiSax: %s hscx B fifo port %x already in use\n",
CardType[cs->typ],
cs->hw.avm.hscxfifo[1]);
release_ioregs(cs, 0x1f);
return (0);
} else {
request_region(cs->hw.avm.hscxfifo[1], 1, "HiSax hscx B fifo");
}
save_flags(flags);
byteout(cs->hw.avm.cfg_reg, 0x0);
......
......@@ -598,15 +598,13 @@ check_arcofi(struct IsdnCardState *cs)
Elsa_Types[cs->subtyp],
cs->hw.elsa.base+8);
release_region(cs->hw.elsa.base, 8);
if (check_region(cs->hw.elsa.base, 16)) {
if (!request_region(cs->hw.elsa.base, 16,"elsa isdn modem")) {
printk(KERN_WARNING
"HiSax: %s config port %lx-%lx already in use\n",
Elsa_Types[cs->subtyp],
cs->hw.elsa.base + 8,
cs->hw.elsa.base + 16);
} else
request_region(cs->hw.elsa.base, 16,
"elsa isdn modem");
}
} else if (cs->subtyp==ELSA_PCC16) {
cs->subtyp = ELSA_PCF;
printk(KERN_INFO
......@@ -614,15 +612,13 @@ check_arcofi(struct IsdnCardState *cs)
Elsa_Types[cs->subtyp],
cs->hw.elsa.base+8);
release_region(cs->hw.elsa.base, 8);
if (check_region(cs->hw.elsa.base, 16)) {
if (!request_region(cs->hw.elsa.base, 16,"elsa isdn modem")) {
printk(KERN_WARNING
"HiSax: %s config port %lx-%lx already in use\n",
Elsa_Types[cs->subtyp],
cs->hw.elsa.base + 8,
cs->hw.elsa.base + 16);
} else
request_region(cs->hw.elsa.base, 16,
"elsa isdn modem");
}
} else
printk(KERN_INFO
"Elsa: %s detected modem at 0x%lx\n",
......@@ -1066,18 +1062,18 @@ setup_elsa(struct IsdnCard *card)
/* In case of the elsa pcmcia card, this region is in use,
reserved for us by the card manager. So we do not check it
here, it would fail. */
if (cs->typ != ISDN_CTYPE_ELSA_PCMCIA && check_region(cs->hw.elsa.base, bytecnt)) {
printk(KERN_WARNING
"HiSax: %s config port %#lx-%#lx already in use\n",
CardType[card->typ],
cs->hw.elsa.base,
cs->hw.elsa.base + bytecnt);
return (0);
} else {
request_region(cs->hw.elsa.base, bytecnt, "elsa isdn");
}
if (cs->typ != ISDN_CTYPE_ELSA_PCMCIA)
if (!request_region(cs->hw.elsa.base, bytecnt, "elsa isdn")) {
printk(KERN_WARNING
"HiSax: %s config port %#lx-%#lx already in use\n",
CardType[card->typ],
cs->hw.elsa.base,
cs->hw.elsa.base + bytecnt);
return (0);
}
if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI)) {
if (check_region(cs->hw.elsa.cfg, 0x80)) {
if (!pci_request_region(cs->hw.elsa.cfg, 0x80, "elsa isdn pci")) {
printk(KERN_WARNING
"HiSax: %s pci port %x-%x already in use\n",
CardType[card->typ],
......@@ -1085,8 +1081,6 @@ setup_elsa(struct IsdnCard *card)
cs->hw.elsa.cfg + 0x80);
release_region(cs->hw.elsa.base, bytecnt);
return (0);
} else {
request_region(cs->hw.elsa.cfg, 0x80, "elsa isdn pci");
}
}
#if ARCOFI_USE
......
......@@ -451,42 +451,45 @@ reserve_regions(struct IsdnCard *card, struct IsdnCardState *cs)
case R647:
base = cs->hw.gazel.hscx[0];
for (i = 0x0000; i < 0xC000; i += 0x1000) {
if (check_region(adr = (i + base), len = 16))
if (!request_region(adr = (i + base), len = 16, "gazel")) {
int j;
for (j = 0x0000; j < i; j += 0x1000)
release_region ((j + base), len);
goto error;
}
}
if (check_region(adr = (0xC000 + base), len = 1))
if (!request_region(adr = (0xC000 + base), len = 1, "gazel")) {
for (i = 0x0000; i < 0xC000; i += 0x1000)
release_region ((i + base), 16);
goto error;
for (i = 0x0000; i < 0xC000; i += 0x1000)
request_region(i + base, 16, "gazel");
request_region(0xC000 + base, 1, "gazel");
}
break;
case R685:
if (check_region(adr = cs->hw.gazel.hscx[0], len = 0x100))
if (!request_region(adr = cs->hw.gazel.hscx[0], len = 0x100, "gazel"))
goto error;
if (check_region(adr = cs->hw.gazel.cfg_reg, len = 0x80))
if (!request_region(adr = cs->hw.gazel.cfg_reg, len = 0x80, "gazel")) {
release_region (cs->hw.gazel.hscx[0], 0x100);
goto error;
}
request_region(cs->hw.gazel.hscx[0], 0x100, "gazel");
request_region(cs->hw.gazel.cfg_reg, 0x80, "gazel");
break;
case R753:
if (check_region(adr = cs->hw.gazel.ipac, len = 0x8))
if (!request_region(adr = cs->hw.gazel.ipac, len = 0x8, "gazel"))
goto error;
if (check_region(adr = cs->hw.gazel.cfg_reg, len = 0x80))
if (!request_region(adr = cs->hw.gazel.cfg_reg, len = 0x80, "gazel")) {
release_region (cs->hw.gazel.ipac, 0x8);
goto error;
}
request_region(cs->hw.gazel.ipac, 0x8, "gazel");
request_region(cs->hw.gazel.cfg_reg, 0x80, "gazel");
break;
case R742:
if (check_region(adr = cs->hw.gazel.ipac, len = 0x8))
if (!request_region(adr = cs->hw.gazel.ipac, len = 0x8, "gazel"))
goto error;
request_region(cs->hw.gazel.ipac, 0x8, "gazel");
break;
}
......
......@@ -370,7 +370,7 @@ static void hdlc_fill_fifo(struct fritz_bcs *bcs)
unsigned long flags;
unsigned char *p;
DBG(0x40, "");
DBG(0x40, "hdlc_fill_fifo");
if (skb->len == 0)
BUG();
......
......@@ -258,16 +258,15 @@ setup_niccy(struct IsdnCard *card)
cs->hw.niccy.cfg_reg = 0;
cs->subtyp = NICCY_PNP;
cs->irq = card->para[0];
if (check_region((cs->hw.niccy.isac), 2)) {
if (!request_region(cs->hw.niccy.isac, 2, "niccy data")) {
printk(KERN_WARNING
"HiSax: %s data port %x-%x already in use\n",
CardType[card->typ],
cs->hw.niccy.isac,
cs->hw.niccy.isac + 1);
return (0);
} else
request_region(cs->hw.niccy.isac, 2, "niccy data");
if (check_region((cs->hw.niccy.isac_ale), 2)) {
}
if (!request_region(cs->hw.niccy.isac_ale, 2, "niccy addr")) {
printk(KERN_WARNING
"HiSax: %s address port %x-%x already in use\n",
CardType[card->typ],
......@@ -275,8 +274,7 @@ setup_niccy(struct IsdnCard *card)
cs->hw.niccy.isac_ale + 1);
release_region(cs->hw.niccy.isac, 2);
return (0);
} else
request_region(cs->hw.niccy.isac_ale, 2, "niccy addr");
}
} else {
#if CONFIG_PCI
u_int pci_ioaddr;
......@@ -315,16 +313,15 @@ setup_niccy(struct IsdnCard *card)
cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR;
cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA;
cs->hw.niccy.hscx_ale = pci_ioaddr + HSCX_PCI_ADDR;
if (check_region((cs->hw.niccy.isac), 4)) {
if (!request_region(cs->hw.niccy.isac, 4, "niccy")) {
printk(KERN_WARNING
"HiSax: %s data port %x-%x already in use\n",
CardType[card->typ],
cs->hw.niccy.isac,
cs->hw.niccy.isac + 4);
return (0);
} else
request_region(cs->hw.niccy.isac, 4, "niccy");
if (check_region(cs->hw.niccy.cfg_reg, 0x40)) {
}
if (!request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci")) {
printk(KERN_WARNING
"HiSax: %s pci port %x-%x already in use\n",
CardType[card->typ],
......@@ -332,8 +329,6 @@ setup_niccy(struct IsdnCard *card)
cs->hw.niccy.cfg_reg + 0x40);
release_region(cs->hw.niccy.isac, 4);
return (0);
} else {
request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci");
}
#else
printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
......
......@@ -300,39 +300,36 @@ setup_teles3(struct IsdnCard *card)
cs->hw.teles3.hscxfifo[0] = cs->hw.teles3.hscx[0] + 0x3e;
cs->hw.teles3.hscxfifo[1] = cs->hw.teles3.hscx[1] + 0x3e;
if (cs->typ == ISDN_CTYPE_TELESPCMCIA) {
if (check_region((cs->hw.teles3.hscx[1]), 96 )) {
if (!request_region(cs->hw.teles3.hscx[1], 96, "HiSax Teles PCMCIA")) {
printk(KERN_WARNING
"HiSax: %s ports %x-%x already in use\n",
CardType[cs->typ],
cs->hw.teles3.hscx[1],
cs->hw.teles3.hscx[1] + 96);
return (0);
} else
request_region(cs->hw.teles3.hscx[1], 96, "HiSax Teles PCMCIA");
}
} else {
if (cs->hw.teles3.cfg_reg) {
if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
if (check_region((cs->hw.teles3.cfg_reg), 1)) {
if (!request_region(cs->hw.teles3.cfg_reg, 1, "teles3 cfg")) {
printk(KERN_WARNING
"HiSax: %s config port %x already in use\n",
CardType[card->typ],
cs->hw.teles3.cfg_reg);
return (0);
} else
request_region(cs->hw.teles3.cfg_reg, 1, "teles3 cfg");
}
} else {
if (check_region((cs->hw.teles3.cfg_reg), 8)) {
if (!request_region(cs->hw.teles3.cfg_reg, 8, "teles3 cfg")) {
printk(KERN_WARNING
"HiSax: %s config port %x-%x already in use\n",
CardType[card->typ],
cs->hw.teles3.cfg_reg,
cs->hw.teles3.cfg_reg + 8);
return (0);
} else
request_region(cs->hw.teles3.cfg_reg, 8, "teles3 cfg");
}
}
}
if (check_region((cs->hw.teles3.isac + 32), 32)) {
if (!request_region(cs->hw.teles3.isac + 32, 32, "HiSax isac")) {
printk(KERN_WARNING
"HiSax: %s isac ports %x-%x already in use\n",
CardType[cs->typ],
......@@ -346,9 +343,8 @@ setup_teles3(struct IsdnCard *card)
}
}
return (0);
} else
request_region(cs->hw.teles3.isac + 32, 32, "HiSax isac");
if (check_region((cs->hw.teles3.hscx[0] + 32), 32)) {
}
if (!request_region(cs->hw.teles3.hscx[0] + 32, 32, "HiSax hscx A")) {
printk(KERN_WARNING
"HiSax: %s hscx A ports %x-%x already in use\n",
CardType[cs->typ],
......@@ -363,9 +359,8 @@ setup_teles3(struct IsdnCard *card)
}
release_ioregs(cs, 1);
return (0);
} else
request_region(cs->hw.teles3.hscx[0] + 32, 32, "HiSax hscx A");
if (check_region((cs->hw.teles3.hscx[1] + 32), 32)) {
}
if (!request_region(cs->hw.teles3.hscx[1] + 32, 32, "HiSax hscx B")) {
printk(KERN_WARNING
"HiSax: %s hscx B ports %x-%x already in use\n",
CardType[cs->typ],
......@@ -380,8 +375,7 @@ setup_teles3(struct IsdnCard *card)
}
release_ioregs(cs, 3);
return (0);
} else
request_region(cs->hw.teles3.hscx[1] + 32, 32, "HiSax hscx B");
}
}
if ((cs->hw.teles3.cfg_reg) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA)) {
if ((val = bytein(cs->hw.teles3.cfg_reg + 0)) != 0x51) {
......
......@@ -122,6 +122,7 @@ static int irq_list[4] = { -1 };
MODULE_PARM(irq_mask, "i");
MODULE_PARM(irq_list, "1-4i");
MODULE_LICENSE("GPL");
/*====================================================================*/
......
......@@ -47,7 +47,7 @@ static int pci_device_probe(struct device * dev)
return error > 0 ? 0 : -ENODEV;
}
static int pci_device_remove(struct device * dev, u32 flags)
static int pci_device_remove(struct device * dev)
{
struct pci_dev * pci_dev = list_entry(dev,struct pci_dev,dev);
......
This diff is collapsed.
......@@ -34,7 +34,6 @@
#include <linux/smp_lock.h>
#include <linux/vmalloc.h>
#include <asm/system.h>
#include <asm/io.h>
#include <linux/blk.h>
......
......@@ -25,16 +25,16 @@
/*
* Flags for irregular SCSI devices that need special treatment
*/
#define BLIST_NOLUN 0x001 /* Don't scan for LUNs */
#define BLIST_FORCELUN 0x002 /* Known to have LUNs, force sanning */
#define BLIST_BORKEN 0x004 /* Flag for broken handshaking */
#define BLIST_KEY 0x008 /* Needs to be unlocked by special command */
#define BLIST_SINGLELUN 0x010 /* LUNs should better not be used in parallel */
#define BLIST_NOLUN 0x001 /* Don't scan for LUNs */
#define BLIST_FORCELUN 0x002 /* Known to have LUNs, force sanning */
#define BLIST_BORKEN 0x004 /* Flag for broken handshaking */
#define BLIST_KEY 0x008 /* Needs to be unlocked by special command */
#define BLIST_SINGLELUN 0x010 /* LUNs should better not be used in parallel */
#define BLIST_NOTQ 0x020 /* Buggy Tagged Command Queuing */
#define BLIST_SPARSELUN 0x040 /* Non consecutive LUN numbering */
#define BLIST_SPARSELUN 0x040 /* Non consecutive LUN numbering */
#define BLIST_MAX5LUN 0x080 /* Avoid LUNS >= 5 */
#define BLIST_ISDISK 0x100 /* Treat as (removable) disk */
#define BLIST_ISROM 0x200 /* Treat as (removable) CD-ROM */
#define BLIST_ISDISK 0x100 /* Treat as (removable) disk */
#define BLIST_ISROM 0x200 /* Treat as (removable) CD-ROM */
#define BLIST_LARGELUN 0x400 /* LUNs larger than 7 despite reporting as SCSI 2 */
#define BLIST_INQUIRY_36 0x800 /* override additional length field */
#define BLIST_INQUIRY_58 0x1000 /* ... for broken inquiry responses */
......@@ -86,7 +86,7 @@ static struct dev_info device_list[] =
{"MAXTOR", "MXT-1240S", "I1.2", BLIST_NOLUN}, /* Locks up when LUN>0 polled */
{"MAXTOR", "XT-4170S", "B5A", BLIST_NOLUN}, /* Locks-up sometimes when LUN>0 polled. */
{"MAXTOR", "XT-8760S", "B7B", BLIST_NOLUN}, /* guess what? */
{"MEDIAVIS", "RENO CD-ROMX2A", "2.03", BLIST_NOLUN}, /*Responds to all lun */
{"MEDIAVIS", "RENO CD-ROMX2A", "2.03", BLIST_NOLUN}, /* Responds to all lun */
{"NEC", "CD-ROM DRIVE:841", "1.0", BLIST_NOLUN}, /* Locks-up when LUN>0 polled. */
{"PHILIPS", "PCA80SC", "V4-2", BLIST_NOLUN}, /* Responds to all lun */
{"RODIME", "RO3000S", "2.33", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
......@@ -98,7 +98,7 @@ static struct dev_info device_list[] =
* SCSI code to reset bus.*/
{"SEAGATE", "ST296", "921", BLIST_NOLUN}, /* Responds to all lun */
{"SEAGATE", "ST1581", "6538", BLIST_NOLUN}, /* Responds to all lun */
{"SONY", "CD-ROM CDU-541", "4.3d", BLIST_NOLUN},
{"SONY", "CD-ROM CDU-541", "4.3d", BLIST_NOLUN},
{"SONY", "CD-ROM CDU-55S", "1.0i", BLIST_NOLUN},
{"SONY", "CD-ROM CDU-561", "1.7x", BLIST_NOLUN},
{"SONY", "CD-ROM CDU-8012", "*", BLIST_NOLUN},
......@@ -120,8 +120,7 @@ static struct dev_info device_list[] =
{"HP", "C1790A", "", BLIST_NOLUN}, /* scanjet iip */
{"HP", "C2500A", "", BLIST_NOLUN}, /* scanjet iicx */
{"YAMAHA", "CDR100", "1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
{"YAMAHA", "CDR102", "1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0
* extra reset */
{"YAMAHA", "CDR102", "1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0 extra reset */
{"YAMAHA", "CRW8424S", "1.0", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
{"YAMAHA", "CRW6416S", "1.0c", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
{"MITSUMI", "CD-R CR-2201CS", "6119", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
......@@ -453,7 +452,7 @@ void scan_scsis(struct Scsi_Host *shpnt,
else
lun0_sl = find_lun0_scsi_level(channel, dev, shpnt);
scan_scsis_single(channel, dev, lun, lun0_sl, &SDpnt, shpnt,
scsi_result);
scsi_result);
if (SDpnt != oldSDpnt) {
/* it could happen the blockdevice hasn't yet been inited */
......
......@@ -4,7 +4,13 @@
mainmenu_option next_comment
comment 'USB support'
dep_tristate 'Support for USB' CONFIG_USB $CONFIG_PCI
# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
if [ "$CONFIG_PCI" = "y" -o "$CONFIG_SA1111" = "y" ]; then
tristate 'Support for USB' CONFIG_USB
else
define_bool CONFIG_USB n
fi
if [ "$CONFIG_USB" = "y" -o "$CONFIG_USB" = "m" ]; then
source drivers/usb/core/Config.in
......
......@@ -6,9 +6,11 @@
mod-subdirs := serial
obj-$(CONFIG_USB) += core/
obj-$(CONFIG_USB_EHCI_HCD) += host/
obj-$(CONFIG_USB_OHCI_HCD) += host/
obj-$(CONFIG_USB_OHCI) += host/
obj-$(CONFIG_USB_OHCI_SA1111) += host/
obj-$(CONFIG_USB_SL811HS) += host/
obj-$(CONFIG_USB_UHCI_ALT) += host/
obj-$(CONFIG_USB_UHCI_HCD_ALT) += host/
......
......@@ -904,7 +904,8 @@ static void usb_find_drivers(struct usb_device *dev)
/* register this interface with driverfs */
interface->dev.parent = &dev->dev;
sprintf (&interface->dev.bus_id[0], "%03d", ifnum);
interface->dev.bus = &usb_bus_type;
sprintf (&interface->dev.bus_id[0], "%03d%03d", dev->devnum,ifnum);
sprintf (&interface->dev.name[0], "figure out some name...");
device_register (&interface->dev);
......@@ -2757,12 +2758,16 @@ struct list_head *usb_bus_get_list(void)
}
#endif
struct bus_type usb_bus_type = {
name: "usb",
};
/*
* Init
*/
static int __init usb_init(void)
{
bus_register(&usb_bus_type);
usb_major_init();
usbfs_init();
usb_hub_init();
......@@ -2775,6 +2780,7 @@ static int __init usb_init(void)
*/
static void __exit usb_exit(void)
{
put_bus(&usb_bus_type);
usb_major_cleanup();
usbfs_cleanup();
usb_hub_cleanup();
......
......@@ -20,5 +20,6 @@ fi
#fi
#dep_tristate ' OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support' CONFIG_USB_OHCI $CONFIG_USB
if [ "$CONFIG_ARM" = "y" ]; then
dep_tristate ' SA1111 OHCI-compatible host interface support' CONFIG_USB_OHCI_SA1111 $CONFIG_USB
dep_tristate ' SL811HS support' CONFIG_USB_SL811HS $CONFIG_USB
fi
......@@ -3,6 +3,8 @@
# framework and drivers
#
export-objs := usb-ohci.o
obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
obj-$(CONFIG_USB_UHCI_HCD) += usb-uhci-hcd.o
......@@ -10,7 +12,8 @@ obj-$(CONFIG_USB_UHCI_HCD_ALT) += uhci-hcd.o
obj-$(CONFIG_USB_UHCI) += usb-uhci.o
obj-$(CONFIG_USB_UHCI_ALT) += uhci.o
obj-$(CONFIG_USB_OHCI) += usb-ohci.o
obj-$(CONFIG_USB_OHCI) += usb-ohci.o usb-ohci-pci.o
obj-$(CONFIG_USB_OHCI_SA1111) += usb-ohci.o usb-ohci-sa1111.o
obj-$(CONFIG_USB_SL811HS) += hc_sl811.o
include $(TOPDIR)/Rules.make
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -403,6 +403,7 @@ typedef struct ohci {
/* PCI device handle, settings, ... */
struct pci_dev *ohci_dev;
const char *slot_name;
u8 pci_latency;
struct pci_pool *td_cache;
struct pci_pool *dev_cache;
......@@ -423,6 +424,10 @@ struct ohci_device {
// #define ohci_to_usb(ohci) ((ohci)->usb)
#define usb_to_ohci(usb) ((struct ohci_device *)(usb)->hcpriv)
/* For initializing controller (mask in an HCFS mode too) */
#define OHCI_CONTROL_INIT \
(OHCI_CTRL_CBSR & 0x3) | OHCI_CTRL_IE | OHCI_CTRL_PLE
/* hcd */
/* endpoint */
static int ep_link(ohci_t * ohci, ed_t * ed);
......@@ -447,11 +452,6 @@ static int rh_init_int_timer(struct urb * urb);
# define OHCI_MEM_FLAGS 0
#endif
#ifndef CONFIG_PCI
# error "usb-ohci currently requires PCI-based controllers"
/* to support non-PCI OHCIs, you need custom bus/mem/... glue */
#endif
/* Recover a TD/ED using its collision chain */
static void *
......@@ -641,3 +641,8 @@ dev_free (struct ohci *hc, struct ohci_device *dev)
pci_pool_free (hc->dev_cache, dev, dev->dma);
}
extern spinlock_t usb_ed_lock;
extern void dl_done_list (ohci_t * ohci, td_t * td_list);
extern td_t * dl_reverse_done_list (ohci_t * ohci);
This diff is collapsed.
......@@ -386,9 +386,9 @@ Scsi_Host_Template usb_stor_host_template = {
unsigned char usb_stor_sense_notready[18] = {
[0] = 0x70, /* current error */
[2] = 0x02, /* not ready */
[5] = 0x0a, /* additional length */
[10] = 0x04, /* not ready */
[11] = 0x03 /* manual intervention */
[7] = 0x0a, /* additional length */
[12] = 0x04, /* not ready */
[13] = 0x03 /* manual intervention */
};
#define USB_STOR_SCSI_SENSE_HDRSZ 4
......
This diff is collapsed.
......@@ -132,7 +132,7 @@ __adfs_block_map(struct super_block *sb, unsigned int object_id,
unsigned int off;
off = (object_id & 255) - 1;
block += off << sb->u.adfs_sb.s_log2sharesize;
block += off << ADFS_SB(sb)->s_log2sharesize;
}
return adfs_map_lookup(sb, object_id >> 8, block);
......
This diff is collapsed.
......@@ -25,7 +25,8 @@
#include <linux/fcntl.h>
#include <linux/time.h>
#include <linux/stat.h>
#include <linux/buffer_head.h> /* for file_fsync() */
#include <linux/buffer_head.h> /* for file_fsync() */
#include <linux/adfs_fs.h>
#include "adfs.h"
......
This diff is collapsed.
......@@ -238,7 +238,7 @@ scan_map(struct adfs_sb_info *asb, unsigned int zone,
unsigned int
adfs_map_free(struct super_block *sb)
{
struct adfs_sb_info *asb = &sb->u.adfs_sb;
struct adfs_sb_info *asb = ADFS_SB(sb);
struct adfs_discmap *dm;
unsigned int total = 0;
unsigned int zone;
......
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