conswitchp = &dummy_con;
#endif
#endif
- /*
- * Check the bugs that will bite us before we get booting
- */
-
}
__initfunc(static int get_model_name(struct cpuinfo_x86 *c))
#include <linux/malloc.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
-#include <linux/bios32.h>
#include <linux/timer.h>
#include <asm/irq.h> /* For NR_IRQS only. */
#include <asm/bitops.h>
int scan_status;
int board_index = 0;
unsigned char pci_irq_line;
- unsigned short pci_command, vendor, device, class;
unsigned int pci_ioaddr;
-
+ struct pci_dev *pdev;
scan_status =
(pcibios_find_device (RC_PCI45_VENDOR_ID,
#ifdef RCDEBUG
printk("rc scan_status = 0x%X\n", scan_status);
#endif
- if (scan_status != PCIBIOS_SUCCESSFUL)
+ if (scan_status != PCIBIOS_SUCCESSFUL ||
+ !((pdev = pci_find_slot(pci_bus, pci_device_fn))))
break;
- pcibios_read_config_word(pci_bus,
- pci_device_fn,
- PCI_VENDOR_ID, &vendor);
- pcibios_read_config_word(pci_bus,
- pci_device_fn,
- PCI_DEVICE_ID, &device);
- pcibios_read_config_byte(pci_bus,
- pci_device_fn,
- PCI_INTERRUPT_LINE, &pci_irq_line);
- pcibios_read_config_dword(pci_bus,
- pci_device_fn,
- PCI_BASE_ADDRESS_0, &pci_ioaddr);
- pcibios_read_config_word(pci_bus,
- pci_device_fn,
- PCI_CLASS_DEVICE, &class);
-
- pci_ioaddr &= ~0xf;
+ pci_irq_line = pdev->irq;
+ pci_ioaddr = pdev->base_address[0];
+ pci_ioaddr &= PCI_BASE_ADDRESS_MEM_MASK;
#ifdef RCDEBUG
printk("rc: Found RedCreek PCI adapter\n");
- printk("rc: pci class = 0x%x 0x%x \n", class, class>>8);
printk("rc: pci_bus = %d, pci_device_fn = %d\n", pci_bus, pci_device_fn);
printk("rc: pci_irq_line = 0x%x \n", pci_irq_line);
printk("rc: pci_ioaddr = 0x%x\n", pci_ioaddr);
#endif
- if (check_region(pci_ioaddr, 2*32768))
- {
- printk("rc: check_region failed\n");
- continue;
- }
-#ifdef RCDEBUG
- else
- {
- printk("rc: check_region passed\n");
- }
-#endif
-
- /*
- * Get and check the bus-master and latency values.
- * Some PCI BIOSes fail to set the master-enable bit.
- */
+ pci_set_master(pdev);
- pcibios_read_config_word(pci_bus,
- pci_device_fn,
- PCI_COMMAND,
- &pci_command);
- if ( ! (pci_command & PCI_COMMAND_MASTER)) {
- printk("rc: PCI Master Bit has not been set!\n");
-
- pci_command |= PCI_COMMAND_MASTER;
- pcibios_write_config_word(pci_bus,
- pci_device_fn,
- PCI_COMMAND,
- pci_command);
- }
- if ( ! (pci_command & PCI_COMMAND_MEMORY)) {
- /*
- * If the BIOS did not set the memory enable bit, what else
- * did it not initialize? Skip this adapter.
- */
- printk("rc: Adapter %d, PCI Memory Bit has not been set!\n",
- cards_found);
- printk("rc: Bios problem? \n");
- continue;
- }
-
if (!RCfound_device(dev, pci_ioaddr, pci_irq_line,
pci_bus, pci_device_fn,
board_index++, cards_found))
#include <linux/ptrace.h>
#include <linux/types.h>
#include <linux/kernel.h>
-#include <linux/bios32.h>
#include <linux/pci.h>
#include <linux/string.h>
#include <linux/nubus.h>
vendor, device);
}
- str = 0; /* to keep gcc shut... */
switch (status & PCI_STATUS_DEVSEL_MASK) {
case PCI_STATUS_DEVSEL_FAST: str = "Fast devsel. "; break;
case PCI_STATUS_DEVSEL_MEDIUM: str = "Medium devsel. "; break;
case PCI_STATUS_DEVSEL_SLOW: str = "Slow devsel. "; break;
+ default: str = "Unknown devsel. ";
}
if (len + strlen(str) > size) {
return -1;
#include <linux/ioport.h>
#include <linux/malloc.h>
#include <linux/in.h>
-#include <linux/bios32.h>
#include <linux/pci.h>
#include <linux/proc_fs.h>
#include <linux/delay.h>
void find_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt)
{
-
#ifndef CONFIG_PCI
printk("eata_dma: kernel PCI support not enabled. Skipping scan for PCI HBAs.\n");
#else
-
- u8 pci_bus, pci_device_fn;
- static s16 pci_index = 0; /* Device index to PCI BIOS calls */
- u32 base = 0;
- u16 com_adr;
- u16 rev_device;
- u32 error, i, x;
+ struct pci_dev *dev;
+ u32 base, x;
u8 pal1, pal2, pal3;
- if (pci_present()) {
- for (i = 0; i <= MAXPCI; ++i, ++pci_index) {
- if (pcibios_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT,
- pci_index, &pci_bus, &pci_device_fn))
- break;
+ for(dev=NULL; dev = pci_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT, dev);) {
DBG(DBG_PROBE && DBG_PCI,
- printk("eata_dma: find_PCI, HBA at bus %d, device %d,"
- " function %d, index %d\n", (s32)pci_bus,
- (s32)((pci_device_fn & 0xf8) >> 3),
- (s32)(pci_device_fn & 7), pci_index));
-
- if (!(error = pcibios_read_config_word(pci_bus, pci_device_fn,
- PCI_CLASS_DEVICE, &rev_device))) {
- if (rev_device == PCI_CLASS_STORAGE_SCSI) {
- if (!(error = pcibios_read_config_word(pci_bus,
- pci_device_fn, PCI_COMMAND,
- (u16 *) & com_adr))) {
- if (!((com_adr & PCI_COMMAND_IO) &&
- (com_adr & PCI_COMMAND_MASTER))) {
- printk("eata_dma: find_PCI, HBA has IO or"
- " BUSMASTER mode disabled\n");
- continue;
- }
- } else
- printk("eata_dma: find_PCI, error %x while reading "
- "PCI_COMMAND\n", error);
- } else
- printk("eata_dma: find_PCI, DEVICECLASSID %x didn't match\n",
- rev_device);
- } else {
- printk("eata_dma: find_PCI, error %x while reading "
- "PCI_CLASS_BASE\n",
- error);
+ printk("eata_dma: find_PCI, HBA at %s\n", dev->name));
+ pci_set_master(dev);
+ base = dev->base_address[0];
+ if (!(base & PCI_BASE_ADDRESS_SPACE_IO)) {
+ printk("eata_dma: invalid base address of device %s\n", dev->name);
continue;
}
-
- if (!(error = pcibios_read_config_dword(pci_bus, pci_device_fn,
- PCI_BASE_ADDRESS_0, (int *) &base))){
-
- /* Check if the address is valid */
- if (base & 0x01) {
- base &= 0xfffffffe;
- /* EISA tag there ? */
- pal1 = inb(base);
- pal2 = inb(base + 1);
- pal3 = inb(base + 2);
- if (((pal1 == DPT_ID1) && (pal2 == DPT_ID2)) ||
- ((pal1 == NEC_ID1) && (pal2 == NEC_ID2) &&
- (pal3 == NEC_ID3)) ||
- ((pal1 == ATT_ID1) && (pal2 == ATT_ID2) &&
- (pal3 == ATT_ID3)))
- base += 0x08;
- else
- base += 0x10; /* Now, THIS is the real address */
-
- if (base != 0x1f8) {
- /* We didn't find it in the primary search */
- if (get_conf_PIO(base, buf) == TRUE) {
-
- /* OK. We made it till here, so we can go now
- * and register it. We only have to check and
- * eventually remove it from the EISA and ISA list
- */
- DBG(DBG_PCI, printk("Registering PCI HBA\n"));
- register_HBA(base, buf, tpnt, IS_PCI);
-
- if (base < 0x1000) {
- for (x = 0; x < MAXISA; ++x) {
- if (ISAbases[x] == base) {
- ISAbases[x] = 0;
- break;
- }
- }
- } else if ((base & 0x0fff) == 0x0c88)
- EISAbases[(base >> 12) & 0x0f] = 0;
- continue; /* break; */
- }
-#if CHECK_BLINK
- else if (check_blink_state(base) == TRUE) {
- printk("eata_dma: HBA is in BLINK state.\n"
- "Consult your HBAs manual to correct this.\n");
+ base &= PCI_BASE_ADDRESS_IO_MASK;
+ /* EISA tag there ? */
+ pal1 = inb(base);
+ pal2 = inb(base + 1);
+ pal3 = inb(base + 2);
+ if (((pal1 == DPT_ID1) && (pal2 == DPT_ID2)) ||
+ ((pal1 == NEC_ID1) && (pal2 == NEC_ID2) &&
+ (pal3 == NEC_ID3)) ||
+ ((pal1 == ATT_ID1) && (pal2 == ATT_ID2) &&
+ (pal3 == ATT_ID3)))
+ base += 0x08;
+ else
+ base += 0x10; /* Now, THIS is the real address */
+ if (base != 0x1f8) {
+ /* We didn't find it in the primary search */
+ if (get_conf_PIO(base, buf) == TRUE) {
+ /* OK. We made it till here, so we can go now
+ * and register it. We only have to check and
+ * eventually remove it from the EISA and ISA list
+ */
+ DBG(DBG_PCI, printk("Registering PCI HBA\n"));
+ register_HBA(base, buf, tpnt, IS_PCI);
+
+ if (base < 0x1000) {
+ for (x = 0; x < MAXISA; ++x) {
+ if (ISAbases[x] == base) {
+ ISAbases[x] = 0;
+ break;
+ }
}
-#endif
- }
+ } else if ((base & 0x0fff) == 0x0c88)
+ EISAbases[(base >> 12) & 0x0f] = 0;
+ }
+#if CHECK_BLINK
+ else if (check_blink_state(base) == TRUE) {
+ printk("eata_dma: HBA is in BLINK state.\n"
+ "Consult your HBAs manual to correct this.\n");
}
- } else {
- printk("eata_dma: error %x while reading "
- "PCI_BASE_ADDRESS_0\n", error);
+#endif
}
}
- } else {
- printk("eata_dma: No BIOS32 extensions present. This driver release "
- "still depends on it.\n"
- " Skipping scan for PCI HBAs. \n");
- }
#endif /* #ifndef CONFIG_PCI */
- return;
}
int eata_detect(Scsi_Host_Template * tpnt)
#include <linux/ioport.h>
#include <linux/malloc.h>
#include <linux/in.h>
-#include <linux/bios32.h>
#include <linux/pci.h>
#include <linux/proc_fs.h>
#include <asm/io.h>
void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt)
{
-
#ifndef CONFIG_PCI
- printk(KERN_ERR "eata_pio: kernel PCI support not enabled. Skipping scan "
- "for PCI HBAs.\n");
+ printk("eata_dma: kernel PCI support not enabled. Skipping scan for PCI HBAs.\n");
#else
-
- u8 pci_bus, pci_device_fn;
- static s16 pci_index = 0; /* Device index to PCI BIOS calls */
- u32 base = 0;
- u16 com_adr;
- u16 rev_device;
- u32 error, i, x;
+ struct pci_dev *dev;
+ u32 base, x;
- if (pci_present()) {
- for (i = 0; i <= MAXPCI; ++i, ++pci_index) {
- if (pcibios_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT,
- pci_index, &pci_bus, &pci_device_fn))
- break;
+ for(dev=NULL; dev = pci_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT, dev);) {
DBG(DBG_PROBE && DBG_PCI,
- printk("eata_pio: HBA at bus %d, device %d,"
- " function %d, index %d\n", (s32)pci_bus,
- (s32)((pci_device_fn & 0xf8) >> 3),
- (s32)(pci_device_fn & 7), pci_index));
-
- if (!(error = pcibios_read_config_word(pci_bus, pci_device_fn,
- PCI_CLASS_DEVICE, &rev_device))) {
- if (rev_device == PCI_CLASS_STORAGE_SCSI) {
- if (!(error = pcibios_read_config_word(pci_bus,
- pci_device_fn, PCI_COMMAND,
- (u16 *) & com_adr))) {
- if (!((com_adr & PCI_COMMAND_IO) &&
- (com_adr & PCI_COMMAND_MASTER))) {
- printk("HBA has IO or BUSMASTER mode disabled\n");
- continue;
- }
- } else
- printk("eata_pio: error %x while reading "
- "PCI_COMMAND\n", error);
- } else
- printk("DEVICECLASSID %x didn't match\n", rev_device);
- } else {
- printk("eata_pio: error %x while reading PCI_CLASS_BASE\n",
- error);
+ printk("eata_pio: find_PCI, HBA at %s\n", dev->name));
+ pci_set_master(dev);
+ base = dev->base_address[0];
+ if (!(base & PCI_BASE_ADDRESS_SPACE_IO)) {
+ printk("eata_pio: invalid base address of device %s\n", dev->name);
continue;
}
-
- if (!(error = pcibios_read_config_dword(pci_bus, pci_device_fn,
- PCI_BASE_ADDRESS_0, (int *) &base))){
-
- /* Check if the address is valid */
- if (base & 0x01) {
- base &= 0xfffffffe;
- /* EISA tag there ? */
- if ((inb(base) == 0x12) && (inb(base + 1) == 0x14))
- continue; /* Jep, it's forced, so move on */
- base += 0x10; /* Now, THIS is the real address */
- if (base != 0x1f8) {
- /* We didn't find it in the primary search */
- if (get_pio_conf_PIO(base, buf) == TRUE) {
- if (buf->FORCADR) /* If the address is forced */
- continue; /* we'll find it later */
-
- /* OK. We made it till here, so we can go now
- * and register it. We only have to check and
- * eventually remove it from the EISA and ISA list
- */
-
- register_pio_HBA(base, buf, tpnt);
-
- if (base < 0x1000) {
- for (x = 0; x < MAXISA; ++x) {
- if (ISAbases[x] == base) {
- ISAbases[x] = 0;
- break;
- }
- }
- } else if ((base & 0x0fff) == 0x0c88) {
- x = (base >> 12) & 0x0f;
- EISAbases[x] = 0;
+ base &= PCI_BASE_ADDRESS_IO_MASK;
+ /* EISA tag there ? */
+ if ((inb(base) == 0x12) && (inb(base + 1) == 0x14))
+ continue; /* Jep, it's forced, so move on */
+ base += 0x10; /* Now, THIS is the real address */
+ if (base != 0x1f8) {
+ /* We didn't find it in the primary search */
+ if (get_pio_conf_PIO(base, buf) == TRUE) {
+ if (buf->FORCADR) /* If the address is forced */
+ continue; /* we'll find it later */
+
+ /* OK. We made it till here, so we can go now
+ * and register it. We only have to check and
+ * eventually remove it from the EISA and ISA list
+ */
+
+ register_pio_HBA(base, buf, tpnt);
+
+ if (base < 0x1000) {
+ for (x = 0; x < MAXISA; ++x) {
+ if (ISAbases[x] == base) {
+ ISAbases[x] = 0;
+ break;
}
- continue; /* break; */
}
+ } else if ((base & 0x0fff) == 0x0c88) {
+ x = (base >> 12) & 0x0f;
+ EISAbases[x] = 0;
}
+ }
+#if CHECK_BLINK
+ else if (check_blink_state(base) == TRUE) {
+ printk("eata_pio: HBA is in BLINK state.\n"
+ "Consult your HBAs manual to correct this.\n");
}
- } else
- printk("eata_pio: error %x while reading "
- "PCI_BASE_ADDRESS_0\n", error);
+#endif
+ }
}
- } else
- printk("eata_pio: No BIOS32 extensions present. This driver release "
- "still depends on it.\n"
- " Skipping scan for PCI HBAs.\n");
#endif /* #ifndef CONFIG_PCI */
- return;
}
goto out;
if (func == 1) {
-#if 0
struct mm_struct *user_mm;
/*
* bdflush will spend all of it's time in kernel-space,
user_mm = current->mm;
mmget(user_mm);
current->mm = NULL;
-#endif
+ /* active_mm is still 'user_mm' */
error = sync_old_buffers();
-#if 0
current->mm = user_mm;
mmput(current->active_mm);
current->active_mm = user_mm;
-#endif
goto out;
}
static int exec_mmap(void)
{
struct mm_struct * mm, * old_mm;
- int retval;
- if (current->mm && atomic_read(¤t->mm->count) == 1) {
- flush_cache_mm(current->mm);
+ /*
+ * NOTE: This works even if "old_mm" is a lazy
+ * memory state. If count == 1 at this point,
+ * we know that we're the only holders of that
+ * lazy mm, so we can turn it into a real mm.
+ */
+ old_mm = current->active_mm;
+ if (atomic_read(&old_mm->count) == 1) {
+ current->mm = old_mm;
+ flush_cache_mm(old_mm);
mm_release();
- release_segments(current->mm);
- exit_mmap(current->mm);
- flush_tlb_mm(current->mm);
+ release_segments(old_mm);
+ exit_mmap(old_mm);
+ flush_tlb_mm(old_mm);
return 0;
}
- retval = -ENOMEM;
mm = mm_alloc();
if (!mm)
goto fail_nomem;
mm->cpu_vm_mask = (1UL << smp_processor_id());
mm->total_vm = 0;
mm->rss = 0;
+ mm->pgd = pgd_alloc();
+ if (!mm->pgd)
+ goto fail_free;
- /*
- * Make sure we have a private LDT if needed ...
- */
- if (current->mm)
- copy_segments(current, mm);
-
- old_mm = current->mm;
current->mm = mm;
- retval = new_page_tables(current);
- if (retval)
- goto fail_restore;
+ current->active_mm = mm;
+ SET_PAGE_DIR(current, mm->pgd);
activate_context(current);
mm_release();
- if (old_mm)
- mmput(old_mm);
+ mmput(old_mm);
return 0;
- /*
- * Failure ... restore the prior mm_struct.
- */
-fail_restore:
- current->mm = old_mm;
- /* restore the ldt for this task */
- copy_segments(current, NULL);
- release_segments(mm);
+fail_free:
kmem_cache_free(mm_cachep, mm);
-
fail_nomem:
- return retval;
+ return -ENOMEM;
}
/*
+++ /dev/null
-/*
- * This is only a stub file to make drivers not yet converted to the new
- * PCI probing mechanism work. [mj]
- */
-
-#ifndef BIOS32_H
-#define BIOS32_H
-
-#include <linux/pci.h>
-
-#warning This driver uses the old PCI interface, please fix it (see Documentation/pci.txt)
-
-extern inline int __pcibios_read_irq(unsigned char bus, unsigned char dev_fn, unsigned char *to)
-{
- struct pci_dev *pdev = pci_find_slot(bus, dev_fn);
- if (!pdev) {
- *to = 0;
- return PCIBIOS_DEVICE_NOT_FOUND;
- } else {
- *to = pdev->irq;
- return PCIBIOS_SUCCESSFUL;
- }
-}
-
-extern inline int __pcibios_read_config_byte(unsigned char bus,
- unsigned char dev_fn, unsigned char where, unsigned char *to)
-{
- return pcibios_read_config_byte(bus, dev_fn, where, to);
-}
-
-#define pcibios_read_config_byte(b,d,w,p) \
- (((w) == PCI_INTERRUPT_LINE) ? __pcibios_read_irq(b,d,p) : __pcibios_read_config_byte(b,d,w,p))
-
-#endif
extern void free_page_tables(struct mm_struct * mm);
extern void clear_page_tables(struct mm_struct *, unsigned long, int);
-extern int new_page_tables(struct task_struct * tsk);
extern void zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size);
extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma);
/* Lazy TLB process? */
if (!mm) {
- struct mm_struct *active_mm = tsk->active_mm;
- mmget(&init_mm);
- tsk->active_mm = &init_mm;
- tsk->swappable = 0;
- SET_PAGE_DIR(tsk, swapper_pg_dir);
- if (active_mm)
- mmput(active_mm);
- return;
+ mm = tsk->active_mm;
+ goto drop_mm;
}
/* Set us up to use the kernel mm state */
/* This turns us into a task with no MM */
tsk->mm = NULL;
- tsk->active_mm = &init_mm;
+
+drop_mm:
mmget(&init_mm);
+ tsk->active_mm = &init_mm;
tsk->swappable = 0;
SET_PAGE_DIR(tsk, swapper_pg_dir);
mmput(mm);
void mmput(struct mm_struct *mm)
{
if (atomic_dec_and_test(&mm->count)) {
+ if (mm == &init_mm) BUG();
release_segments(mm);
exit_mmap(mm);
free_page_tables(mm);
tsk->cmin_flt = tsk->cmaj_flt = 0;
tsk->nswap = tsk->cnswap = 0;
+ tsk->mm = NULL;
+ tsk->active_mm = NULL;
+
/*
* Are we cloning a kernel thread?
+ *
+ * We need to steal a active VM for that..
*/
mm = current->mm;
- if (!mm) {
- tsk->active_mm = NULL;
+ if (!mm)
return 0;
- }
if (clone_flags & CLONE_VM) {
mmget(mm);
- /*
- * No need to worry about the LDT descriptor for the
- * cloned task, LDTs get magically loaded at
- * __switch_to time if necessary.
- */
- SET_PAGE_DIR(tsk, mm->pgd);
- return 0;
+ goto good_mm;
}
retval = -ENOMEM;
up(¤t->mm->mmap_sem);
if (retval)
goto free_pt;
+
+good_mm:
+ tsk->mm = mm;
+ tsk->active_mm = mm;
SET_PAGE_DIR(tsk, mm->pgd);
return 0;
free_mm:
- tsk->mm = NULL;
- release_segments(mm);
kmem_cache_free(mm_cachep, mm);
return retval;
free_pt:
- tsk->mm = NULL;
mmput(mm);
fail_nomem:
return retval;
*/
static inline void __schedule_tail(struct task_struct *prev)
{
+ struct mm_struct *mm = NULL;
+ if (!current->active_mm) BUG();
if (!prev->mm) {
- mmput(prev->active_mm);
+ mm = prev->active_mm;
prev->active_mm = NULL;
}
#ifdef __SMP__
wmb();
prev->has_cpu = 0;
#endif /* __SMP__ */
+
+ reacquire_kernel_lock(current);
+ /*
+ * mmput can sleep. As such, we have to wait until
+ * after we released "prev" back into the scheduler
+ * pool and until we have re-aquired out locking
+ * state until we can actually do this.
+ */
+ if (mm)
+ mmput(mm);
}
void schedule_tail(struct task_struct *prev)
struct list_head *tmp;
int this_cpu, c;
+ if (!current->active_mm) BUG();
if (tq_scheduler)
goto handle_tq_scheduler;
tq_scheduler_back:
get_mmu_context(next);
switch_to(prev, next, prev);
__schedule_tail(prev);
+ return;
same_process:
-
reacquire_kernel_lock(current);
return;
return;
}
-int new_page_tables(struct task_struct * tsk)
-{
- pgd_t * new_pg;
-
- if (!(new_pg = pgd_alloc()))
- return -ENOMEM;
- SET_PAGE_DIR(tsk, new_pg);
- tsk->mm->pgd = new_pg;
- return 0;
-}
-
#define PTE_TABLE_MASK ((PTRS_PER_PTE-1) * sizeof(pte_t))
#define PMD_TABLE_MASK ((PTRS_PER_PMD-1) * sizeof(pmd_t))
#if 1
/* FORCE A KERNEL DUMP WHEN THIS HAPPENS. SPEAK IN ALL CAPS. GET THE CALL CHAIN. */
-*(int *) 0 = 0;
+ BUG();
#endif
return;
read_lock(&tasklist_lock);
p = init_task.next_task;
for (; p != &init_task; p = p->next_task) {
- if (!p->swappable)
+ if (!p->swappable || !p->mm)
continue;
if (p->mm->rss <= 0)
continue;