Commit e929a3ac authored by Pete Zaitcev's avatar Pete Zaitcev Committed by David S. Miller

[SPARC]: Get 2.5.x building once more.

parent 617f55c0
......@@ -24,8 +24,6 @@
struct linux_ebus *ebus_chain = 0;
extern void rs_init(void);
/* We are together with pcic.c under CONFIG_PCI. */
extern unsigned int pcic_pin_to_irq(unsigned int, char *name);
......@@ -361,6 +359,4 @@ void __init ebus_init(void)
ebus->next = 0;
++num_ebus;
}
rs_init();
}
/* $Id: pcic.c,v 1.23 2002/01/23 14:33:55 davem Exp $
* pcic.c: Sparc/PCI controller support
/*
* pcic.c: MicroSPARC-IIep PCI controller support
*
* Copyright (C) 1998 V. Roganov and G. Raiko
*
......@@ -193,48 +193,26 @@ static void pci_do_settimeofday(struct timeval *tv);
#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (((unsigned int)bus) << 16) | (((unsigned int)device_fn) << 8) | (where & ~3))
static int pcic_read_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *value)
static int pcic_read_config_dword(unsigned int busno, unsigned int devfn,
int where, u32 *value)
{
unsigned int v;
unsigned char busnum = bus->number;
struct linux_pcic *pcic;
unsigned long flags;
/* unsigned char where; */
switch (size) {
case 1:
pcic_read_config(bus, devfn, where&~3, 4, &v);
*value = 0xff & (v >> (8*(where & 3)));
return PCIBIOS_SUCCESSFUL;
break;
case 2:
if (where&1) return PCIBIOS_BAD_REGISTER_NUMBER;
pcic_read_config(bus, devfn, where&~3, 4, &v);
*value = 0xffff & (v >> (8*(where & 3)));
return PCIBIOS_SUCCESSFUL;
break;
}
/* size == 4, i.e. dword */
if (where&3) return PCIBIOS_BAD_REGISTER_NUMBER;
if (busnum != 0) return PCIBIOS_DEVICE_NOT_FOUND;
pcic = &pcic0;
save_and_cli(flags);
local_irq_save(flags);
#if 0 /* does not fail here */
pcic_speculative = 1;
pcic_trapped = 0;
#endif
writel(CONFIG_CMD(busnum,devfn,where), pcic->pcic_config_space_addr);
writel(CONFIG_CMD(busno, devfn, where), pcic->pcic_config_space_addr);
#if 0 /* does not fail here */
nop();
if (pcic_trapped) {
restore_flags(flags);
local_irq_restore(flags);
*value = ~0;
return PCIBIOS_SUCCESSFUL;
return 0;
}
#endif
pcic_speculative = 2;
......@@ -243,50 +221,77 @@ static int pcic_read_config(struct pci_bus *bus, unsigned int devfn,
nop();
if (pcic_trapped) {
pcic_speculative = 0;
restore_flags(flags);
local_irq_restore(flags);
*value = ~0;
return PCIBIOS_SUCCESSFUL;
return 0;
}
pcic_speculative = 0;
restore_flags(flags);
return PCIBIOS_SUCCESSFUL;
local_irq_restore(flags);
return 0;
}
static int pcic_write_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 value)
static int pcic_read_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *val)
{
unsigned int v;
unsigned char busnum = bus->number;
struct linux_pcic *pcic;
unsigned long flags;
if (bus->number != 0) return -EINVAL;
switch (size) {
case 1:
pcic_read_config(bus, devfn, where&~3, 4, &v);
v = (v & ~(0xff << (8*(where&3)))) |
((0xff&(unsigned)value) << (8*(where&3)));
return pcic_write_config(bus, devfn, where&~3, 4, v);
break;
pcic_read_config_dword(bus->number, devfn, where&~3, &v);
*val = 0xff & (v >> (8*(where & 3)));
return 0;
case 2:
if (where&1) return PCIBIOS_BAD_REGISTER_NUMBER;
pcic_read_config(bus, devfn, where&~3, 4, &v);
v = (v & ~(0xffff << (8*(where&3)))) |
((0xffff&(unsigned)value) << (8*(where&3)));
return pcic_write_config(bus, devfn, where&~3, 4, v);
break;
if (where&1) return -EINVAL;
pcic_read_config_dword(bus->number, devfn, where&~3, &v);
*val = 0xffff & (v >> (8*(where & 3)));
return 0;
case 4:
if (where&3) return -EINVAL;
pcic_read_config_dword(bus->number, devfn, where&~3, &v);
return 0;
}
return -EINVAL;
}
static int pcic_write_config_dword(unsigned int busno, unsigned int devfn,
int where, u32 value)
{
struct linux_pcic *pcic;
unsigned long flags;
/* size == 4, i.e. dword */
if (where&3) return PCIBIOS_BAD_REGISTER_NUMBER;
if (busnum != 0) return PCIBIOS_DEVICE_NOT_FOUND;
pcic = &pcic0;
save_and_cli(flags);
writel(CONFIG_CMD(busnum,devfn,where), pcic->pcic_config_space_addr);
local_irq_save(flags);
writel(CONFIG_CMD(busno, devfn, where), pcic->pcic_config_space_addr);
writel(value, pcic->pcic_config_space_data + (where&4));
restore_flags(flags);
return PCIBIOS_SUCCESSFUL;
local_irq_restore(flags);
return 0;
}
static int pcic_write_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 val)
{
unsigned int v;
if (bus->number != 0) return -EINVAL;
switch (size) {
case 1:
pcic_read_config_dword(bus->number, devfn, where&~3, &v);
v = (v & ~(0xff << (8*(where&3)))) |
((0xff&val) << (8*(where&3)));
return pcic_write_config_dword(bus->number, devfn, where&~3, v);
case 2:
if (where&1) return -EINVAL;
pcic_read_config_dword(bus->number, devfn, where&~3, &v);
v = (v & ~(0xffff << (8*(where&3)))) |
((0xffff&val) << (8*(where&3)));
return pcic_write_config_dword(bus->number, devfn, where&~3, v);
case 4:
if (where&3) return -EINVAL;
return pcic_write_config_dword(bus->number, devfn, where, val);
}
return -EINVAL;
}
static struct pci_ops pcic_ops = {
......@@ -623,7 +628,7 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
{
struct list_head *walk;
int i, has_io, has_mem;
unsigned short cmd;
unsigned int cmd;
struct linux_pcic *pcic;
/* struct linux_pbm_info* pbm = &pcic->pbm; */
int node;
......@@ -663,19 +668,21 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
} else if (f & IORESOURCE_MEM)
has_mem = 1;
}
pcic_read_config_word(dev, PCI_COMMAND, &cmd);
pcic_read_config(dev->bus, dev->devfn, PCI_COMMAND, 2, &cmd);
if (has_io && !(cmd & PCI_COMMAND_IO)) {
printk("PCIC: Enabling I/O for device %02x:%02x\n",
dev->bus->number, dev->devfn);
cmd |= PCI_COMMAND_IO;
pcic_write_config_word(dev, PCI_COMMAND, cmd);
pcic_write_config(dev->bus, dev->devfn,
PCI_COMMAND, 2, cmd);
}
if (has_mem && !(cmd & PCI_COMMAND_MEMORY)) {
printk("PCIC: Enabling memory for device %02x:%02x\n",
dev->bus->number, dev->devfn);
cmd |= PCI_COMMAND_MEMORY;
pcic_write_config_word(dev, PCI_COMMAND, cmd);
}
pcic_write_config(dev->bus, dev->devfn,
PCI_COMMAND, 2, cmd);
}
node = pdev_to_pnode(&pcic->pbm, dev);
if(node == 0)
......@@ -791,7 +798,7 @@ static void pci_do_gettimeofday(struct timeval *tv)
{
unsigned long flags;
save_and_cli(flags);
local_irq_save(flags);
*tv = xtime;
tv->tv_usec += do_gettimeoffset();
......@@ -803,7 +810,7 @@ static void pci_do_gettimeofday(struct timeval *tv)
if ((jiffies - wall_jiffies) != 0)
tv->tv_usec += USECS_PER_JIFFY;
restore_flags(flags);
local_irq_restore(flags);
if (tv->tv_usec >= 1000000) {
tv->tv_usec -= 1000000;
......@@ -813,7 +820,9 @@ static void pci_do_gettimeofday(struct timeval *tv)
static void pci_do_settimeofday(struct timeval *tv)
{
cli();
unsigned long flags;
local_irq_save(flags);
tv->tv_usec -= do_gettimeoffset();
if(tv->tv_usec < 0) {
tv->tv_usec += 1000000;
......@@ -824,7 +833,7 @@ static void pci_do_settimeofday(struct timeval *tv)
time_status |= STA_UNSYNC;
time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT;
sti();
local_irq_restore(flags);
}
#if 0
......@@ -898,9 +907,9 @@ static void pcic_disable_irq(unsigned int irq_nr)
unsigned long mask, flags;
mask = get_irqmask(irq_nr);
save_and_cli(flags);
local_irq_save(flags);
writel(mask, pcic0.pcic_regs+PCI_SYS_INT_TARGET_MASK_SET);
restore_flags(flags);
local_irq_restore(flags);
}
static void pcic_enable_irq(unsigned int irq_nr)
......@@ -908,9 +917,9 @@ static void pcic_enable_irq(unsigned int irq_nr)
unsigned long mask, flags;
mask = get_irqmask(irq_nr);
save_and_cli(flags);
local_irq_save(flags);
writel(mask, pcic0.pcic_regs+PCI_SYS_INT_TARGET_MASK_CLEAR);
restore_flags(flags);
local_irq_restore(flags);
}
static void pcic_clear_profile_irq(int cpu)
......
......@@ -94,7 +94,7 @@ int cpu_idle(void)
extern unsigned long sun4c_kernel_faults;
extern void sun4c_grow_kernel_ring(void);
save_and_cli(flags);
local_irq_save(flags);
now = jiffies;
count -= (now - last_jiffies);
last_jiffies = now;
......@@ -110,7 +110,7 @@ int cpu_idle(void)
sun4c_grow_kernel_ring();
}
}
restore_flags(flags);
local_irq_restore(flags);
}
while((!need_resched()) && pm_idle) {
......@@ -144,8 +144,6 @@ int cpu_idle(void)
extern char reboot_command [];
extern int serial_console;
extern void (*prom_palette)(int);
void machine_halt(void)
......
......@@ -463,3 +463,19 @@ struct seq_operations cpuinfo_op = {
.stop = c_stop,
.show = show_cpuinfo,
};
extern int stop_a_enabled;
void sun_do_break(void)
{
if (!stop_a_enabled)
return;
printk("\n");
flush_user_windows();
prom_cmdline();
}
int serial_console;
int stop_a_enabled = 1;
......@@ -56,6 +56,9 @@ static void clk_slow(void)
"g2", "g3", "g4", "g5");
}
/*
* Tadpole is guaranteed to be UP, using local_irq_save.
*/
static void tsu_clockstop(void)
{
unsigned int mcsr;
......@@ -64,28 +67,28 @@ static void tsu_clockstop(void)
if (!clk_ctrl)
return;
if (!(clk_state & CLOCK_INIT_DONE)) {
save_and_cli(flags);
local_irq_save(flags);
clk_init();
clk_state |= CLOCK_INIT_DONE; /* all done */
restore_flags(flags);
local_irq_restore(flags);
return;
}
if (!(clk_ctrl[2] & 1))
return; /* no speed up yet */
save_and_cli(flags);
local_irq_save(flags);
/* if SCSI DMA in progress, don't slow clock */
mcsr = ldphys(MACIO_SCSI_CSR_ADDR);
if ((mcsr&MACIO_EN_DMA) != 0) {
restore_flags(flags);
local_irq_restore(flags);
return;
}
/* TODO... the minimum clock setting ought to increase the
* memory refresh interval..
*/
clk_slow();
restore_flags(flags);
local_irq_restore(flags);
}
static void swift_clockstop(void)
......
......@@ -29,32 +29,30 @@ extern unsigned long lvl14_save[5];
static unsigned long *linux_lvl14 = NULL;
static unsigned long obp_lvl14[4];
/*
* Call with timer IRQ closed.
* First time we do it with disable_irq, later prom code uses spin_lock_irq().
*/
void install_linux_ticker(void)
{
unsigned long flags;
if (!linux_lvl14)
return;
save_and_cli(flags);
linux_lvl14[0] = lvl14_save[0];
linux_lvl14[1] = lvl14_save[1];
linux_lvl14[2] = lvl14_save[2];
linux_lvl14[3] = lvl14_save[3];
restore_flags(flags);
}
void install_obp_ticker(void)
{
unsigned long flags;
if (!linux_lvl14)
return;
save_and_cli(flags);
linux_lvl14[0] = obp_lvl14[0];
linux_lvl14[1] = obp_lvl14[1];
linux_lvl14[2] = obp_lvl14[2];
linux_lvl14[3] = obp_lvl14[3];
restore_flags(flags);
}
void claim_ticker14(void (*handler)(int, void *, struct pt_regs *),
......
......@@ -506,9 +506,18 @@ asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
break;
case both:
#if 0 /* unsupported */
do_atomic(fetch_reg_addr(((insn>>25)&0x1f), regs),
(unsigned long *) addr,
user_unaligned_trap_fault);
#else
/*
* This was supported in 2.4. However, we question
* the value of SWAP instruction across word boundaries.
*/
printk("Unaligned SWAP unsupported.\n");
goto kill_user;
#endif
break;
default:
......
......@@ -1212,7 +1212,6 @@ extern int linux_num_cpus;
void (*poke_srmmu)(void) __initdata = NULL;
extern unsigned long bootmem_init(unsigned long *pages_avail);
extern void sun_serial_setup(void);
void __init srmmu_paging_init(void)
{
......@@ -1281,13 +1280,6 @@ void __init srmmu_paging_init(void)
flush_cache_all();
flush_tlb_all();
/*
* This does not logically belong here, but we need to
* call it at the moment we are able to use the bootmem
* allocator.
*/
sun_serial_setup();
sparc_context_init(num_contexts);
kmap_init();
......
......@@ -2001,7 +2001,6 @@ extern void sparc_context_init(int);
extern unsigned long end;
extern unsigned long bootmem_init(unsigned long *pages_avail);
extern unsigned long last_valid_pfn;
extern void sun_serial_setup(void);
void __init sun4c_paging_init(void)
{
......@@ -2018,12 +2017,6 @@ void __init sun4c_paging_init(void)
last_valid_pfn = bootmem_init(&pages_avail);
end_pfn = last_valid_pfn;
/* This does not logically belong here, but we need to
* call it at the moment we are able to use the bootmem
* allocator.
*/
sun_serial_setup();
sun4c_probe_mmu();
invalid_segment = (num_segmaps - 1);
sun4c_init_mmu_entry_pool();
......
......@@ -12,6 +12,7 @@
#include <asm/openprom.h>
#include <asm/oplib.h>
#include <asm/auxio.h>
#include <asm/system.h>
extern void restore_current(void);
......@@ -47,7 +48,6 @@ prom_feval(char *fstring)
/* We want to do this more nicely some day. */
extern void (*prom_palette)(int);
extern int serial_console;
/* Drop into the prom, with the chance to continue with the 'go'
* prom command.
......@@ -55,20 +55,18 @@ extern int serial_console;
void
prom_cmdline(void)
{
extern void kernel_enter_debugger(void);
extern void install_obp_ticker(void);
extern void install_linux_ticker(void);
unsigned long flags;
kernel_enter_debugger();
if(!serial_console && prom_palette)
prom_palette (1);
install_obp_ticker();
spin_lock_irqsave(&prom_lock, flags);
install_obp_ticker();
(*(romvec->pv_abort))();
restore_current();
spin_unlock_irqrestore(&prom_lock, flags);
install_linux_ticker();
spin_unlock_irqrestore(&prom_lock, flags);
#ifdef CONFIG_SUN_AUXIO
TURN_ON_LED;
#endif
......
......@@ -115,7 +115,7 @@ do { \
#ifndef CONFIG_SMP
#define synchronize_irq() barrier()
#define synchronize_irq(irq) barrier()
#else /* (CONFIG_SMP) */
......
......@@ -21,6 +21,8 @@ BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int)
#define NR_IRQS 15
#define irq_cannonicalize(irq) (irq)
/* Dave Redman (djhr@tadpole.co.uk)
* changed these to function pointers.. it saves cycles and will allow
* the irq dependencies to be split into different files at a later date
......
......@@ -11,6 +11,8 @@ enum km_type {
KM_BIO_DST_IRQ,
KM_PTE0,
KM_PTE1,
KM_IRQ0,
KM_IRQ1,
KM_TYPE_NR
};
......
......@@ -56,6 +56,17 @@ extern unsigned long empty_zero_page;
extern struct linux_romvec *romvec;
#define halt() romvec->pv_halt()
extern void sun_do_break(void);
extern int serial_console;
extern int stop_a_enabled;
static __inline__ int con_is_present(void)
{
return serial_console ? 0 : 1;
}
extern struct pt_regs *kbd_pt_regs;
/* When a context switch happens we must flush all user windows so that
* the windows of the current process are flushed onto its stack. This
* way the windows are all clean for the next process and the stack
......@@ -113,6 +124,7 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
"restore; restore; restore; restore; restore; restore; restore"); \
} while(0)
#define finish_arch_switch(rq, next) do{ }while(0)
#define task_running(rq, p) ((rq)->curr == (p))
/* Much care has gone into this code, do not touch it.
*
......@@ -282,9 +294,6 @@ extern void __global_restore_flags(unsigned long flags);
#define cli() local_irq_disable()
#define sti() local_irq_enable()
#define save_flags(x) local_save_flags(x)
#define restore_flags(x) local_irq_restore(x)
#define save_and_cli(x) local_irq_save(x)
#endif
......
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