Commit 7cc6719e authored by Jeff Garzik's avatar Jeff Garzik

Merge redhat.com:/spare/repo/linus-2.6

into redhat.com:/spare/repo/net-drivers-2.6
parents 6b711861 3a97fde4
......@@ -54,8 +54,6 @@
#include <asm/io.h>
#include <asm/bitops.h>
#include "ide_modes.h"
#if (DISK_RECOVERY_TIME > 0)
#error So the User Has To Fix the Compilation And Stop Hacking Port 0x43. Does anyone ever use this anyway ??
......
......@@ -22,8 +22,6 @@
#include <asm/io.h>
#include <asm/bitops.h>
#include "ide_modes.h"
/*
* IDE library routines. These are plug in code that most
* drivers can use but occasionally may be weird enough
......@@ -170,7 +168,7 @@ u8 ide_rate_filter (u8 mode, u8 speed)
BUG();
return min(speed, speed_max[mode]);
#else /* !CONFIG_BLK_DEV_IDEDMA */
return min(speed, XFER_PIO_4);
return min(speed, (u8)XFER_PIO_4);
#endif /* CONFIG_BLK_DEV_IDEDMA */
}
......@@ -188,6 +186,12 @@ int ide_dma_enable (ide_drive_t *drive)
EXPORT_SYMBOL(ide_dma_enable);
/*
* Standard (generic) timings for PIO modes, from ATA2 specification.
* These timings are for access to the IDE data port register *only*.
* Some drives may specify a mode, while also specifying a different
* value for cycle_time (from drive identification data).
*/
const ide_pio_timings_t ide_pio_timings[6] = {
{ 70, 165, 600 }, /* PIO Mode 0 */
{ 50, 125, 383 }, /* PIO Mode 1 */
......@@ -199,6 +203,13 @@ const ide_pio_timings_t ide_pio_timings[6] = {
EXPORT_SYMBOL_GPL(ide_pio_timings);
/*
* Shared data/functions for determining best PIO mode for an IDE drive.
* Most of this stuff originally lived in cmd640.c, and changes to the
* ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid
* breaking the fragile cmd640.c support.
*/
/*
* Black list. Some drives incorrectly report their maximal PIO mode,
* at least in respect to CMD640. Here we keep info on some known drives.
......
......@@ -649,10 +649,13 @@ static void hwif_register (ide_hwif_t *hwif)
/* register with global device tree */
strlcpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE);
hwif->gendev.driver_data = hwif;
if (hwif->pci_dev)
hwif->gendev.parent = &hwif->pci_dev->dev;
else
hwif->gendev.parent = NULL; /* Would like to do = &device_legacy */
if (hwif->gendev.parent == NULL) {
if (hwif->pci_dev)
hwif->gendev.parent = &hwif->pci_dev->dev;
else
/* Would like to do = &device_legacy */
hwif->gendev.parent = NULL;
}
device_register(&hwif->gendev);
}
......@@ -770,8 +773,7 @@ void probe_hwif (ide_hwif_t *hwif)
*/
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];
drive->dn = ((hwif->channel ? 2 : 0) + unit);
hwif->drives[unit].dn = ((hwif->channel ? 2 : 0) + unit);
drive->dn = (hwif->channel ? 2 : 0) + unit;
(void) probe_for_drive(drive);
if (drive->present && !hwif->present) {
hwif->present = 1;
......@@ -945,15 +947,10 @@ static int ide_init_queue(ide_drive_t *drive)
if (drive->disk)
drive->disk->queue = drive->queue;
return 0;
}
/*
* Setup the drive for request handling.
*/
static void ide_init_drive(ide_drive_t *drive)
{
/* needs drive->queue to be set */
ide_toggle_bounce(drive, 1);
return 0;
}
/*
......@@ -1068,10 +1065,9 @@ static int init_irq (ide_hwif_t *hwif)
}
/*
* Link any new drives into the hwgroup, allocate
* the block device queue and initialize the drive.
* Note that ide_init_drive sends commands to the new
* drive.
* For any present drive:
* - allocate the block device queue
* - link drive into the hwgroup
*/
for (index = 0; index < MAX_DRIVES; ++index) {
ide_drive_t *drive = &hwif->drives[index];
......@@ -1092,7 +1088,6 @@ static int init_irq (ide_hwif_t *hwif)
hwgroup->drive->next = drive;
}
spin_unlock_irq(&ide_lock);
ide_init_drive(drive);
}
#if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__)
......@@ -1303,31 +1298,6 @@ int hwif_init (ide_hwif_t *hwif)
EXPORT_SYMBOL(hwif_init);
int export_ide_init_queue (ide_drive_t *drive)
{
if (ide_init_queue(drive))
return 1;
ide_init_drive(drive);
return 0;
}
EXPORT_SYMBOL(export_ide_init_queue);
u8 export_probe_for_drive (ide_drive_t *drive)
{
return probe_for_drive(drive);
}
EXPORT_SYMBOL(export_probe_for_drive);
int ideprobe_init (void);
static ide_module_t ideprobe_module = {
IDE_PROBE_MODULE,
ideprobe_init,
NULL
};
int ideprobe_init (void)
{
unsigned int index;
......@@ -1359,7 +1329,7 @@ int ideprobe_init (void)
}
}
if (!ide_probe)
ide_probe = &ideprobe_module;
ide_probe = &ideprobe_init;
MOD_DEC_USE_COUNT;
return 0;
}
......
......@@ -161,8 +161,6 @@
#include <asm/io.h>
#include <asm/bitops.h>
#include "ide_modes.h"
/* default maximum number of failures */
#define IDE_DEFAULT_MAX_FAILURES 1
......@@ -180,7 +178,9 @@ static int initializing; /* set while initializing built-in drivers */
DECLARE_MUTEX(ide_cfg_sem);
spinlock_t ide_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
#ifdef CONFIG_BLK_DEV_IDEPCI
static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
#endif
#ifdef CONFIG_IDEDMA_AUTO
int noautodma = 0;
......@@ -190,11 +190,7 @@ int noautodma = 1;
EXPORT_SYMBOL(noautodma);
/*
* ide_modules keeps track of the available IDE chipset/probe/driver modules.
*/
ide_module_t *ide_chipsets;
ide_module_t *ide_probe;
int (*ide_probe)(void);
/*
* This is declared extern in ide.h, for access by other IDE modules:
......@@ -452,7 +448,7 @@ void ide_probe_module (void)
(void) request_module("ide-probe-mod");
#endif /* (CONFIG_KMOD) && (CONFIG_BLK_DEV_IDE_MODULE) */
} else {
(void) ide_probe->init();
(void)ide_probe();
}
}
......@@ -1045,21 +1041,6 @@ int ide_register_hw (hw_regs_t *hw, ide_hwif_t **hwifp)
EXPORT_SYMBOL(ide_register_hw);
/*
* Compatibility function with existing drivers. If you want
* something different, use the function above.
*/
int ide_register (int arg1, int arg2, int irq)
{
hw_regs_t hw;
ide_init_hwif_ports(&hw, (unsigned long) arg1, (unsigned long) arg2, NULL);
hw.irq = irq;
return ide_register_hw(&hw, NULL);
}
EXPORT_SYMBOL(ide_register);
/*
* Locks for IDE setting functionality
*/
......@@ -1658,11 +1639,15 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
case HDIO_SCAN_HWIF:
{
hw_regs_t hw;
int args[3];
if (!capable(CAP_SYS_RAWIO)) return -EACCES;
if (copy_from_user(args, (void *)arg, 3 * sizeof(int)))
return -EFAULT;
if (ide_register(args[0], args[1], args[2]) == -1)
ide_init_hwif_ports(&hw, (unsigned long) args[0],
(unsigned long) args[1], NULL);
hw.irq = args[2];
if (ide_register_hw(&hw, NULL) == -1)
return -EIO;
return 0;
}
......
/*
* linux/drivers/ide/ide_modes.h
*
* Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord
*/
#ifndef _IDE_MODES_H
#define _IDE_MODES_H
#include <linux/config.h>
/*
* Shared data/functions for determining best PIO mode for an IDE drive.
* Most of this stuff originally lived in cmd640.c, and changes to the
* ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid
* breaking the fragile cmd640.c support.
*/
/*
* Standard (generic) timings for PIO modes, from ATA2 specification.
* These timings are for access to the IDE data port register *only*.
* Some drives may specify a mode, while also specifying a different
* value for cycle_time (from drive identification data).
*/
typedef struct ide_pio_timings_s {
int setup_time; /* Address setup (ns) minimum */
int active_time; /* Active pulse (ns) minimum */
int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
} ide_pio_timings_t;
typedef struct ide_pio_data_s {
u8 pio_mode;
u8 use_iordy;
u8 overridden;
u8 blacklisted;
unsigned int cycle_time;
} ide_pio_data_t;
u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d);
extern const ide_pio_timings_t ide_pio_timings[6];
#endif /* _IDE_MODES_H */
......@@ -54,8 +54,6 @@
#include <asm/io.h>
#include "ide_modes.h"
/* port addresses for auto-detection */
#define ALI_NUM_PORTS 4
static int ports[ALI_NUM_PORTS] __initdata = {0x074, 0x0f4, 0x034, 0x0e4};
......
......@@ -21,8 +21,6 @@
#include <asm/io.h>
#include "ide_modes.h"
/*
* Changing this #undef to #define may solve start up problems in some systems.
*/
......
......@@ -53,8 +53,6 @@
#include <asm/io.h>
#include "ide_modes.h"
/* #define DEBUG */ /* remove comments for DEBUG messages */
/*
......
......@@ -42,7 +42,6 @@
#include <asm/system.h>
#include <asm/io.h>
#include "ide_modes.h"
#include "qd65xx.h"
/*
......
......@@ -54,8 +54,6 @@
#include <asm/io.h>
#include "ide_modes.h"
/*
* Default speeds. These can be changed with "auto-tune" and/or hdparm.
*/
......
......@@ -16,7 +16,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "aec62xx.h"
#if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -37,7 +37,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "alim15x3.h"
/*
......
......@@ -115,8 +115,6 @@
#include <asm/io.h>
#include "ide_modes.h"
/*
* This flag is set in ide.c by the parameter: ide0=cmd640_vlb
*/
......
......@@ -25,7 +25,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "cmd64x.h"
#if defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -51,7 +51,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ide_modes.h"
#include "cs5520.h"
#if defined(DISPLAY_CS5520_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -31,7 +31,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ide_modes.h"
#include "cs5530.h"
#if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -54,7 +54,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "cy82c693.h"
/*
......@@ -113,7 +112,7 @@ static void compute_clocks (u8 pio, pio_clocks_t *p_pclk)
/* note: we use the same values for 16bit IOR and IOW
* those are all the same, since I don't have other
* timings than those from ide_modes.h
* timings than those from ide-lib.c
*/
p_pclk->time_16r = (u8)clk1;
......
......@@ -42,7 +42,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ide_modes.h"
#include "hpt34x.h"
#if defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -62,7 +62,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ide_modes.h"
#include "hpt366.h"
#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
......@@ -989,7 +988,40 @@ static void __init init_hwif_hpt366 (ide_hwif_t *hwif)
hwif->intrproc = &hpt3xx_intrproc;
hwif->maskproc = &hpt3xx_maskproc;
pci_read_config_byte(hwif->pci_dev, 0x5a, &ata66);
/*
* The HPT37x uses the CBLID pins as outputs for MA15/MA16
* address lines to access an external eeprom. To read valid
* cable detect state the pins must be enabled as inputs.
*/
if (hpt_minimum_revision(dev, 8) && PCI_FUNC(dev->devfn) & 1) {
/*
* HPT374 PCI function 1
* - set bit 15 of reg 0x52 to enable TCBLID as input
* - set bit 15 of reg 0x56 to enable FCBLID as input
*/
u16 mcr3, mcr6;
pci_read_config_word(dev, 0x52, &mcr3);
pci_read_config_word(dev, 0x56, &mcr6);
pci_write_config_word(dev, 0x52, mcr3 | 0x8000);
pci_write_config_word(dev, 0x56, mcr6 | 0x8000);
/* now read cable id register */
pci_read_config_byte(dev, 0x5a, &ata66);
pci_write_config_word(dev, 0x52, mcr3);
pci_write_config_word(dev, 0x56, mcr6);
} else if (hpt_minimum_revision(dev, 3)) {
/*
* HPT370/372 and 374 pcifn 0
* - clear bit 0 of 0x5b to enable P/SCBLID as inputs
*/
u8 scr2;
pci_read_config_byte(dev, 0x5b, &scr2);
pci_write_config_byte(dev, 0x5b, scr2 & ~1);
/* now read cable id register */
pci_read_config_byte(dev, 0x5a, &ata66);
pci_write_config_byte(dev, 0x5b, scr2);
} else {
pci_read_config_byte(dev, 0x5a, &ata66);
}
#ifdef DEBUG
printk("HPT366: reg5ah=0x%02x ATA-%s Cable Port%d\n",
......
......@@ -42,7 +42,6 @@
#include <asm/io.h>
#include <asm/it8172/it8172_int.h>
#include "ide_modes.h"
#include "it8172.h"
/*
......
......@@ -104,7 +104,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "opti621.h"
#define OPTI621_MAX_PIO 3
......
......@@ -32,7 +32,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ide_modes.h"
#include "pdc202xx_new.h"
#define PDC202_DEBUG_CABLE 0
......
......@@ -46,7 +46,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ide_modes.h"
#include "pdc202xx_old.h"
#define PDC202_DEBUG_CABLE 0
......
......@@ -24,7 +24,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ide_modes.h"
#include "pdcadma.h"
#if defined(DISPLAY_PDCADMA_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -103,7 +103,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "piix.h"
static int no_piix_dma;
......
......@@ -29,7 +29,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ide_modes.h"
#include "sc1200.h"
#define SC1200_REV_A 0x00
......
......@@ -39,7 +39,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "serverworks.h"
static u8 svwks_revision = 0;
......
......@@ -15,7 +15,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "siimage.h"
#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -63,7 +63,6 @@
#include <asm/irq.h>
#include "ide-timing.h"
#include "ide_modes.h"
#include "sis5513.h"
/* registers layout and init values are chipset family dependant */
......
......@@ -29,7 +29,6 @@
#include <asm/io.h>
#include <asm/dma.h>
#include "ide_modes.h"
#include "sl82c105.h"
#undef DEBUG
......
......@@ -21,7 +21,6 @@
#include <asm/io.h>
#include "ide_modes.h"
#include "slc90e66.h"
#if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -41,7 +41,6 @@
#include <linux/ide.h>
#include <linux/init.h>
#include "ide_modes.h"
#include "triflex.h"
static struct pci_dev *triflex_dev;
......
......@@ -42,7 +42,6 @@
#include <asm/machdep.h>
#include <asm/irq.h>
#include "ide_modes.h"
static int identify (volatile u8 *p);
static void print_fixed (volatile u8 *p);
static void print_funcid (int func);
......
......@@ -42,7 +42,6 @@
#include <linux/adb.h>
#include <linux/pmu.h>
#endif
#include "ide_modes.h"
extern void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq);
......@@ -942,7 +941,7 @@ pmac_ide_build_sglist(ide_drive_t *drive, struct request *rq)
if (hwif->sg_dma_active)
BUG();
nents = blk_rq_map_sg(&drive->queue, rq, sg);
nents = blk_rq_map_sg(drive->queue, rq, sg);
if (rq_data_dir(rq) == READ)
pmif->sg_dma_direction = PCI_DMA_FROMDEVICE;
......
......@@ -1242,21 +1242,6 @@ typedef struct ide_driver_s {
extern int generic_ide_ioctl(struct block_device *, unsigned, unsigned long);
/*
* IDE modules.
*/
#define IDE_CHIPSET_MODULE 0 /* not supported yet */
#define IDE_PROBE_MODULE 1
typedef int (ide_module_init_proc)(void);
typedef struct ide_module_s {
int type;
ide_module_init_proc *init;
void *info;
struct ide_module_s *next;
} ide_module_t;
typedef struct ide_devices_s {
char name[4]; /* hdX */
unsigned attached : 1; /* native */
......@@ -1274,8 +1259,7 @@ typedef struct ide_devices_s {
*/
#ifndef _IDE_C
extern ide_hwif_t ide_hwifs[]; /* master data repository */
extern ide_module_t *ide_chipsets;
extern ide_module_t *ide_probe;
extern int (*ide_probe)(void);
extern ide_devices_t *idedisk;
extern ide_devices_t *idecd;
......@@ -1772,8 +1756,6 @@ extern int ide_hwif_request_regions(ide_hwif_t *hwif);
extern void ide_hwif_release_regions(ide_hwif_t* hwif);
extern void ide_unregister (unsigned int index);
extern int export_ide_init_queue(ide_drive_t *);
extern u8 export_probe_for_drive(ide_drive_t *);
extern int probe_hwif_init(ide_hwif_t *);
static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
......@@ -1794,6 +1776,24 @@ extern char *ide_xfer_verbose(u8 xfer_rate);
extern void ide_toggle_bounce(ide_drive_t *drive, int on);
extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
typedef struct ide_pio_timings_s {
int setup_time; /* Address setup (ns) minimum */
int active_time; /* Active pulse (ns) minimum */
int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
} ide_pio_timings_t;
typedef struct ide_pio_data_s {
u8 pio_mode;
u8 use_iordy;
u8 overridden;
u8 blacklisted;
unsigned int cycle_time;
} ide_pio_data_t;
extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d);
extern const ide_pio_timings_t ide_pio_timings[6];
extern spinlock_t ide_lock;
extern struct semaphore ide_cfg_sem;
/*
......
......@@ -707,7 +707,7 @@ asmlinkage long sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int ms
goto retry;
}
msq->q_lspid = current->pid;
msq->q_lspid = current->tgid;
msq->q_stime = get_seconds();
if(!pipelined_send(msq,msg)) {
......@@ -801,7 +801,7 @@ asmlinkage long sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz,
list_del(&msg->m_list);
msq->q_qnum--;
msq->q_rtime = get_seconds();
msq->q_lrpid = current->pid;
msq->q_lrpid = current->tgid;
msq->q_cbytes -= msg->m_ts;
atomic_sub(msg->m_ts,&msg_bytes);
atomic_dec(&msg_hdrs);
......
......@@ -664,7 +664,7 @@ static int semctl_main(int semid, int semnum, int cmd, int version, union semun
for (un = sma->undo; un; un = un->id_next)
un->semadj[semnum] = 0;
curr->semval = val;
curr->sempid = current->pid;
curr->sempid = current->tgid;
sma->sem_ctime = get_seconds();
/* maybe some queued-up processes were waiting for this */
update_queue(sma);
......@@ -1052,7 +1052,7 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops,
if (error)
goto out_unlock_free;
error = try_atomic_semop (sma, sops, nsops, un, current->pid);
error = try_atomic_semop (sma, sops, nsops, un, current->tgid);
if (error <= 0)
goto update;
......@@ -1064,7 +1064,7 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops,
queue.sops = sops;
queue.nsops = nsops;
queue.undo = un;
queue.pid = current->pid;
queue.pid = current->tgid;
queue.id = semid;
if (alter)
append_to_queue(sma ,&queue);
......@@ -1206,7 +1206,7 @@ void exit_sem(struct task_struct *tsk)
sem->semval += u->semadj[i];
if (sem->semval < 0)
sem->semval = 0; /* shouldn't happen */
sem->sempid = current->pid;
sem->sempid = current->tgid;
}
}
sma->sem_otime = get_seconds();
......
......@@ -89,7 +89,7 @@ static inline void shm_inc (int id) {
if(!(shp = shm_lock(id)))
BUG();
shp->shm_atim = get_seconds();
shp->shm_lprid = current->pid;
shp->shm_lprid = current->tgid;
shp->shm_nattch++;
shm_unlock(shp);
}
......@@ -136,7 +136,7 @@ static void shm_close (struct vm_area_struct *shmd)
/* remove from the list of attaches of the shm segment */
if(!(shp = shm_lock(id)))
BUG();
shp->shm_lprid = current->pid;
shp->shm_lprid = current->tgid;
shp->shm_dtim = get_seconds();
shp->shm_nattch--;
if(shp->shm_nattch == 0 &&
......@@ -209,7 +209,7 @@ static int newseg (key_t key, int shmflg, size_t size)
if(id == -1)
goto no_id;
shp->shm_cprid = current->pid;
shp->shm_cprid = current->tgid;
shp->shm_lprid = 0;
shp->shm_atim = shp->shm_dtim = 0;
shp->shm_ctim = get_seconds();
......
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