Commit 583f5775 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.3.30pre4

parent 66b21747
......@@ -85,3 +85,24 @@ The current implementation of the vmlist lock uses the page_table_lock,
which is also the spinlock that page stealers use to protect changes to
the victim process' ptes. Thus we have a reduction in the total number
of locks.
swap_list_lock/swap_device_lock
-------------------------------
The swap devices are chained in priority order from the "swap_list" header.
The "swap_list" is used for the round-robin swaphandle allocation strategy.
The #free swaphandles is maintained in "nr_swap_pages". These two together
are protected by the swap_list_lock.
The swap_device_lock, which is per swap device, protects the reference
counts on the corresponding swaphandles, maintained in the "swap_map"
array, and the "highest_bit" and "lowest_bit" fields.
Both of these are spinlocks, and are never acquired from intr level. The
locking heirarchy is swap_list_lock -> swap_device_lock.
To prevent races between swap space deletion or async readahead swapins
deciding whether a swap handle is being used, ie worthy of being read in
from disk, and an unmap -> swap_free making the handle unused, the swap
delete and readahead code grabs a temp reference on the swaphandle to
prevent warning messages from swap_duplicate <- read_swap_cache_async.
......@@ -14,7 +14,7 @@
O_TARGET := kernel.o
O_OBJS := entry.o traps.o process.o osf_sys.o irq.o signal.o setup.o \
ptrace.o time.o fpreg.o semaphore.o
ptrace.o time.o semaphore.o
OX_OBJS := alpha_ksyms.o
......
......@@ -103,7 +103,9 @@ EXPORT_SYMBOL(hwrpb);
EXPORT_SYMBOL(wrusp);
EXPORT_SYMBOL(start_thread);
EXPORT_SYMBOL(alpha_read_fp_reg);
EXPORT_SYMBOL(alpha_read_fp_reg_s);
EXPORT_SYMBOL(alpha_write_fp_reg);
EXPORT_SYMBOL(alpha_write_fp_reg_s);
/* In-kernel system calls. */
EXPORT_SYMBOL(kernel_thread);
......
......@@ -205,7 +205,7 @@ mk_conf_addr(struct pci_dev *dev, int where, struct pci_controler *hose,
static int
mcpcia_read_config_byte(struct pci_dev *dev, int where, u8 *value)
{
struct pci_controler *hose = dev->sysdata ? : probing_hose;
struct pci_controler *hose = dev->sysdata;
unsigned long addr, w;
unsigned char type1;
......@@ -221,7 +221,7 @@ mcpcia_read_config_byte(struct pci_dev *dev, int where, u8 *value)
static int
mcpcia_read_config_word(struct pci_dev *dev, int where, u16 *value)
{
struct pci_controler *hose = dev->sysdata ? : probing_hose;
struct pci_controler *hose = dev->sysdata;
unsigned long addr, w;
unsigned char type1;
......@@ -237,7 +237,7 @@ mcpcia_read_config_word(struct pci_dev *dev, int where, u16 *value)
static int
mcpcia_read_config_dword(struct pci_dev *dev, int where, u32 *value)
{
struct pci_controler *hose = dev->sysdata ? : probing_hose;
struct pci_controler *hose = dev->sysdata;
unsigned long addr;
unsigned char type1;
......@@ -252,7 +252,7 @@ mcpcia_read_config_dword(struct pci_dev *dev, int where, u32 *value)
static int
mcpcia_write_config(struct pci_dev *dev, int where, u32 value, long mask)
{
struct pci_controler *hose = dev->sysdata ? : probing_hose;
struct pci_controler *hose = dev->sysdata;
unsigned long addr;
unsigned char type1;
......
......@@ -26,6 +26,13 @@
int TSUNAMI_bootcpu;
static struct
{
unsigned long wsba[4];
unsigned long wsm[4];
unsigned long tba[4];
} saved_pchip[2];
/*
* NOTE: Herein lie back-to-back mb instructions. They are magic.
* One plausible explanation is that the I/O controller does not properly
......@@ -84,7 +91,7 @@ static int
mk_conf_addr(struct pci_dev *dev, int where, unsigned long *pci_addr,
unsigned char *type1)
{
struct pci_controler *hose = dev->sysdata ? : probing_hose;
struct pci_controler *hose = dev->sysdata;
unsigned long addr;
u8 bus = dev->bus->number;
u8 device_fn = dev->devfn;
......@@ -264,7 +271,7 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index)
hose->index = index;
hose->io_space->start = TSUNAMI_IO(index) - TSUNAMI_IO_BIAS;
hose->io_space->end = hose->io_space->start + 0xffff;
hose->io_space->end = hose->io_space->start + TSUNAMI_IO_SPACE - 1;
hose->io_space->name = pci_io_names[index];
hose->io_space->flags = IORESOURCE_IO;
......@@ -278,6 +285,27 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index)
if (request_resource(&iomem_resource, hose->mem_space) < 0)
printk(KERN_ERR "Failed to request MEM on hose %d\n", index);
/*
* Save the existing PCI window translations. SRM will
* need them when we go to reboot.
*/
saved_pchip[index].wsba[0] = pchip->wsba[0].csr;
saved_pchip[index].wsm[0] = pchip->wsm[0].csr;
saved_pchip[index].tba[0] = pchip->tba[0].csr;
saved_pchip[index].wsba[1] = pchip->wsba[1].csr;
saved_pchip[index].wsm[1] = pchip->wsm[1].csr;
saved_pchip[index].tba[1] = pchip->tba[1].csr;
saved_pchip[index].wsba[2] = pchip->wsba[2].csr;
saved_pchip[index].wsm[2] = pchip->wsm[2].csr;
saved_pchip[index].tba[2] = pchip->tba[2].csr;
saved_pchip[index].wsba[3] = pchip->wsba[3].csr;
saved_pchip[index].wsm[3] = pchip->wsm[3].csr;
saved_pchip[index].tba[3] = pchip->tba[3].csr;
/*
* Set up the PCI->physical memory translation windows.
* For now, windows 1,2 and 3 are disabled. In the future,
......@@ -352,6 +380,34 @@ tsunami_init_arch(void)
tsunami_init_one_pchip(TSUNAMI_pchip1, 1);
}
static void
tsunami_kill_one_pchip(tsunami_pchip *pchip, int index)
{
pchip->wsba[0].csr = saved_pchip[index].wsba[0];
pchip->wsm[0].csr = saved_pchip[index].wsm[0];
pchip->tba[0].csr = saved_pchip[index].tba[0];
pchip->wsba[1].csr = saved_pchip[index].wsba[1];
pchip->wsm[1].csr = saved_pchip[index].wsm[1];
pchip->tba[1].csr = saved_pchip[index].tba[1];
pchip->wsba[2].csr = saved_pchip[index].wsba[2];
pchip->wsm[2].csr = saved_pchip[index].wsm[2];
pchip->tba[2].csr = saved_pchip[index].tba[2];
pchip->wsba[3].csr = saved_pchip[index].wsba[3];
pchip->wsm[3].csr = saved_pchip[index].wsm[3];
pchip->tba[3].csr = saved_pchip[index].tba[3];
}
void
tsunami_kill_arch(int mode)
{
tsunami_kill_one_pchip(TSUNAMI_pchip0, 0);
if (TSUNAMI_cchip->csc.csr & 1L<<14)
tsunami_kill_one_pchip(TSUNAMI_pchip1, 1);
}
static inline void
tsunami_pci_clr_err_1(tsunami_pchip *pchip)
{
......
......@@ -392,8 +392,6 @@ static void *previous_irqholder = NULL;
static void show(char * str, void *where);
#define SYNC_OTHER_CPUS(x) udelay((x)+1);
static inline void
wait_on_irq(int cpu, void *where)
{
......@@ -414,7 +412,6 @@ wait_on_irq(int cpu, void *where)
/* Duh, we have to loop. Release the lock to avoid deadlocks */
spin_unlock(&global_irq_lock);
mb();
for (;;) {
if (!--count) {
......@@ -422,7 +419,7 @@ wait_on_irq(int cpu, void *where)
count = MAXCOUNT;
}
__sti();
SYNC_OTHER_CPUS(cpu);
udelay(1); /* make sure to run pending irqs */
__cli();
if (atomic_read(&global_irq_count))
......
......@@ -40,7 +40,6 @@ const char pci_hae0_name[] = "HAE0";
*/
struct pci_controler *hose_head, **hose_tail = &hose_head;
struct pci_controler *probing_hose;
/*
* Quirks.
......@@ -213,13 +212,12 @@ pcibios_fixup_bus(struct pci_bus *bus)
{
/* Propogate hose info into the subordinate devices. */
struct pci_controler *hose = probing_hose;
struct pci_controler *hose = (struct pci_controler *) bus->sysdata;
struct pci_dev *dev;
bus->resource[0] = hose->io_space;
bus->resource[1] = hose->mem_space;
for (dev = bus->devices; dev; dev = dev->sibling) {
dev->sysdata = hose;
if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
pcibios_fixup_device_resources(dev, bus);
}
......@@ -297,13 +295,11 @@ common_init_pci(void)
for (next_busno = 0, hose = hose_head; hose; hose = hose->next) {
hose->first_busno = next_busno;
hose->last_busno = 0xff;
probing_hose = hose;
bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose);
hose->bus = bus;
next_busno = hose->last_busno = bus->subordinate;
next_busno += 1;
}
probing_hose = NULL;
pci_assign_unassigned_resources(alpha_mv.min_io_address,
alpha_mv.min_mem_address);
......
......@@ -125,7 +125,6 @@ static inline u8 bridge_swizzle(u8 pin, u8 slot)
/* The hose list. */
extern struct pci_controler *hose_head, **hose_tail;
extern struct pci_controler *probing_hose;
extern void common_init_pci(void);
extern u8 common_swizzle(struct pci_dev *, u8 *);
......
......@@ -94,8 +94,8 @@ cpu_idle(void)
}
}
void
common_kill_arch (int mode, char *restart_cmd)
static void
common_shutdown(int mode, char *restart_cmd)
{
/* The following currently only has any effect on SRM. We should
fix MILO to understand it. Should be pretty easy. Also we can
......@@ -144,6 +144,9 @@ common_kill_arch (int mode, char *restart_cmd)
rtc_kill_pit();
#endif
if (alpha_mv.kill_arch)
alpha_mv.kill_arch(mode);
if (!alpha_using_srm && mode != LINUX_REBOOT_CMD_RESTART) {
/* Unfortunately, since MILO doesn't currently understand
the hwrpb bits above, we can't reliably halt the
......@@ -160,21 +163,23 @@ common_kill_arch (int mode, char *restart_cmd)
void
machine_restart(char *restart_cmd)
{
alpha_mv.kill_arch(LINUX_REBOOT_CMD_RESTART, restart_cmd);
common_shutdown(LINUX_REBOOT_CMD_RESTART, restart_cmd);
}
void
machine_halt(void)
{
alpha_mv.kill_arch(LINUX_REBOOT_CMD_HALT, NULL);
common_shutdown(LINUX_REBOOT_CMD_HALT, NULL);
}
void machine_power_off(void)
void
machine_power_off(void)
{
alpha_mv.kill_arch(LINUX_REBOOT_CMD_POWER_OFF, NULL);
common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
}
void show_regs(struct pt_regs * regs)
void
show_regs(struct pt_regs * regs)
{
printk("\nps: %04lx pc: [<%016lx>]\n", regs->ps, regs->pc);
printk("rp: [<%016lx>] sp: %p\n", regs->r26, regs+1);
......@@ -195,7 +200,8 @@ void show_regs(struct pt_regs * regs)
/*
* Re-start a thread when doing execve()
*/
void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
void
start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
{
set_fs(USER_DS);
regs->pc = pc;
......@@ -206,11 +212,13 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
/*
* Free current thread data structures etc..
*/
void exit_thread(void)
void
exit_thread(void)
{
}
void flush_thread(void)
void
flush_thread(void)
{
/* Arrange for each exec'ed process to start off with a clean slate
with respect to the FPU. This is all exceptions disabled. Note
......@@ -221,7 +229,8 @@ void flush_thread(void)
wrfpcr(FPCR_DYN_NORMAL | FPCR_INVD | FPCR_DZED | FPCR_OVFD | FPCR_INED);
}
void release_thread(struct task_struct *dead_task)
void
release_thread(struct task_struct *dead_task)
{
}
......@@ -234,15 +243,17 @@ void release_thread(struct task_struct *dead_task)
* Notice that "fork()" is implemented in terms of clone,
* with parameters (SIGCHLD, 0).
*/
int alpha_clone(unsigned long clone_flags, unsigned long usp,
struct switch_stack * swstack)
int
alpha_clone(unsigned long clone_flags, unsigned long usp,
struct switch_stack * swstack)
{
if (!usp)
usp = rdusp();
return do_fork(clone_flags, usp, (struct pt_regs *) (swstack+1));
}
int alpha_vfork(struct switch_stack * swstack)
int
alpha_vfork(struct switch_stack * swstack)
{
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(),
(struct pt_regs *) (swstack+1));
......@@ -259,8 +270,9 @@ int alpha_vfork(struct switch_stack * swstack)
* for a kernel fork().
*/
int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
struct task_struct * p, struct pt_regs * regs)
int
copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
struct task_struct * p, struct pt_regs * regs)
{
extern void ret_from_sys_call(void);
extern void ret_from_smp_fork(void);
......@@ -298,7 +310,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
/*
* fill in the user structure for a core dump..
*/
void dump_thread(struct pt_regs * pt, struct user * dump)
void
dump_thread(struct pt_regs * pt, struct user * dump)
{
/* switch stack follows right below pt_regs: */
struct switch_stack * sw = ((struct switch_stack *) pt) - 1;
......@@ -355,7 +368,8 @@ void dump_thread(struct pt_regs * pt, struct user * dump)
memcpy((char *)dump->regs + EF_SIZE, sw->fp, 32 * 8);
}
int dump_fpu (struct pt_regs * regs, elf_fpregset_t *r)
int
dump_fpu(struct pt_regs * regs, elf_fpregset_t *r)
{
/* switch stack follows right below pt_regs: */
struct switch_stack * sw = ((struct switch_stack *) regs) - 1;
......@@ -373,7 +387,8 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t *r)
*
* Don't do this at home.
*/
asmlinkage int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
asmlinkage int
sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4, unsigned long a5,
struct pt_regs regs)
{
......@@ -400,7 +415,8 @@ extern void scheduling_functions_end_here(void);
#define first_sched ((unsigned long) scheduling_functions_start_here)
#define last_sched ((unsigned long) scheduling_functions_end_here)
unsigned long get_wchan(struct task_struct *p)
unsigned long
get_wchan(struct task_struct *p)
{
unsigned long schedule_frame;
unsigned long pc;
......
......@@ -56,6 +56,7 @@ extern void t2_machine_check(u64, u64, struct pt_regs *);
/* core_tsunami.c */
extern struct pci_ops tsunami_pci_ops;
extern void tsunami_init_arch(void);
extern void tsunami_kill_arch(int);
extern void tsunami_machine_check(u64, u64, struct pt_regs *);
/* setup.c */
......@@ -110,7 +111,6 @@ extern void entUna(void);
extern void entDbg(void);
/* process.c */
extern void common_kill_arch (int mode, char *reboot_cmd);
extern void cpu_idle(void) __attribute__((noreturn));
/* ptrace.c */
......
......@@ -327,6 +327,28 @@ setup_memory(void)
}
#endif /* CONFIG_BLK_DEV_INITRD */
}
int __init page_is_ram(unsigned long pfn)
{
struct memclust_struct * cluster;
struct memdesc_struct * memdesc;
int i;
memdesc = (struct memdesc_struct *) (hwrpb->mddt_offset + (unsigned long) hwrpb);
for_each_mem_cluster(memdesc, cluster, i)
{
if (pfn >= cluster->start_pfn &&
pfn < cluster->start_pfn + cluster->numpages)
{
if (cluster->usage & 3)
return 0;
else
return 1;
}
}
return 0;
}
#undef PFN_UP
#undef PFN_DOWN
#undef PFN_PHYS
......
......@@ -396,6 +396,16 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
return 0;
}
static int __init fork_by_hand(void)
{
struct pt_regs regs;
/*
* don't care about the regs settings since
* we'll never reschedule the forked task.
*/
return do_fork(CLONE_VM|CLONE_PID, 0, &regs);
}
/*
* Bring one cpu online.
*/
......@@ -409,18 +419,25 @@ smp_boot_one_cpu(int cpuid, int cpunum)
to kernel_thread is irrelevant -- it's going to start where
HWRPB.CPU_restart says to start. But this gets all the other
task-y sort of data structures set up like we wish. */
kernel_thread((void *)__smp_callin, NULL, CLONE_PID|CLONE_VM);
/*
* We can't use kernel_thread since we must avoid to
* reschedule the child.
*/
if (fork_by_hand() < 0)
panic("failed fork for CPU %d", cpuid);
idle = init_task.prev_task;
if (!idle)
panic("No idle process for CPU %d", cpunum);
del_from_runqueue(idle);
init_tasks[cpunum] = idle;
idle->processor = cpuid;
panic("No idle process for CPU %d", cpuid);
/* Schedule the first task manually. */
/* ??? Ingo, what is this? */
idle->has_cpu = 1;
idle->processor = cpuid;
__cpu_logical_map[cpunum] = cpuid;
cpu_number_map[cpuid] = cpunum;
idle->has_cpu = 1; /* we schedule the first task manually */
del_from_runqueue(idle);
unhash_process(idle);
init_tasks[cpunum] = idle;
DBGS(("smp_boot_one_cpu: CPU %d state 0x%lx flags 0x%lx\n",
cpuid, idle->state, idle->flags));
......@@ -442,13 +459,18 @@ smp_boot_one_cpu(int cpuid, int cpunum)
barrier();
}
/* we must invalidate our stuff as we failed to boot the CPU */
__cpu_logical_map[cpunum] = -1;
cpu_number_map[cpuid] = -1;
/* the idle task is local to us so free it as we don't use it */
free_task_struct(idle);
printk(KERN_ERR "SMP: Processor %d is stuck.\n", cpuid);
return -1;
alive:
/* Another "Red Snapper". */
cpu_number_map[cpuid] = cpunum;
__cpu_logical_map[cpunum] = cpuid;
return 0;
}
......@@ -581,16 +603,6 @@ smp_commence(void)
mb();
}
/*
* Only broken Intel needs this, thus it should not even be
* referenced globally.
*/
void __init
initialize_secondary(void)
{
}
extern void update_one_process(struct task_struct *p, unsigned long ticks,
unsigned long user, unsigned long system,
......
......@@ -176,15 +176,13 @@ alcor_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
}
static void
alcor_kill_arch(int mode, char *reboot_cmd)
alcor_kill_arch(int mode)
{
/* Who said DEC engineer's have no sense of humor? ;-) */
if (alpha_using_srm) {
*(vuip) GRU_RESET = 0x0000dead;
mb();
}
common_kill_arch(mode, reboot_cmd);
}
......
......@@ -269,7 +269,7 @@ struct alpha_machine_vector cabriolet_mv __initmv = {
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: cabriolet_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: cabriolet_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -427,7 +427,7 @@ struct alpha_machine_vector dp264_mv __initmv = {
init_irq: dp264_init_irq,
init_pit: common_init_pit,
init_pci: dp264_init_pci,
kill_arch: common_kill_arch,
kill_arch: tsunami_kill_arch,
pci_map_irq: dp264_map_irq,
pci_swizzle: common_swizzle,
};
......@@ -454,7 +454,7 @@ struct alpha_machine_vector monet_mv __initmv = {
init_irq: dp264_init_irq,
init_pit: common_init_pit,
init_pci: monet_init_pci,
kill_arch: common_kill_arch,
kill_arch: tsunami_kill_arch,
pci_map_irq: monet_map_irq,
pci_swizzle: monet_swizzle,
};
......@@ -480,7 +480,7 @@ struct alpha_machine_vector webbrick_mv __initmv = {
init_irq: dp264_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: tsunami_kill_arch,
pci_map_irq: webbrick_map_irq,
pci_swizzle: common_swizzle,
};
......@@ -506,7 +506,7 @@ struct alpha_machine_vector clipper_mv __initmv = {
init_irq: clipper_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: tsunami_kill_arch,
pci_map_irq: clipper_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -183,7 +183,7 @@ struct alpha_machine_vector eb64p_mv __initmv = {
init_irq: eb64p_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: eb64p_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -208,7 +208,7 @@ struct alpha_machine_vector eiger_mv __initmv = {
init_irq: eiger_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: tsunami_kill_arch,
pci_map_irq: eiger_map_irq,
pci_swizzle: eiger_swizzle,
};
......
......@@ -140,6 +140,6 @@ struct alpha_machine_vector jensen_mv __initmv = {
init_irq: jensen_init_irq,
init_pit: common_init_pit,
init_pci: NULL,
kill_arch: common_kill_arch,
kill_arch: NULL,
};
ALIAS_MV(jensen)
......@@ -274,14 +274,13 @@ miata_init_pci(void)
}
static void
miata_kill_arch (int mode, char *reboot_cmd)
miata_kill_arch(int mode)
{
/* Who said DEC engineers have no sense of humor? ;-) */
if (alpha_using_srm) {
*(vuip) PYXIS_RESET = 0x0000dead;
mb();
}
common_kill_arch(mode, reboot_cmd);
}
......
......@@ -194,7 +194,7 @@ struct alpha_machine_vector mikasa_mv __initmv = {
init_irq: mikasa_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: mikasa_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -87,29 +87,16 @@ nautilus_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
}
void
nautilus_kill_arch (int mode, char *restart_cmd)
nautilus_kill_arch(int mode)
{
u8 tmp;
#ifdef CONFIG_RTC
rtc_kill_pit();
#endif
switch(mode) {
case LINUX_REBOOT_CMD_HALT:
printk("Press Reset bottun");
break;
case LINUX_REBOOT_CMD_RESTART:
if (mode == LINUX_REBOOT_CMD_RESTART) {
pcibios_read_config_byte(0, 0x38, 0x43, &tmp);
pcibios_write_config_byte(0, 0x38, 0x43, tmp | 0x80);
outb(1, 0x92);
outb(0, 0x92);
printk("Press Reset button");
break;
case LINUX_REBOOT_CMD_POWER_OFF:
}
while (1);
}
/* Machine check handler code
......
......@@ -254,7 +254,7 @@ struct alpha_machine_vector noritake_mv __initmv = {
init_irq: noritake_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: noritake_map_irq,
pci_swizzle: noritake_swizzle,
};
......
......@@ -200,7 +200,7 @@ struct alpha_machine_vector rawhide_mv __initmv = {
init_irq: rawhide_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: rawhide_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -212,15 +212,14 @@ ruffian_init_pit (void)
}
static void
ruffian_kill_arch (int mode, char *reboot_cmd)
ruffian_kill_arch (int mode)
{
#if 0
/* this only causes re-entry to ARCSBIOS */
/* This only causes re-entry to ARCSBIOS */
/* Perhaps this works for other PYXIS as well? */
*(vuip) PYXIS_RESET = 0x0000dead;
mb();
#endif
common_kill_arch(mode, reboot_cmd);
}
static int __init
......
......@@ -229,7 +229,7 @@ struct alpha_machine_vector rx164_mv __initmv = {
init_irq: rx164_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: rx164_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -248,7 +248,7 @@ struct alpha_machine_vector sable_mv __initmv = {
init_irq: sable_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: sable_map_irq,
pci_swizzle: common_swizzle,
......
......@@ -325,7 +325,7 @@ struct alpha_machine_vector alphabook1_mv __initmv = {
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: alphabook1_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
......
......@@ -211,7 +211,7 @@ struct alpha_machine_vector sx164_mv __initmv = {
init_irq: sx164_init_irq,
init_pit: common_init_pit,
init_pci: sx164_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: sx164_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -244,7 +244,7 @@ struct alpha_machine_vector takara_mv __initmv = {
init_irq: takara_init_irq,
init_pit: common_init_pit,
init_pci: takara_init_pci,
kill_arch: common_kill_arch,
kill_arch: NULL,
pci_map_irq: takara_map_irq,
pci_swizzle: takara_swizzle,
};
......
......@@ -113,7 +113,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
}
#ifndef CONFIG_MATHEMU
static long dummy_emul() { return 0; }
static long dummy_emul(void) { return 0; }
long (*alpha_fp_emul_imprecise)(struct pt_regs *regs, unsigned long writemask)
= (void *)dummy_emul;
long (*alpha_fp_emul) (unsigned long pc)
......
......@@ -7,7 +7,7 @@ OBJS = __divqu.o __remqu.o __divlu.o __remlu.o memset.o memcpy.o io.o \
strcat.o strcpy.o strncat.o strncpy.o stxcpy.o stxncpy.o \
strchr.o strrchr.o memchr.o \
copy_user.o clear_user.o strncpy_from_user.o strlen_user.o \
csum_ipv6_magic.o strcasecmp.o semaphore.o \
csum_ipv6_magic.o strcasecmp.o semaphore.o fpreg.o \
srm_dispatch.o srm_fixup.o srm_puts.o srm_printk.o
lib.a: $(OBJS)
......
/*
* arch/alpha/kernel/fpreg.c
* arch/alpha/lib/fpreg.c
*
* (C) Copyright 1998 Linus Torvalds
*/
......@@ -96,3 +96,96 @@ alpha_write_fp_reg (unsigned long reg, unsigned long val)
case 31: LDT(31, val); break;
}
}
#if defined(__alpha_cix__) || defined(__alpha_fix__)
#define STS(reg,val) asm volatile ("ftois $f"#reg",%0" : "=r"(val));
#else
#define STS(reg,val) asm volatile ("sts $f"#reg",%0" : "=m"(val));
#endif
unsigned long
alpha_read_fp_reg_s (unsigned long reg)
{
unsigned long val;
switch (reg) {
case 0: STS( 0, val); break;
case 1: STS( 1, val); break;
case 2: STS( 2, val); break;
case 3: STS( 3, val); break;
case 4: STS( 4, val); break;
case 5: STS( 5, val); break;
case 6: STS( 6, val); break;
case 7: STS( 7, val); break;
case 8: STS( 8, val); break;
case 9: STS( 9, val); break;
case 10: STS(10, val); break;
case 11: STS(11, val); break;
case 12: STS(12, val); break;
case 13: STS(13, val); break;
case 14: STS(14, val); break;
case 15: STS(15, val); break;
case 16: STS(16, val); break;
case 17: STS(17, val); break;
case 18: STS(18, val); break;
case 19: STS(19, val); break;
case 20: STS(20, val); break;
case 21: STS(21, val); break;
case 22: STS(22, val); break;
case 23: STS(23, val); break;
case 24: STS(24, val); break;
case 25: STS(25, val); break;
case 26: STS(26, val); break;
case 27: STS(27, val); break;
case 28: STS(28, val); break;
case 29: STS(29, val); break;
case 30: STS(30, val); break;
case 31: STS(31, val); break;
}
return val;
}
#if defined(__alpha_cix__) || defined(__alpha_fix__)
#define LDS(reg,val) asm volatile ("itofs %0,$f"#reg : : "r"(val));
#else
#define LDS(reg,val) asm volatile ("lds $f"#reg",%0" : : "m"(val));
#endif
void
alpha_write_fp_reg_s (unsigned long reg, unsigned long val)
{
switch (reg) {
case 0: LDS( 0, val); break;
case 1: LDS( 1, val); break;
case 2: LDS( 2, val); break;
case 3: LDS( 3, val); break;
case 4: LDS( 4, val); break;
case 5: LDS( 5, val); break;
case 6: LDS( 6, val); break;
case 7: LDS( 7, val); break;
case 8: LDS( 8, val); break;
case 9: LDS( 9, val); break;
case 10: LDS(10, val); break;
case 11: LDS(11, val); break;
case 12: LDS(12, val); break;
case 13: LDS(13, val); break;
case 14: LDS(14, val); break;
case 15: LDS(15, val); break;
case 16: LDS(16, val); break;
case 17: LDS(17, val); break;
case 18: LDS(18, val); break;
case 19: LDS(19, val); break;
case 20: LDS(20, val); break;
case 21: LDS(21, val); break;
case 22: LDS(22, val); break;
case 23: LDS(23, val); break;
case 24: LDS(24, val); break;
case 25: LDS(25, val); break;
case 26: LDS(26, val); break;
case 27: LDS(27, val); break;
case 28: LDS(28, val); break;
case 29: LDS(29, val); break;
case 30: LDS(30, val); break;
case 31: LDS(31, val); break;
}
}
#
# Makefile for math-emulator files...
# Makefile for the FPU instruction emulation.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definition is now in the main makefile...
O_TARGET := math-emu.o
O_OBJS := fp-emul.o ieee-math.o
O_OBJS := math.o
CFLAGS += -I. -I$(TOPDIR)/include/math-emu -w
ifeq ($(CONFIG_MATHEMU),m)
M_OBJS := $(O_TARGET)
......
/*
* These defines correspond to the dynamic rounding mode bits in the
* Floating Point Control Register. They also happen to correspond to
* the instruction encodings except that 0x03 signifies dynamic
* rounding mode in that case.
*/
#define ROUND_CHOP 0x00 /* chopped (aka round towards zero) */
#define ROUND_NINF 0x01 /* round towards negative infinity */
#define ROUND_NEAR 0x02 /* round towards nearest number */
#define ROUND_PINF 0x03 /* round towards positive infinity */
This diff is collapsed.
/*
* Copyright (C) 1992,1995 by
* Digital Equipment Corporation, Maynard, Massachusetts.
* This file may be redistributed according to the terms of the
* GNU General Public License.
*/
#ifndef __ieee_math_h__
#define __ieee_math_h__
#include <asm/fpu.h>
#define ROUND_SHIFT 6 /* make space for trap-enable bits */
#define RM(f) (((f) >> ROUND_SHIFT) & 0x3)
#define ROUND_CHOP (FPCR_DYN_CHOPPED >> FPCR_DYN_SHIFT)
#define ROUND_NINF (FPCR_DYN_MINUS >> FPCR_DYN_SHIFT)
#define ROUND_NEAR (FPCR_DYN_NORMAL >> FPCR_DYN_SHIFT)
#define ROUND_PINF (FPCR_DYN_PLUS >> FPCR_DYN_SHIFT)
extern unsigned long ieee_CVTST (int rm, unsigned long a, unsigned long *b);
extern unsigned long ieee_CVTTS (int rm, unsigned long a, unsigned long *b);
extern unsigned long ieee_CVTQS (int rm, unsigned long a, unsigned long *b);
extern unsigned long ieee_CVTQT (int rm, long a, unsigned long *b);
extern unsigned long ieee_CVTTQ (int rm, unsigned long a, unsigned long *b);
extern unsigned long ieee_CMPTEQ (unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_CMPTLT (unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_CMPTLE (unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_CMPTUN (unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_ADDS (int rm, unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_ADDT (int rm, unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_SUBS (int rm, unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_SUBT (int rm, unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_MULS (int rm, unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_MULT (int rm, unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_DIVS (int rm, unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_DIVT (int rm, unsigned long a, unsigned long b,
unsigned long *c);
extern unsigned long ieee_SQRTS (int rm, unsigned long a, unsigned long *b);
extern unsigned long ieee_SQRTT (int rm, unsigned long a, unsigned long *b);
#endif /* __ieee_math_h__ */
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <asm/byteorder.h>
#include <asm/fpu.h>
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
((sl) = (al) + (bl), (sh) = (ah) + (bh) + ((sl) < (al)))
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
((sl) = (al) - (bl), (sh) = (ah) - (bh) - ((al) < (bl)))
#define umul_ppmm(wh, wl, u, v) \
__asm__ ("mulq %2,%3,%1; umulh %2,%3,%0" \
: "=r" ((UDItype)(wh)), \
"=&r" ((UDItype)(wl)) \
: "r" ((UDItype)(u)), \
"r" ((UDItype)(v)))
extern void udiv128(unsigned long, unsigned long,
unsigned long, unsigned long,
unsigned long *,
unsigned long *);
#define udiv_qrnnd(q, r, n1, n0, d) \
do { \
unsigned long xr, xi; \
udiv128((n0), (n1), 0, (d), &xr, &xi); \
(q) = xr; \
(r) = xi; \
} while (0)
#define UDIV_NEEDS_NORMALIZATION 1
#define abort() goto bad_insn
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN -1
#endif
#define __BYTE_ORDER __LITTLE_ENDIAN
......@@ -273,12 +273,42 @@ srm_paging_stop (void)
}
#endif
static void printk_memory_info(void)
{
unsigned long codesize, reservedpages, datasize, initsize, tmp;
extern int page_is_ram(unsigned long) __init;
extern char _text, _etext, _data, _edata;
extern char __init_begin, __init_end;
/* printk all informations */
reservedpages = 0;
for (tmp = 0; tmp < max_low_pfn; tmp++)
/*
* Only count reserved RAM pages
*/
if (page_is_ram(tmp) && PageReserved(mem_map+tmp))
reservedpages++;
codesize = (unsigned long) &_etext - (unsigned long) &_text;
datasize = (unsigned long) &_edata - (unsigned long) &_data;
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, %luk data, %luk init)\n",
(unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
max_mapnr << (PAGE_SHIFT-10),
codesize >> 10,
reservedpages << (PAGE_SHIFT-10),
datasize >> 10,
initsize >> 10);
}
void
mem_init(void)
{
max_mapnr = num_physpages = max_low_pfn;
totalram_pages += free_all_bootmem();
printk("Memory: %luk available\n", totalram_pages << (PAGE_SHIFT-10));
printk_memory_info();
}
void
......
......@@ -156,7 +156,7 @@ endif
ifeq ($(CONFIG_ARCH_ACORN),y)
SUBDIRS += drivers/acorn
DRIVERS += drivers/acorn/block/acorn-block.a
DRIVERS += drivers/acorn/char/acorn-char.a
DRIVERS += drivers/acorn/char/acorn-char.o
DRIVERS += drivers/acorn/net/acorn-net.a
DRIVERS += drivers/acorn/scsi/acorn-scsi.a
endif
......
......@@ -203,6 +203,15 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
}
}
void __init
pcibios_fixup_pbus_ranges(struct pci_bus *bus, struct pbus_set_ranges_data *ranges)
{
ranges->io_start -= bus->resource[0]->start;
ranges->io_end -= bus->resource[0]->start;
ranges->mem_start -= bus->resource[1]->start;
ranges->mem_end -= bus->resource[1]->start;
}
static u8 __init no_swizzle(struct pci_dev *dev, u8 *pin)
{
return 0;
......
......@@ -43,7 +43,7 @@
#include <asm/hardware.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/mmu_context.h>
#ifdef CONFIG_ARCH_ARC
......
......@@ -899,7 +899,7 @@ __stubs_end:
b __real_stubs_start + (vector_IRQ - __stubs_start)
b __real_stubs_start + (vector_FIQ - __stubs_start)
ENTRY(trap_init)
ENTRY(__trap_init)
stmfd sp!, {r4 - r6, lr}
adr r1, .LCvectors @ set up the vectors
......
......@@ -42,7 +42,7 @@
#include <asm/fiq.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/system.h>
#include <asm/uaccess.h>
......
......@@ -15,6 +15,13 @@
#include <asm/pgtable.h>
#include <asm/uaccess.h>
unsigned long
resource_fixup(struct pci_dev * dev, struct resource * res,
unsigned long start, unsigned long size)
{
return start;
}
#ifdef CONFIG_CPU_32
asmlinkage int sys_iopl(unsigned long turn_on)
{
......
......@@ -5,10 +5,6 @@
* Origional Copyright (C) 1995 Linus Torvalds
*/
/*
* This file handles the architecture-dependent parts of process handling..
*/
#include <stdarg.h>
#include <linux/errno.h>
......@@ -39,7 +35,7 @@ extern char *processor_modes[];
asmlinkage void ret_from_sys_call(void) __asm__("ret_from_sys_call");
static int hlt_counter=0;
static int hlt_counter;
void disable_hlt(void)
{
......@@ -51,6 +47,21 @@ void enable_hlt(void)
hlt_counter--;
}
static int __init nohlt_setup(char *__unused)
{
hlt_counter = 1;
return 0;
}
static int __init hlt_setup(char *__unused)
{
hlt_counter = 0;
return 0;
}
__setup("nohlt", nohlt_setup);
__setup("hlt", hlt_setup);
/*
* The idle loop on an ARM...
*/
......@@ -93,6 +104,7 @@ void machine_restart(char * __unused)
mdelay(1000);
printk("Reboot failed -- System halted\n");
cli();
while (1);
}
......@@ -110,18 +122,18 @@ void show_regs(struct pt_regs * regs)
flags = condition_codes(regs);
printk( "pc : [<%08lx>] lr : [<%08lx>]\n"
"sp : %08lx ip : %08lx fp : %08lx\n",
printk("pc : [<%08lx>] lr : [<%08lx>]\n"
"sp : %08lx ip : %08lx fp : %08lx\n",
instruction_pointer(regs),
regs->ARM_lr, regs->ARM_sp,
regs->ARM_ip, regs->ARM_fp);
printk( "r10: %08lx r9 : %08lx r8 : %08lx\n",
printk("r10: %08lx r9 : %08lx r8 : %08lx\n",
regs->ARM_r10, regs->ARM_r9,
regs->ARM_r8);
printk( "r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
printk("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
regs->ARM_r7, regs->ARM_r6,
regs->ARM_r5, regs->ARM_r4);
printk( "r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
printk("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
regs->ARM_r3, regs->ARM_r2,
regs->ARM_r1, regs->ARM_r0);
printk("Flags: %c%c%c%c",
......
This diff is collapsed.
......@@ -17,6 +17,7 @@
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/spinlock.h>
#include <linux/init.h>
#include <asm/system.h>
#include <asm/uaccess.h>
......@@ -423,3 +424,13 @@ asmlinkage void __div0(void)
printk("Division by zero in kernel.\n");
__backtrace();
}
void __init trap_init(void)
{
extern void __trap_init(void);
__trap_init();
#ifdef CONFIG_CPU_32
modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
#endif
}
......@@ -244,6 +244,10 @@ void __init mem_init(void)
unsigned int codepages, datapages, initpages;
int i;
codepages = &_etext - &_text;
datapages = &_end - &_etext;
initpages = &__init_end - &__init_begin;
max_mapnr = max_low_pfn;
high_memory = (void *)__va(max_low_pfn * PAGE_SIZE);
......@@ -261,29 +265,28 @@ void __init mem_init(void)
* Since our memory may not be contiguous, calculate the
* real number of pages we have in this system
*/
printk("Memory:");
num_physpages = 0;
for (i = 0; i < meminfo.nr_banks; i++)
for (i = 0; i < meminfo.nr_banks; i++) {
num_physpages += meminfo.bank[i].size >> PAGE_SHIFT;
printk(" %ldMB", meminfo.bank[i].size >> 20);
}
codepages = (int)&_etext - &_text;
datapages = (int)&_end - &_etext;
initpages = (int)&__init_end - &__init_start;
printk("Memory: %luk/%luM available (%dK code, %dK data, %dK init)\n",
printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
printk("Memory: %luKB available (%dK code, %dK data, %dK init)\n",
(unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
num_physpages >> (20 - PAGE_SHIFT),
codepages << (PAGE_SHIFT-10),
datapages << (PAGE_SHIFT-10),
initpages << (PAGE_SHIFT-10));
codepages >> 10, datapages >> 10, initpages >> 10);
#ifdef CONFIG_CPU_26
if (max_mapnr <= 128) {
if (PAGE_SIZE >= 16384 && max_mapnr <= 128) {
extern int sysctl_overcommit_memory;
/* On a machine this small we won't get anywhere without
overcommit, so turn it on by default. */
/*
* On a machine this small we won't get
* anywhere without overcommit, so turn
* it on by default.
*/
sysctl_overcommit_memory = 1;
}
#endif
}
static inline void free_area(unsigned long addr, unsigned long end, char *s)
......@@ -333,6 +336,19 @@ void free_initmem(void)
printk("\n");
}
#ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end)
{
for (; start < end; start += PAGE_SIZE) {
ClearPageReserved(mem_map + MAP_NR(start));
set_page_count(mem_map+MAP_NR(start), 1);
free_page(start);
totalram_pages++;
}
printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
}
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
......
......@@ -24,6 +24,29 @@ extern unsigned long get_page_2k(int priority);
extern void free_page_2k(unsigned long page);
extern pte_t *get_bad_pte_table(void);
/*
* These are useful for identifing cache coherency
* problems by allowing the cache or the cache and
* writebuffer to be turned off. (Note: the write
* buffer should not be on and the cache off).
*/
static int __init nocache_setup(char *__unused)
{
cr_alignment &= ~4;
cr_no_alignment &= ~4;
set_cr(cr_alignment);
}
static int __init nowrite_setup(char *__unused)
{
cr_alignment &= ~(8|4);
cr_no_alignment &= ~(8|4);
set_cr(cr_alignment);
}
__setup("nocache", nocache_setup);
__setup("nowb", nowrite_setup);
/*
* need to get a 16k page for level 1
*/
......@@ -353,7 +376,7 @@ void __init create_memmap_holes(void)
{
unsigned int start_pfn, end_pfn = -1;
struct page *pg = NULL;
unsigned int sz, i;
unsigned int i;
for (i = 0; i < meminfo.nr_banks; i++) {
if (meminfo.bank[i].size == 0)
......
......@@ -270,9 +270,9 @@ _arm2_3_check_bugs:
bics pc, lr, #0x04000000 @ Clear FIQ disable bit
armvlsi_name: .asciz "ARM/VLSI"
_arm2_name: .asciz "arm2"
_arm250_name: .asciz "arm250"
_arm3_name: .asciz "arm3"
_arm2_name: .asciz "ARM 2"
_arm250_name: .asciz "ARM 250"
_arm3_name: .asciz "ARM 3"
.section ".text.init", #alloc, #execinstr
/*
......
......@@ -413,12 +413,12 @@ ENTRY(cpu_arm7_reset)
cpu_armvlsi_name:
.asciz "ARM/VLSI"
cpu_arm6_name: .asciz "arm6"
cpu_arm6_name: .asciz "ARM 6"
cpu_arm610_name:
.asciz "arm610"
cpu_arm7_name: .asciz "arm7"
.asciz "ARM 610"
cpu_arm7_name: .asciz "ARM 7"
cpu_arm710_name:
.asciz "arm710"
.asciz "ARM 710"
.align
.section ".text.init", #alloc, #execinstr
......
......@@ -456,9 +456,9 @@ ENTRY(cpu_sa1100_reset)
cpu_manu_name: .asciz "Intel"
ENTRY(cpu_sa110_name)
.asciz "sa110"
.asciz "StrongARM-110"
ENTRY(cpu_sa1100_name)
.asciz "sa1100"
.asciz "StrongARM-1100"
.align
.section ".text.init", #alloc, #execinstr
......
......@@ -23,6 +23,11 @@
extern void dump_thread(struct pt_regs *, struct user *);
extern int dump_fpu(elf_fpregset_t *);
#ifdef __SMP__
extern void FASTCALL( __write_lock_failed(rwlock_t *rw));
extern void FASTCALL( __read_lock_failed(rwlock_t *rw));
#endif
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
extern struct drive_info_struct drive_info;
EXPORT_SYMBOL(drive_info);
......@@ -92,6 +97,8 @@ EXPORT_SYMBOL(__cpu_logical_map);
EXPORT_SYMBOL(smp_num_cpus);
EXPORT_SYMBOL(cpu_present_map);
EXPORT_SYMBOL(cpu_online_map);
EXPORT_SYMBOL_NOVERS(__write_lock_failed);
EXPORT_SYMBOL_NOVERS(__read_lock_failed);
/* Global SMP irq stuff */
EXPORT_SYMBOL(synchronize_irq);
......
......@@ -381,10 +381,10 @@ void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
static inline void do_flush_tlb_all_local(void)
{
local_flush_tlb();
if(current->mm==0) {
if (!current->mm && current->active_mm) {
unsigned long cpu = smp_processor_id();
clear_bit(cpu, &current->active_mm->cpu_vm_mask);
clear_bit(cpu, &current->active_mm->cpu_vm_mask);
cpu_tlbbad[cpu] = 1;
}
}
......@@ -396,8 +396,9 @@ static void flush_tlb_all_ipi(void* info)
void flush_tlb_all(void)
{
if(cpu_online_map ^ (1<<smp_processor_id()))
smp_call_function (flush_tlb_all_ipi,0,1,1);
if (cpu_online_map ^ (1 << smp_processor_id()))
while (smp_call_function (flush_tlb_all_ipi,0,0,1) == -EBUSY)
mb();
do_flush_tlb_all_local();
}
......
......@@ -376,7 +376,7 @@ static void __init pagetable_init(void)
* Permanent kmaps:
*/
vaddr = PKMAP_BASE;
fixrange_init(vaddr, vaddr + 4*1024*1024, pgd_base);
fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
pgd = swapper_pg_dir + __pgd_offset(vaddr);
pmd = pmd_offset(pgd, vaddr);
......
......@@ -649,6 +649,7 @@ static int __init swap_init(unsigned long start_mem, unsigned long swap_data)
/* now swapping to this device ok */
p->pages = j + k;
swap_list_lock();
nr_swap_pages += j;
p->flags = SWP_WRITEOK;
......@@ -666,6 +667,7 @@ static int __init swap_init(unsigned long start_mem, unsigned long swap_data)
} else {
swap_info[prev].next = p - swap_info;
}
swap_list_unlock();
printk( KERN_INFO "Using %dk (%d pages) of ST-RAM as swap space.\n",
p->pages << 2, p->pages );
......@@ -924,6 +926,9 @@ static int unswap_by_read(unsigned short *map, unsigned long max,
DPRINTK("unswap: map[i=%lu]=%u nr_swap=%u\n",
i, map[i], nr_swap_pages);
swap_device_lock(stram_swap_info);
map[i]++;
swap_device_unlock(stram_swap_info);
/* Get a page for the entry, using the existing
swap cache page if there is one. Otherwise,
get a clean page and read the swap into it. */
......@@ -945,18 +950,24 @@ static int unswap_by_read(unsigned short *map, unsigned long max,
stat_swap_force++;
#endif
}
else if (map[i])
else {
swap_free(entry);
return -ENOMEM;
}
}
DPRINTK( "unswap: map[i=%lu]=%u nr_swap=%u\n",
i, map[i], nr_swap_pages );
swap_list_lock();
swap_device_lock(stram_swap_info);
map[i] = SWAP_MAP_BAD;
if (stram_swap_info->lowest_bit == i)
stram_swap_info->lowest_bit++;
if (stram_swap_info->highest_bit == i)
stram_swap_info->highest_bit--;
--nr_swap_pages;
swap_device_unlock(stram_swap_info);
swap_list_unlock();
}
return 0;
......@@ -1022,6 +1033,8 @@ static void free_stram_region( unsigned long offset, unsigned long n_pages )
return;
}
swap_list_lock();
swap_device_lock(stram_swap_info);
/* un-reserve the freed pages */
for( ; n_pages > 0; ++offset, --n_pages ) {
if (map[offset] != SWAP_MAP_BAD)
......@@ -1038,6 +1051,8 @@ static void free_stram_region( unsigned long offset, unsigned long n_pages )
if (stram_swap_info->prio > swap_info[swap_list.next].prio)
swap_list.next = swap_list.head;
nr_swap_pages += n_pages;
swap_device_unlock(stram_swap_info);
swap_list_unlock();
}
......
......@@ -43,8 +43,9 @@ ifdef CONFIG_4xx
else
ifdef CONFIG_8xx
HEAD := arch/ppc/kernel/head_8xx.o
else
HEAD := arch/ppc/kernel/head.o
endif
HEAD := arch/ppc/kernel/head.o
endif
ARCH_SUBDIRS = arch/ppc/kernel arch/ppc/mm arch/ppc/lib
......
......@@ -9,25 +9,26 @@ CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
CFLAGS = -O -fno-builtin -I$(TOPDIR)/include
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment \
--add-section=image=vmlinux.gz
LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
COFF_LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
CHRP_LD_ARGS = -Ttext 0x00400000
GZ = gzip -9
OBJS = crt0.o start.o main.o misc.o string.o zlib.o
COFFOBJS = coffcrt0.o start.o coffmain.o misc.o string.o zlib.o image.o
CHRPOBJS = crt0.o start.o chrpmain.o misc.o string.o zlib.o image.o
LIBS = $(TOPDIR)/lib/lib.a
ifeq ($(CONFIG_ALL_PPC),y)
# yes, we want to build pmac stuff
CONFIG_PMAC = y
endif
ifeq ($(CONFIG_PPC64),y)
MSIZE=.64
else
MSIZE=
endif
ifeq ($(CONFIG_ALL_PPC),y)
# yes, we want to build pmac stuff
CONFIG_PMAC = y
endif
ifeq ($(CONFIG_SMP),y)
TFTPIMAGE=/tftpboot/zImage.pmac.smp$(MSIZE)
else
......@@ -38,34 +39,58 @@ ifeq ($(CONFIG_PMAC),y)
hack-coff: hack-coff.c
$(HOSTCC) $(HOSTCFLAGS) -o hack-coff hack-coff.c
znetboot: vmlinux.coff zImage
cp vmlinux.coff $(TFTPIMAGE)
znetboot.initrd: vmlinux.coff.initrd
cp vmlinux.coff.initrd $(TFTPIMAGE)
floppy: zImage
# mount -t hfs /dev/fd0 /mnt
# cp vmlinux.coff /mnt
# umount /mnt
znetboot: vmlinux.coff
cp vmlinux.coff $(TFTPIMAGE)
coffboot: $(COFFOBJS) no_initrd.o ld.script
$(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) no_initrd.o $(LIBS)
znetboot.initrd: vmlinux.coff.initrd
cp vmlinux.coff.initrd $(TFTPIMAGE)
coffboot.initrd: $(COFFOBJS) initrd.o ld.script
$(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) initrd.o $(LIBS)
coffboot: $(OBJS) ld.script
$(LD) -o coffboot $(LD_ARGS) $(OBJS) $(LIBS)
piggyback: piggyback.c
$(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o piggyback piggyback.c
zImage: vmlinux.coff
mknote: mknote.c
$(HOSTCC) $(HOSTCFLAGS) -o mknote mknote.c
zImage.initrd: vmlinux.coff.initrd
image.o: piggyback vmlinux.gz
./piggyback image < vmlinux.gz | $(AS) -o image.o
vmlinux.coff: coffboot hack-coff vmlinux.gz
initrd.o: ramdisk.image.gz piggyback
./piggyback initrd < ramdisk.image.gz | $(AS) -o initrd.o
vmlinux.coff: coffboot hack-coff
$(OBJCOPY) $(OBJCOPY_ARGS) coffboot $@
./hack-coff $@
ln -sf vmlinux.coff zImage
vmlinux.coff.initrd: coffboot hack-coff vmlinux.gz ramdisk.image.gz
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \
coffboot $@
vmlinux.coff.initrd: coffboot.initrd hack-coff
$(OBJCOPY) $(OBJCOPY_ARGS) coffboot $@
./hack-coff $@
vmlinux.elf: $(CHRPOBJS) no_initrd.o mknote
$(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) no_initrd.o $(LIBS)
./mknote > note
$(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
vmlinux.elf.initrd: $(CHRPOBJS) initrd.o mknote
$(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) initrd.o $(LIBS)
./mknote > note
$(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
zImage: vmlinux.coff vmlinux.elf
zImage.initrd: vmlinux.coff.initrd vmlinux.elf.initrd
else
znetboot: vmlinux.gz
......
/*
* Copyright (C) Paul Mackerras 1997.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include "nonstdio.h"
#include "zlib.h"
#include <asm/bootinfo.h>
#include <asm/processor.h>
#define __KERNEL__
#include <asm/page.h>
extern void *finddevice(const char *);
extern int getprop(void *, const char *, void *, int);
void make_bi_recs(unsigned long);
void gunzip(void *, int, unsigned char *, int *);
void stop_imac_ethernet(void);
void stop_imac_usb(void);
#define get_16be(x) (*(unsigned short *)(x))
#define get_32be(x) (*(unsigned *)(x))
#define RAM_START 0x00000000
#define RAM_END (8<<20)
#define PROG_START 0x00010000
char *avail_ram;
char *end_avail;
extern char _end[];
extern char image_data[];
extern int image_len;
extern char initrd_data[];
extern int initrd_len;
boot(int a1, int a2, void *prom)
{
int ns, oh, i;
unsigned sa, len;
void *dst;
unsigned char *im;
unsigned initrd_start, initrd_size;
extern char _start;
printf("chrpboot starting: loaded at 0x%x\n", &_start);
if (initrd_len) {
initrd_size = initrd_len;
initrd_start = (RAM_END - initrd_size) & ~0xFFF;
a1 = initrd_start;
a2 = initrd_size;
claim(initrd_start, RAM_END - initrd_start, 0);
printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n", initrd_start,
initrd_data,initrd_size);
memcpy((char *)initrd_start, initrd_data, initrd_size);
}
im = image_data;
len = image_len;
/* claim 3MB starting at PROG_START */
claim(PROG_START, 3 << 20, 0);
dst = (void *) PROG_START;
if (im[0] == 0x1f && im[1] == 0x8b) {
/* claim 512kB for scratch space */
avail_ram = (char *) claim(0, 512 << 10, 0x10);
end_avail = avail_ram + (512 << 10);
printf("avail_ram = %x\n", avail_ram);
printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
gunzip(dst, 3 << 20, im, &len);
printf("done %u bytes\n", len);
} else {
memmove(dst, im, len);
}
flush_cache(dst, len);
stop_imac_ethernet();
stop_imac_usb();
make_bi_recs((unsigned long) dst + len);
sa = (unsigned long)PROG_START;
printf("start address = 0x%x\n", sa);
(*(void (*)())sa)(0, 0, prom, a1, a2);
printf("returned?\n");
pause();
}
void make_bi_recs(unsigned long addr)
{
struct bi_record *rec;
rec = (struct bi_record *)PAGE_ALIGN(addr);
rec->tag = BI_FIRST;
rec->size = sizeof(struct bi_record);
rec = (struct bi_record *)((unsigned long)rec + rec->size);
rec->tag = BI_BOOTLOADER_ID;
sprintf( (char *)rec->data, "coffboot");
rec->size = sizeof(struct bi_record) + strlen("coffboot") + 1;
rec = (struct bi_record *)((unsigned long)rec + rec->size);
rec->tag = BI_MACHTYPE;
rec->data[0] = _MACH_Pmac;
rec->data[1] = 1;
rec->size = sizeof(struct bi_record) + sizeof(unsigned long);
rec = (struct bi_record *)((unsigned long)rec + rec->size);
rec->tag = BI_LAST;
rec->size = sizeof(struct bi_record);
rec = (struct bi_record *)((unsigned long)rec + rec->size);
}
#define eieio() asm volatile("eieio");
void stop_imac_ethernet(void)
{
void *macio, *enet;
unsigned int macio_addr[5], enet_reg[6];
int len;
volatile unsigned int *dbdma;
macio = finddevice("/pci/mac-io");
enet = finddevice("/pci/mac-io/ethernet");
if (macio == NULL || enet == NULL)
return;
len = getprop(macio, "assigned-addresses", macio_addr, sizeof(macio_addr));
if (len != sizeof(macio_addr))
return;
len = getprop(enet, "reg", enet_reg, sizeof(enet_reg));
if (len != sizeof(enet_reg))
return;
printf("macio base %x, dma at %x & %x\n",
macio_addr[2], enet_reg[2], enet_reg[4]);
/* hope this is mapped... */
dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[2]);
*dbdma = 0x80; /* clear the RUN bit */
eieio();
dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[4]);
*dbdma = 0x80; /* clear the RUN bit */
eieio();
}
void stop_imac_usb(void)
{
void *usb;
unsigned int usb_addr[5];
int len;
volatile unsigned int *usb_ctrl;
usb = finddevice("/pci/usb");
if (usb == NULL)
return;
len = getprop(usb, "assigned-addresses", usb_addr, sizeof(usb_addr));
if (len != sizeof(usb_addr))
return;
printf("usb base %x\n", usb_addr[2]);
usb_ctrl = (volatile unsigned int *) (usb_addr[2] + 8);
*usb_ctrl = 0x01000000; /* cpu_to_le32(1) */
eieio();
}
void *zalloc(void *x, unsigned items, unsigned size)
{
void *p = avail_ram;
size *= items;
size = (size + 7) & -8;
avail_ram += size;
if (avail_ram > end_avail) {
printf("oops... out of memory\n");
pause();
}
return p;
}
void zfree(void *x, void *addr, unsigned nb)
{
}
#define HEAD_CRC 2
#define EXTRA_FIELD 4
#define ORIG_NAME 8
#define COMMENT 0x10
#define RESERVED 0xe0
#define DEFLATED 8
void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
{
z_stream s;
int r, i, flags;
/* skip header */
i = 10;
flags = src[3];
if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
printf("bad gzipped data\n");
exit();
}
if ((flags & EXTRA_FIELD) != 0)
i = 12 + src[10] + (src[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (src[i++] != 0)
;
if ((flags & COMMENT) != 0)
while (src[i++] != 0)
;
if ((flags & HEAD_CRC) != 0)
i += 2;
if (i >= *lenp) {
printf("gunzip: ran out of data in header\n");
exit();
}
s.zalloc = zalloc;
s.zfree = zfree;
r = inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) {
printf("inflateInit2 returned %d\n", r);
exit();
}
s.next_in = src + i;
s.avail_in = *lenp - i;
s.next_out = dst;
s.avail_out = dstlen;
r = inflate(&s, Z_FINISH);
if (r != Z_OK && r != Z_STREAM_END) {
printf("inflate returned %d msg: %s\n", r, s.msg);
exit();
}
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
}
/*
* Copyright (C) Paul Mackerras 1997.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
.text
.globl _start
_start:
.long __start,0,0
.globl __start
__start:
lis 9,_start@h
lis 8,_etext@ha
addi 8,8,_etext@l
1: dcbf 0,9
icbi 0,9
addi 9,9,0x20
cmplwi 0,9,8
blt 1b
b start
/*
* Copyright (C) Paul Mackerras 1997.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include "nonstdio.h"
#include "zlib.h"
#include <asm/bootinfo.h>
#include <asm/processor.h>
#define __KERNEL__
#include <asm/page.h>
extern void *finddevice(const char *);
extern int getprop(void *, const char *, void *, int);
extern char *claim(unsigned, unsigned, unsigned);
void make_bi_recs(unsigned long);
void gunzip(void *, int, unsigned char *, int *);
#define get_16be(x) (*(unsigned short *)(x))
#define get_32be(x) (*(unsigned *)(x))
#define RAM_START 0xc0000000
#define PROG_START RAM_START
#define RAM_END (RAM_START + 0x800000) /* only 8M mapped with BATs */
char *avail_ram;
char *end_avail;
extern char _start[], _end[];
extern char image_data[];
extern int image_len;
extern char initrd_data[];
extern int initrd_len;
boot(int a1, int a2, void *prom)
{
int ns, oh, i;
unsigned sa, len;
void *dst;
unsigned char *im;
unsigned initrd_start, initrd_size;
printf("coffboot starting: loaded at 0x%x\n", _start);
setup_bats(RAM_START);
if (initrd_len) {
initrd_size = initrd_len;
initrd_start = (RAM_END - initrd_size) & ~0xFFF;
a1 = initrd_start;
a2 = initrd_size;
claim(initrd_start - RAM_START, RAM_END - initrd_start, 0);
printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
initrd_start, initrd_data, initrd_size);
memcpy((char *)initrd_start, initrd_data, initrd_size);
}
im = image_data;
len = image_len;
/* claim 3MB starting at 0 */
claim(0, 3 << 20, 0);
dst = (void *) RAM_START;
if (im[0] == 0x1f && im[1] == 0x8b) {
/* claim 512kB for scratch space */
avail_ram = claim(0, 512 << 10, 0x10) + RAM_START;
end_avail = avail_ram + (512 << 10);
printf("avail_ram = %x\n", avail_ram);
printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
gunzip(dst, 3 << 20, im, &len);
printf("done %u bytes\n", len);
} else {
memmove(dst, im, len);
}
flush_cache(dst, len);
make_bi_recs((unsigned long)dst + len);
sa = (unsigned long)PROG_START;
printf("start address = 0x%x\n", sa);
#if 0
pause();
#endif
(*(void (*)())sa)(a1, a2, prom);
printf("returned?\n");
pause();
}
void make_bi_recs(unsigned long addr)
{
struct bi_record *rec;
rec = (struct bi_record *)PAGE_ALIGN(addr);
rec->tag = BI_FIRST;
rec->size = sizeof(struct bi_record);
rec = (struct bi_record *)((unsigned long)rec + rec->size);
rec->tag = BI_BOOTLOADER_ID;
sprintf( (char *)rec->data, "coffboot");
rec->size = sizeof(struct bi_record) + strlen("coffboot") + 1;
rec = (struct bi_record *)((unsigned long)rec + rec->size);
rec->tag = BI_MACHTYPE;
rec->data[0] = _MACH_Pmac;
rec->data[1] = 1;
rec->size = sizeof(struct bi_record) + sizeof(unsigned long);
rec = (struct bi_record *)((unsigned long)rec + rec->size);
rec->tag = BI_LAST;
rec->size = sizeof(struct bi_record);
rec = (struct bi_record *)((unsigned long)rec + rec->size);
}
void *zalloc(void *x, unsigned items, unsigned size)
{
void *p = avail_ram;
size *= items;
size = (size + 7) & -8;
avail_ram += size;
if (avail_ram > end_avail) {
printf("oops... out of memory\n");
pause();
}
return p;
}
void zfree(void *x, void *addr, unsigned nb)
{
}
#define HEAD_CRC 2
#define EXTRA_FIELD 4
#define ORIG_NAME 8
#define COMMENT 0x10
#define RESERVED 0xe0
#define DEFLATED 8
void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
{
z_stream s;
int r, i, flags;
/* skip header */
i = 10;
flags = src[3];
if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
printf("bad gzipped data\n");
exit();
}
if ((flags & EXTRA_FIELD) != 0)
i = 12 + src[10] + (src[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (src[i++] != 0)
;
if ((flags & COMMENT) != 0)
while (src[i++] != 0)
;
if ((flags & HEAD_CRC) != 0)
i += 2;
if (i >= *lenp) {
printf("gunzip: ran out of data in header\n");
exit();
}
s.zalloc = zalloc;
s.zfree = zfree;
r = inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) {
printf("inflateInit2 returned %d\n", r);
exit();
}
s.next_in = src + i;
s.avail_in = *lenp - i;
s.next_out = dst;
s.avail_out = dstlen;
r = inflate(&s, Z_FINISH);
if (r != Z_OK && r != Z_STREAM_END) {
printf("inflate returned %d msg: %s\n", r, s.msg);
exit();
}
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
}
......@@ -9,10 +9,6 @@
.text
.globl _start
_start:
.long __start,0,0
.globl __start
__start:
lis 9,_start@h
lis 8,_etext@ha
addi 8,8,_etext@l
......
......@@ -14,23 +14,26 @@
*/
.globl setup_bats
setup_bats:
mr 4,3
mfpvr 3
rlwinm 3,3,16,16,31 /* r3 = 1 for 601, 4 for 604 */
cmpi 0,3,1
mfpvr 5
rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */
cmpi 0,5,1
li 0,0
bne 4f
ori 4,4,4 /* set up BAT registers for 601 */
li 5,0x7f
mtibatu 3,4
mtibatl 3,5
isync
blr
4: ori 4,4,0xfe /* set up BAT registers for 604 */
li 5,2
mtdbatl 3,5
mtdbatu 3,4
mtibatl 3,5
mtibatu 3,4
mtibatl 3,0 /* invalidate BAT first */
ori 3,3,4 /* set up BAT registers for 601 */
li 4,0x7f
mtibatu 3,3
mtibatl 3,4
b 5f
4: mtdbatu 3,0 /* invalidate BATs first */
mtibatu 3,0
ori 3,3,0xff /* set up BAT registers for 604 */
li 4,2
mtdbatl 3,4
mtdbatu 3,3
mtibatl 3,4
mtibatu 3,3
5: sync
isync
blr
......
/*
* Copyright (C) Cort Dougan 1999.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Generate a note section as per the CHRP specification.
*
*/
#include <stdio.h>
#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff );
int main(void)
{
/* header */
/* namesz */
PL(strlen("PowerPC")+1);
/* descrsz */
PL(6*4);
/* type */
PL(0x1275);
/* name */
printf("PowerPC"); printf("%c", 0);
/* descriptor */
/* real-mode */
PL(0xffffffff);
/* real-base */
PL(0x00c00000);
/* real-size */
PL(0xffffffff);
/* virt-base */
PL(0xffffffff);
/* virt-size */
PL(0xffffffff);
/* load-base */
PL(0x4000);
return 0;
}
char initrd_data[1];
int initrd_len = 0;
#include <stdio.h>
extern long ce_exec_config[];
main(int argc, char *argv[])
{
int i, cnt, pos, len;
unsigned int cksum, val;
unsigned char *lp;
unsigned char buf[8192];
if (argc != 2)
{
fprintf(stderr, "usage: %s name <in-file >out-file\n",
argv[0]);
exit(1);
}
fprintf(stdout, "#\n");
fprintf(stdout, "# Miscellaneous data structures:\n");
fprintf(stdout, "# WARNING - this file is automatically generated!\n");
fprintf(stdout, "#\n");
fprintf(stdout, "\n");
fprintf(stdout, "\t.data\n");
fprintf(stdout, "\t.globl %s_data\n", argv[1]);
fprintf(stdout, "%s_data:\n", argv[1]);
pos = 0;
cksum = 0;
while ((len = read(0, buf, sizeof(buf))) > 0)
{
cnt = 0;
lp = (unsigned char *)buf;
len = (len + 3) & ~3; /* Round up to longwords */
for (i = 0; i < len; i += 4)
{
if (cnt == 0)
{
fprintf(stdout, "\t.long\t");
}
fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
val = *(unsigned long *)lp;
cksum ^= val;
lp += 4;
if (++cnt == 4)
{
cnt = 0;
fprintf(stdout, " # %x \n", pos+i-12);
fflush(stdout);
} else
{
fprintf(stdout, ",");
}
}
if (cnt)
{
fprintf(stdout, "0\n");
}
pos += len;
}
fprintf(stdout, "\t.globl %s_len\n", argv[1]);
fprintf(stdout, "%s_len:\t.long\t0x%x\n", argv[1], pos);
fflush(stdout);
fclose(stdout);
fprintf(stderr, "cksum = %x\n", cksum);
exit(0);
}
......@@ -33,7 +33,7 @@ start(int a1, int a2, void *promptr)
if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
exit();
coffboot(a1, a2, promptr);
boot(a1, a2, promptr);
for (;;)
exit();
}
......@@ -62,6 +62,25 @@ write(void *handle, void *ptr, int nb)
return args.actual;
}
int writestring(void *f, char *ptr, int nb)
{
int w = 0, i;
char *ret = "\r";
for (i = 0; i < nb; ++i) {
if (ptr[i] == '\n') {
if (i > w) {
write(f, ptr + w, i - w);
w = i;
}
write(f, ret, 1);
}
}
if (w < nb)
write(f, ptr + w, nb - w);
return nb;
}
int
read(void *handle, void *ptr, int nb)
{
......@@ -130,6 +149,29 @@ finddevice(const char *name)
return args.phandle;
}
void *
claim(unsigned int virt, unsigned int size, unsigned int align)
{
struct prom_args {
char *service;
int nargs;
int nret;
unsigned int virt;
unsigned int size;
unsigned int align;
void *ret;
} args;
args.service = "claim";
args.nargs = 3;
args.nret = 1;
args.virt = virt;
args.size = size;
args.align = align;
(*prom)(&args);
return args.ret;
}
int
getprop(void *phandle, const char *name, void *buf, int buflen)
{
......@@ -161,9 +203,7 @@ putc(int c, void *f)
{
char ch = c;
if (c == '\n')
putc('\r', f);
return write(f, &ch, 1) == 1? c: -1;
return writestring(f, &ch, 1) == 1? c: -1;
}
int
......@@ -177,7 +217,7 @@ fputs(char *str, void *f)
{
int n = strlen(str);
return write(f, str, n) == n? 0: -1;
return writestring(f, str, n) == n? 0: -1;
}
int
......@@ -190,7 +230,7 @@ readchar()
case 1:
return ch;
case -1:
printk("read(stdin) returned -1\r\n");
printk("read(stdin) returned -1\n");
return -1;
}
}
......@@ -264,7 +304,7 @@ printk(char *fmt, ...)
va_start(args, fmt);
n = vsprintf(sprint_buf, fmt, args);
va_end(args);
write(stdout, sprint_buf, n);
writestring(stdout, sprint_buf, n);
}
int
......@@ -276,6 +316,6 @@ printf(char *fmt, ...)
va_start(args, fmt);
n = vsprintf(sprint_buf, fmt, args);
va_end(args);
write(stdout, sprint_buf, n);
writestring(stdout, sprint_buf, n);
return n;
}
......@@ -66,7 +66,7 @@ if [ "$CONFIG_ALL_PPC" != "y" ];then
define_bool CONFIG_MACH_SPECIFIC y
fi
if [ "$CONFIG_4xx" = "y" ] || [ "$CONFIG_8xx" = "y" ]; then
if [ "$CONFIG_4xx" = "y" -o "$CONFIG_8xx" = "y" ]; then
bool 'Math emulation' CONFIG_MATH_EMULATION
fi
endmenu
......
......@@ -274,7 +274,6 @@ CONFIG_BMAC=y
# CONFIG_LANCE is not set
# CONFIG_NET_VENDOR_SMC is not set
# CONFIG_NET_VENDOR_RACAL is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_RTL8139 is not set
# CONFIG_DM9102 is not set
# CONFIG_AT1700 is not set
......@@ -283,7 +282,6 @@ CONFIG_BMAC=y
CONFIG_NET_EISA=y
CONFIG_PCNET32=y
# CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_ACENIC is not set
# CONFIG_AC3200 is not set
# CONFIG_APRICOT is not set
# CONFIG_CS89x0 is not set
......@@ -301,6 +299,13 @@ CONFIG_DE4X5=y
# CONFIG_EPIC100 is not set
# CONFIG_ZNET is not set
# CONFIG_NET_POCKET is not set
#
# Ethernet (1000 Mbit)
#
# CONFIG_YELLOWFIN is not set
# CONFIG_ACENIC is not set
# CONFIG_SK98LIN is not set
# CONFIG_FDDI is not set
# CONFIG_HIPPI is not set
......
......@@ -274,7 +274,6 @@ CONFIG_BMAC=y
# CONFIG_LANCE is not set
# CONFIG_NET_VENDOR_SMC is not set
# CONFIG_NET_VENDOR_RACAL is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_RTL8139 is not set
# CONFIG_DM9102 is not set
# CONFIG_AT1700 is not set
......@@ -283,7 +282,6 @@ CONFIG_BMAC=y
CONFIG_NET_EISA=y
CONFIG_PCNET32=y
# CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_ACENIC is not set
# CONFIG_AC3200 is not set
# CONFIG_APRICOT is not set
# CONFIG_CS89x0 is not set
......@@ -301,6 +299,13 @@ CONFIG_DE4X5=y
# CONFIG_EPIC100 is not set
# CONFIG_ZNET is not set
# CONFIG_NET_POCKET is not set
#
# Ethernet (1000 Mbit)
#
# CONFIG_YELLOWFIN is not set
# CONFIG_ACENIC is not set
# CONFIG_SK98LIN is not set
# CONFIG_FDDI is not set
# CONFIG_HIPPI is not set
......
......@@ -7,6 +7,7 @@
* Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
* PowerPC 403GCX/405GP modifications.
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <asm/ptrace.h>
......
......@@ -392,7 +392,7 @@ _GLOBAL(fake_interrupt)
* here so it's easy to add arch-specific sections later.
* -- Cort
*/
#if defined(CONFIG_CHRP) || defined(CONFIG_ALL_PPC)
#if defined(CONFIG_CHRP) || defined(CONFIG_PMAC) || defined(CONFIG_ALL_PPC)
/*
* On CHRP, the Run-Time Abstraction Services (RTAS) have to be
* called with the MMU off.
......@@ -432,4 +432,4 @@ enter_rtas:
mtspr SRR0,r8
mtspr SRR1,r9
rfi /* return to caller */
#endif /* defined(CONFIG_CHRP) || defined(CONFIG_ALL_PPC) */
#endif /* CONFIG_CHRP || CONFIG_PMAC || CONFIG_ALL_PPC */
......@@ -331,7 +331,7 @@ void __init gemini_init_IRQ(void)
/* gemini has no 8259 */
open_pic.irq_offset = 0;
for( i=0; i < OPENPIC_VEC_SPURIOUS; i++ )
for( i=0; i < NR_IRQS; i++ )
irq_desc[i].ctl = &open_pic;
openpic_init(1);
#ifdef __SMP__
......
......@@ -1352,30 +1352,6 @@ _GLOBAL(set_context)
SYNC
blr
/*
* We put a few things here that have to be page-aligned.
* This stuff goes at the beginning of the data segment,
* which is page-aligned.
*/
.data
.globl sdata
sdata:
.globl empty_zero_page
empty_zero_page:
.space 4096
.globl swapper_pg_dir
swapper_pg_dir:
.space 4096
/*
* This space gets a copy of optional info passed to us by the bootstrap
* Used to pass parameters into the kernel like root=/dev/sda1, etc.
*/
.globl cmd_line
cmd_line:
.space 512
/*
* An undocumented "feature" of 604e requires that the v bit
* be cleared before changing BAT values.
......@@ -1412,10 +1388,26 @@ clear_bats:
#endif /* !defined(CONFIG_GEMINI) */
blr
flush_tlbs:
lis r20, 0x1000
1: addic. r20, r20, -0x1000
tlbie r20
blt 1b
sync
blr
/*
* We put a few things here that have to be page-aligned.
* This stuff goes at the beginning of the data segment,
* which is page-aligned.
*/
.data
.globl sdata
sdata:
.globl empty_zero_page
empty_zero_page:
.space 4096
.globl swapper_pg_dir
swapper_pg_dir:
.space 4096
/*
* This space gets a copy of optional info passed to us by the bootstrap
* Used to pass parameters into the kernel like root=/dev/sda1, etc.
*/
.globl cmd_line
cmd_line:
.space 512
......@@ -404,8 +404,10 @@ _GLOBAL(atomic_set_mask)
* The *_ns versions don't do byte-swapping.
*/
_GLOBAL(_insb)
cmpw 0,r5,0
mtctr r5
subi r4,r4,1
blelr-
00: lbz r5,0(r3)
eieio
stbu r5,1(r4)
......@@ -413,8 +415,10 @@ _GLOBAL(_insb)
blr
_GLOBAL(_outsb)
cmpw 0,r5,0
mtctr r5
subi r4,r4,1
blelr-
00: lbzu r5,1(r4)
stb r5,0(r3)
eieio
......@@ -422,8 +426,10 @@ _GLOBAL(_outsb)
blr
_GLOBAL(_insw)
cmpw 0,r5,0
mtctr r5
subi r4,r4,2
blelr-
00: lhbrx r5,0,r3
eieio
sthu r5,2(r4)
......@@ -431,8 +437,10 @@ _GLOBAL(_insw)
blr
_GLOBAL(_outsw)
cmpw 0,r5,0
mtctr r5
subi r4,r4,2
blelr-
00: lhzu r5,2(r4)
eieio
sthbrx r5,0,r3
......@@ -440,8 +448,10 @@ _GLOBAL(_outsw)
blr
_GLOBAL(_insl)
cmpw 0,r5,0
mtctr r5
subi r4,r4,4
blelr-
00: lwbrx r5,0,r3
eieio
stwu r5,4(r4)
......@@ -449,8 +459,10 @@ _GLOBAL(_insl)
blr
_GLOBAL(_outsl)
cmpw 0,r5,0
mtctr r5
subi r4,r4,4
blelr-
00: lwzu r5,4(r4)
stwbrx r5,0,r3
eieio
......@@ -459,8 +471,10 @@ _GLOBAL(_outsl)
_GLOBAL(ide_insw)
_GLOBAL(_insw_ns)
cmpw 0,r5,0
mtctr r5
subi r4,r4,2
blelr-
00: lhz r5,0(r3)
eieio
sthu r5,2(r4)
......@@ -469,8 +483,10 @@ _GLOBAL(_insw_ns)
_GLOBAL(ide_outsw)
_GLOBAL(_outsw_ns)
cmpw 0,r5,0
mtctr r5
subi r4,r4,2
blelr-
00: lhzu r5,2(r4)
sth r5,0(r3)
eieio
......@@ -478,8 +494,10 @@ _GLOBAL(_outsw_ns)
blr
_GLOBAL(_insl_ns)
cmpw 0,r5,0
mtctr r5
subi r4,r4,4
blelr-
00: lwz r5,0(r3)
eieio
stwu r5,4(r4)
......@@ -487,8 +505,10 @@ _GLOBAL(_insl_ns)
blr
_GLOBAL(_outsl_ns)
cmpw 0,r5,0
mtctr r5
subi r4,r4,4
blelr-
00: lwzu r5,4(r4)
stw r5,0(r3)
eieio
......@@ -929,7 +949,7 @@ _GLOBAL(sys_call_table)
.long sys_sigpending
.long sys_sethostname
.long sys_setrlimit /* 75 */
.long sys_getrlimit
.long sys_old_getrlimit
.long sys_getrusage
.long sys_gettimeofday
.long sys_settimeofday
......@@ -1047,4 +1067,5 @@ _GLOBAL(sys_call_table)
.long sys_ni_syscall /* streams1 */
.long sys_ni_syscall /* streams2 */
.long sys_vfork
.space (NR_syscalls-183)*4
.long sys_getrlimit /* 190 */
.space (NR_syscalls-190)*4
......@@ -63,9 +63,15 @@ struct hw_interrupt_type open_pic = {
#define check_arg_pri(pri) \
if (pri < 0 || pri >= OPENPIC_NUM_PRI) \
printk("openpic.c:%d: illegal priority %d\n", __LINE__, pri);
#define check_arg_irq(irq) \
/*
* Turned this check off since the IPI's are treated as irqs
* but they're above NumSources -- Cort
*/
#define check_arg_irq(irq)
#if 0
if (irq < 0 || irq >= (NumSources+open_pic.irq_offset)) \
printk("openpic.c:%d: illegal irq %d\n", __LINE__, irq);
#endif
#define check_arg_cpu(cpu) \
if (cpu < 0 || cpu >= NumProcessors) \
printk("openpic.c:%d: illegal cpu %d\n", __LINE__, cpu);
......@@ -201,15 +207,12 @@ void __init openpic_init(int main_pic)
/* Initialize IPI interrupts */
if ( ppc_md.progress ) ppc_md.progress("openpic ipi",0x3bb);
for (i = 0; i < OPENPIC_NUM_IPI; i++) {
/* Disabled, Priority 0 */
openpic_initipi(i, 0, OPENPIC_VEC_IPI+i);
/* Disabled, Priority 8 */
openpic_initipi(i, 8, OPENPIC_VEC_IPI+i);
}
/* Initialize external interrupts */
if ( ppc_md.progress ) ppc_md.progress("openpic ext",0x3bc);
/* SIOint (8259 cascade) is special */
openpic_initirq(0, 8, open_pic.irq_offset, 1, 1);
openpic_mapirq(0, 1<<0);
for (i = 1; i < NumSources; i++) {
/* Enabled, Priority 8 */
openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
......@@ -223,6 +226,9 @@ void __init openpic_init(int main_pic)
openpic_set_spurious(OPENPIC_VEC_SPURIOUS);
if ( _machine != _MACH_gemini )
{
/* SIOint (8259 cascade) is special */
openpic_initirq(0, 8, open_pic.irq_offset, 1, 1);
openpic_mapirq(0, 1<<0);
if (request_irq(IRQ_8259_CASCADE, no_action, SA_INTERRUPT,
"82c59 cascade", NULL))
printk("Unable to get OpenPIC IRQ 0 for cascade\n");
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment