Commit 9d20493c authored by Anton Blanchard's avatar Anton Blanchard

ppc64: merge conflicts

parents bda0e956 67536bf2
......@@ -13,61 +13,47 @@
# Adjusted for PPC64 by Tom Gall
#
KERNELLOAD =0xc000000000000000
KERNELLOAD = 0xc000000000000000
LDFLAGS := -m elf64ppc
LDFLAGS_vmlinux = -Bstatic \
-e $(KERNELLOAD) -Ttext $(KERNELLOAD)
LDFLAGS_vmlinux = -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
LDFLAGS_BLOB := --format binary --oformat elf64-powerpc
CFLAGS := $(CFLAGS) -msoft-float -pipe \
CFLAGS += -msoft-float -pipe \
-Wno-uninitialized -mminimal-toc -mtraceback=full \
-finline-limit-2000 -mcpu=power4
CPP = $(CC) -E $(CFLAGS)
HEAD := arch/ppc64/kernel/head.o
core-y += arch/ppc64/kernel/ arch/ppc64/mm/ arch/ppc64/lib/
core-$(CONFIG_XMON) += arch/ppc64/xmon/
# FIXME: is drivers- right ?
drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/
makeboot = $(call descend,arch/ppc64/boot,$(1))
ifdef CONFIG_PPC_PSERIES
BOOT_TARGETS = zImage zImage.initrd
endif
libs-y += arch/ppc64/lib/
core-y += arch/ppc64/kernel/
core-y += arch/ppc64/mm/
core-$(CONFIG_XMON) += arch/ppc64/xmon/
drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/
ifdef CONFIG_PPC_ISERIES
BOOT_TARGETS = vmlinux.sminitrd vmlinux.initrd vmlinux.sm
endif
makeboot =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/ppc64/boot $(1)
$(BOOT_TARGETS): vmlinux
@$(call makeboot,arch/ppc64/boot/$@)
boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd
boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm
$(boottarget-y): vmlinux
$(call makeboot,arch/ppc64/boot/$@)
%_config: arch/ppc64/configs/%_defconfig
rm -f .config arch/ppc64/defconfig
cp -f arch/ppc64/configs/$(@:config=defconfig) arch/ppc64/defconfig
archclean:
@$(call makeboot,clean)
$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/ppc64/boot
archmrproper:
prepare: include/asm-ppc64/offsets.h
prepare: include/asm-$(ARCH)/offsets.h
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
arch/ppc64/kernel/asm-offsets.s: include/asm include/linux/version.h \
include/config/MARKER
include/asm-$(ARCH)/offsets.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
@$(generate-asm-offsets.h) < $< > $@
include/asm-$(ARCH)/offsets.h: include/asm-$(ARCH)/offsets.h.tmp
include/asm-ppc64/offsets.h: arch/ppc64/kernel/asm-offsets.s
@echo -n ' Generating $@'
@$(generate-asm-offsets.h) < $< > $@.tmp
@$(update-if-changed)
CLEAN_FILES += include/asm-$(ARCH)/offsets.h.tmp \
include/asm-$(ARCH)/offsets.h
CLEAN_FILES += include/asm-ppc64/offsets.h.tmp \
include/asm-ppc64/offsets.h
......@@ -14,6 +14,8 @@
#include <asm/page.h>
#include <asm/bootinfo.h>
#undef DEBUG
void memmove(void *dst, void *im, int len);
extern void *finddevice(const char *);
......@@ -90,7 +92,9 @@ chrpboot(unsigned long a1, unsigned long a2, void *prom)
for(claim_addr = PROG_START;
claim_addr <= PROG_START * 8;
claim_addr += 0x100000) {
#ifdef DEBUG
printf(" trying: 0x%08lx\n\r", claim_addr);
#endif
dst = claim(claim_addr, uncompressed_size, 0);
if (dst != (void *)-1) break;
}
......@@ -118,6 +122,7 @@ chrpboot(unsigned long a1, unsigned long a2, void *prom)
bi_recs = make_bi_recs((unsigned long)dst + vmlinux_end);
kernel_entry = (kernel_entry_t)dst;
#ifdef DEBUG
printf( "kernel:\n\r"
" entry addr = 0x%lx\n\r"
" a1 = 0x%lx,\n\r"
......@@ -126,6 +131,7 @@ chrpboot(unsigned long a1, unsigned long a2, void *prom)
" bi_recs = 0x%lx,\n\r",
(unsigned long)kernel_entry, a1, a2,
(unsigned long)prom, (unsigned long)bi_recs);
#endif
kernel_entry( a1, a2, prom, bi_recs );
......
#
# Makefile for the linux kernel.
# Makefile for the linux ppc64 kernel.
#
EXTRA_CFLAGS = -mno-minimal-toc
KHEAD := head.o
EXTRA_TARGETS := $(KHEAD)
export-objs := ppc_ksyms.o
EXTRA_CFLAGS += -mno-minimal-toc
EXTRA_TARGETS := head.o
export-objs := ppc_ksyms.o
obj-y := ppc_ksyms.o setup.o entry.o traps.o irq.o idle.o \
time.o process.o signal.o syscalls.o misc.o ptrace.o \
......@@ -17,24 +13,18 @@ obj-y := ppc_ksyms.o setup.o entry.o traps.o irq.o idle.o \
ioctl32.o ptrace32.o signal32.o open_pic.o xics.o \
pmc.o mf_proc.o proc_pmc.o iSeries_setup.o \
ItLpQueue.o hvCall.o mf.o HvLpEvent.o ras.o \
iSeries_proc.o HvCall.o HvLpConfig.o \
rtc.o init_task.o pSeries_htab.o
obj-$(CONFIG_PCI) += pci.o pci_dn.o pci_dma.o
ifeq ($(CONFIG_PPC_ISERIES),y)
obj-$(CONFIG_PCI) += iSeries_pci.o iSeries_pci_reset.o iSeries_IoMmTable.o iSeries_irq.o iSeries_VpdInfo.o XmPciLpEvent.o
endif
ifeq ($(CONFIG_PPC_PSERIES),y)
obj-$(CONFIG_PCI) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o eeh.o
obj-y += rtasd.o nvram.o
endif
obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o
iSeries_proc.o rtc.o init_task.o pSeries_htab.o \
prom.o lmb.o rtas.o rtas-proc.o chrp_setup.o i8259.o \
pci.o pci_dn.o pci_dma.o
obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o iSeries_pci_reset.o \
iSeries_IoMmTable.o iSeries_irq.o \
iSeries_VpdInfo.o XmPciLpEvent.o \
HvCall.o HvLpConfig.o
obj-$(CONFIG_PROFILING) += profile.o
obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \
eeh.o rtasd.o nvram.o
obj-y += prom.o lmb.o rtas.o rtas-proc.o chrp_setup.o i8259.o
obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o
obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_PROFILING) += profile.o
......@@ -1248,9 +1248,6 @@ _GLOBAL(__start_initialization_pSeries)
mr r29,r5
mr r28,r6
mr r27,r7
mr r26,r8 /* YABOOT: debug_print() routine */
mr r25,r9 /* YABOOT: debug_delay() routine */
mr r24,r10 /* YABOOT: debug_prom() routine */
bl .enable_64b_mode
......@@ -1295,9 +1292,6 @@ _GLOBAL(__start_initialization_pSeries)
mr r5,r29
mr r6,r28
mr r7,r27
mr r8,r26
mr r9,r25
mr r10,r24
bl .prom_init
......
......@@ -15,10 +15,6 @@
* 2 of the License, or (at your option) any later version.
*/
#if 0
#define DEBUG_YABOOT
#endif
#if 0
#define DEBUG_PROM
#endif
......@@ -32,22 +28,6 @@
#include <linux/threads.h>
#include <linux/spinlock.h>
#include <linux/blk.h>
#ifdef DEBUG_YABOOT
#define call_yaboot(FUNC,...) \
do { \
if (FUNC) { \
struct prom_t *_prom = PTRRELOC(&prom); \
unsigned long prom_entry = _prom->entry;\
_prom->entry = (unsigned long)(FUNC); \
enter_prom(__VA_ARGS__); \
_prom->entry = prom_entry; \
} \
} while (0)
#else
#define call_yaboot(FUNC,...) do { ; } while (0)
#endif
#include <linux/types.h>
#include <linux/pci.h>
#include <asm/prom.h>
......@@ -65,16 +45,14 @@
#include <asm/bitops.h>
#include <asm/naca.h>
#include <asm/pci.h>
#include "open_pic.h"
#include <asm/bootinfo.h>
#include <asm/ppcdebug.h>
#include "open_pic.h"
#ifdef CONFIG_FB
#include <asm/linux_logo.h>
#endif
extern char _end[];
/*
* prom_init() is called very early on, before the kernel text
* and data have been mapped to KERNELBASE. At this point the code
......@@ -131,12 +109,7 @@ struct pci_intr_map {
typedef unsigned long interpret_func(struct device_node *, unsigned long,
int, int);
#if 0
static interpret_func interpret_pci_props;
#endif
static unsigned long interpret_pci_props(struct device_node *, unsigned long,
int, int);
static interpret_func interpret_isa_props;
static interpret_func interpret_root_props;
......@@ -156,9 +129,6 @@ struct prom_t prom = {
0, /* version */
32, /* encode_phys_size */
0 /* bi_rec pointer */
#ifdef DEBUG_YABOOT
,NULL /* yaboot */
#endif
};
......@@ -170,9 +140,6 @@ extern struct rtas_t rtas;
extern unsigned long klimit;
extern unsigned long embedded_sysmap_end;
extern struct lmb lmb;
#ifdef CONFIG_MSCHUNKS
extern struct msChunks msChunks;
#endif /* CONFIG_MSCHUNKS */
#define MAX_PHB 16 * 3 // 16 Towers * 3 PHBs/tower
struct _of_tce_table of_tce_table[MAX_PHB + 1] = {{0, 0, 0}};
......@@ -203,12 +170,6 @@ static struct bi_record * prom_bi_rec_verify(struct bi_record *);
static unsigned long prom_bi_rec_reserve(unsigned long);
static struct device_node *find_phandle(phandle);
#ifdef CONFIG_MSCHUNKS
static unsigned long prom_initialize_mschunks(unsigned long);
#ifdef DEBUG_PROM
void prom_dump_mschunks_mapping(void);
#endif /* DEBUG_PROM */
#endif /* CONFIG_MSCHUNKS */
#ifdef DEBUG_PROM
void prom_dump_lmb(void);
#endif
......@@ -217,8 +178,6 @@ extern unsigned long reloc_offset(void);
extern void enter_prom(void *dummy,...);
void cacheable_memzero(void *, unsigned int);
extern char cmd_line[512]; /* XXX */
unsigned long dev_tree_size;
......@@ -545,20 +504,6 @@ prom_initialize_lmb(unsigned long mem)
unsigned long lmb_base, lmb_size;
unsigned long num_regs, bytes_per_reg = (_prom->encode_phys_size*2)/8;
#ifdef CONFIG_MSCHUNKS
unsigned long max_addr = 0;
#if 1
/* Fix me: 630 3G-4G IO hack here... -Peter (PPPBBB) */
unsigned long io_base = 3UL<<30;
unsigned long io_size = 1UL<<30;
unsigned long have_630 = 1; /* assume we have a 630 */
#else
unsigned long io_base = <real io base here>;
unsigned long io_size = <real io size here>;
#endif
#endif /* CONFIG_MSCHUNKS */
lmb_init();
for (node = 0; prom_next_node(&node); ) {
......@@ -581,42 +526,17 @@ prom_initialize_lmb(unsigned long mem)
lmb_size = reg.addr64[i].size;
}
#ifdef CONFIG_MSCHUNKS
if ( lmb_addrs_overlap(lmb_base,lmb_size,
io_base,io_size) ) {
/* If we really have dram here, then we don't
* have a 630! -Peter
*/
have_630 = 0;
}
#endif /* CONFIG_MSCHUNKS */
if ( lmb_add(lmb_base, lmb_size) < 0 )
prom_print(RELOC("Too many LMB's, discarding this one...\n"));
#ifdef CONFIG_MSCHUNKS
else if ( max_addr < (lmb_base+lmb_size-1) )
max_addr = lmb_base+lmb_size-1;
#endif /* CONFIG_MSCHUNKS */
}
}
#ifdef CONFIG_MSCHUNKS
if ( have_630 && lmb_addrs_overlap(0,max_addr,io_base,io_size) )
lmb_add_io(io_base, io_size);
#endif /* CONFIG_MSCHUNKS */
lmb_analyze();
#ifdef DEBUG_PROM
prom_dump_lmb();
#endif /* DEBUG_PROM */
#ifdef CONFIG_MSCHUNKS
mem = prom_initialize_mschunks(mem);
#ifdef DEBUG_PROM
prom_dump_mschunks_mapping();
#endif /* DEBUG_PROM */
#endif /* CONFIG_MSCHUNKS */
return mem;
}
......@@ -718,96 +638,6 @@ unsigned long prom_strtoul(const char *cp)
return result;
}
#ifdef CONFIG_MSCHUNKS
static unsigned long
prom_initialize_mschunks(unsigned long mem)
{
unsigned long offset = reloc_offset();
struct lmb *_lmb = PTRRELOC(&lmb);
struct msChunks *_msChunks = PTRRELOC(&msChunks);
unsigned long i, pchunk = 0;
unsigned long addr_range = _lmb->memory.size + _lmb->memory.iosize;
unsigned long chunk_size = _lmb->memory.lcd_size;
mem = msChunks_alloc(mem, addr_range / chunk_size, chunk_size);
/* First create phys -> abs mapping for memory/dram */
for (i=0; i < _lmb->memory.cnt ;i++) {
unsigned long base = _lmb->memory.region[i].base;
unsigned long size = _lmb->memory.region[i].size;
unsigned long achunk = addr_to_chunk(base);
unsigned long end_achunk = addr_to_chunk(base+size);
if(_lmb->memory.region[i].type != LMB_MEMORY_AREA)
continue;
_lmb->memory.region[i].physbase = chunk_to_addr(pchunk);
for (; achunk < end_achunk ;) {
PTRRELOC(_msChunks->abs)[pchunk++] = achunk++;
}
}
#ifdef CONFIG_MSCHUNKS
/* Now create phys -> abs mapping for IO */
for (i=0; i < _lmb->memory.cnt ;i++) {
unsigned long base = _lmb->memory.region[i].base;
unsigned long size = _lmb->memory.region[i].size;
unsigned long achunk = addr_to_chunk(base);
unsigned long end_achunk = addr_to_chunk(base+size);
if(_lmb->memory.region[i].type != LMB_IO_AREA)
continue;
_lmb->memory.region[i].physbase = chunk_to_addr(pchunk);
for (; achunk < end_achunk ;) {
PTRRELOC(_msChunks->abs)[pchunk++] = achunk++;
}
}
#endif /* CONFIG_MSCHUNKS */
return mem;
}
#ifdef DEBUG_PROM
void
prom_dump_mschunks_mapping(void)
{
unsigned long offset = reloc_offset();
struct msChunks *_msChunks = PTRRELOC(&msChunks);
unsigned long chunk;
prom_print(RELOC("\nprom_dump_mschunks_mapping:\n"));
prom_print(RELOC(" msChunks.num_chunks = 0x"));
prom_print_hex(_msChunks->num_chunks);
prom_print_nl();
prom_print(RELOC(" msChunks.chunk_size = 0x"));
prom_print_hex(_msChunks->chunk_size);
prom_print_nl();
prom_print(RELOC(" msChunks.chunk_shift = 0x"));
prom_print_hex(_msChunks->chunk_shift);
prom_print_nl();
prom_print(RELOC(" msChunks.chunk_mask = 0x"));
prom_print_hex(_msChunks->chunk_mask);
prom_print_nl();
prom_print(RELOC(" msChunks.abs = 0x"));
prom_print_hex(_msChunks->abs);
prom_print_nl();
prom_print(RELOC(" msChunks mapping:\n"));
for(chunk=0; chunk < _msChunks->num_chunks ;chunk++) {
prom_print(RELOC(" phys 0x"));
prom_print_hex(chunk);
prom_print(RELOC(" -> abs 0x"));
prom_print_hex(PTRRELOC(_msChunks->abs)[chunk]);
prom_print_nl();
}
}
#endif /* DEBUG_PROM */
#endif /* CONFIG_MSCHUNKS */
#ifdef DEBUG_PROM
void
prom_dump_lmb(void)
......@@ -1213,23 +1043,23 @@ prom_hold_cpus(unsigned long mem)
unsigned long __init
prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
unsigned long r6, unsigned long r7, yaboot_debug_t *yaboot)
unsigned long r6, unsigned long r7)
{
int chrp = 0;
unsigned long mem;
ihandle prom_mmu, prom_op, prom_root, prom_cpu;
ihandle prom_root, prom_cpu;
phandle cpu_pkg;
unsigned long offset = reloc_offset();
long l;
char *p, *d;
unsigned long phys;
u32 getprop_rval;
struct naca_struct *_naca = RELOC(naca);
struct naca_struct *_naca = RELOC(naca);
struct paca_struct *_xPaca = PTRRELOC(&paca[0]);
struct prom_t *_prom = PTRRELOC(&prom);
/* Default machine type. */
_naca->platform = PLATFORM_PSERIES;
/* Reset klimit to take into account the embedded system map */
if (RELOC(embedded_sysmap_end))
RELOC(klimit) = __va(PAGE_ALIGN(RELOC(embedded_sysmap_end)));
......@@ -1241,33 +1071,10 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
RELOC(klimit) = PTRUNRELOC((unsigned long)_prom->bi_recs + _prom->bi_recs->data[1]);
}
#ifdef DEBUG_YABOOT
call_yaboot(yaboot->dummy,offset>>32,offset&0xffffffff);
call_yaboot(yaboot->printf, RELOC("offset = 0x%08x%08x\n"), LONG_MSW(offset), LONG_LSW(offset));
#endif
/* Default */
phys = KERNELBASE - offset;
#ifdef DEBUG_YABOOT
call_yaboot(yaboot->printf, RELOC("phys = 0x%08x%08x\n"), LONG_MSW(phys), LONG_LSW(phys));
#endif
#ifdef DEBUG_YABOOT
_prom->yaboot = yaboot;
call_yaboot(yaboot->printf, RELOC("pp = 0x%08x%08x\n"), LONG_MSW(pp), LONG_LSW(pp));
call_yaboot(yaboot->printf, RELOC("prom = 0x%08x%08x\n"), LONG_MSW(_prom->entry), LONG_LSW(_prom->entry));
#endif
/* First get a handle for the stdout device */
_prom->chosen = (ihandle)call_prom(RELOC("finddevice"), 1, 1,
RELOC("/chosen"));
#ifdef DEBUG_YABOOT
call_yaboot(yaboot->printf, RELOC("prom->chosen = 0x%08x%08x\n"), LONG_MSW(_prom->chosen), LONG_LSW(_prom->chosen));
#endif
if ((long)_prom->chosen <= 0)
prom_exit();
......@@ -1278,22 +1085,7 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
_prom->stdout = (ihandle)(unsigned long)getprop_rval;
#ifdef DEBUG_YABOOT
if (_prom->stdout == 0) {
call_yaboot(yaboot->printf, RELOC("prom->stdout = 0x%08x%08x\n"), LONG_MSW(_prom->stdout), LONG_LSW(_prom->stdout));
}
call_yaboot(yaboot->printf, RELOC("prom->stdout = 0x%08x%08x\n"), LONG_MSW(_prom->stdout), LONG_LSW(_prom->stdout));
#endif
#ifdef DEBUG_YABOOT
call_yaboot(yaboot->printf, RELOC("Location: 0x11\n"));
#endif
mem = RELOC(klimit) - offset;
#ifdef DEBUG_YABOOT
call_yaboot(yaboot->printf, RELOC("Location: 0x11b\n"));
#endif
/* Get the full OF pathname of the stdout device */
p = (char *) mem;
......@@ -1311,34 +1103,6 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
}
_prom->encode_phys_size = (getprop_rval==1) ? 32 : 64;
#ifdef DEBUG_PROM
prom_print(RELOC("DRENG: Detect OF version...\n"));
#endif
/* Find the OF version */
prom_op = (ihandle)call_prom(RELOC("finddevice"), 1, 1, RELOC("/openprom"));
if (prom_op != (ihandle)-1) {
char model[64];
long sz;
sz = (long)call_prom(RELOC("getprop"), 4, 1, prom_op,
RELOC("model"), model, 64);
if (sz > 0) {
char *c;
/* hack to skip the ibm chrp firmware # */
if ( strncmp(model,RELOC("IBM"),3) ) {
for (c = model; *c; c++)
if (*c >= '0' && *c <= '9') {
_prom->version = *c - '0';
break;
}
}
else
chrp = 1;
}
}
if (_prom->version >= 3)
prom_print(RELOC("OF Version 3 detected.\n"));
/* Determine which cpu is actually running right _now_ */
if ((long)call_prom(RELOC("getprop"), 4, 1, _prom->chosen,
RELOC("cpu"), &getprop_rval,
......@@ -1408,35 +1172,9 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
if (_naca->platform == PLATFORM_PSERIES)
prom_initialize_tce_table();
if ((long) call_prom(RELOC("getprop"), 4, 1,
_prom->chosen,
RELOC("mmu"),
&getprop_rval,
sizeof(getprop_rval)) <= 0) {
prom_print(RELOC(" no MMU found\n"));
prom_exit();
}
/* We assume the phys. address size is 3 cells */
RELOC(prom_mmu) = (ihandle)(unsigned long)getprop_rval;
if ((long)call_prom(RELOC("call-method"), 4, 4,
RELOC("translate"),
prom_mmu,
(void *)(KERNELBASE - offset),
(void *)1) != 0) {
prom_print(RELOC(" (translate failed) "));
} else {
prom_print(RELOC(" (translate ok) "));
phys = (unsigned long)_prom->args.rets[3];
}
/* If OpenFirmware version >= 3, then use quiesce call */
if (_prom->version >= 3) {
prom_print(RELOC("Calling quiesce ...\n"));
call_prom(RELOC("quiesce"), 0, 0);
phys = KERNELBASE - offset;
}
prom_print(RELOC("Calling quiesce ...\n"));
call_prom(RELOC("quiesce"), 0, 0);
phys = KERNELBASE - offset;
prom_print(RELOC("returning from prom_init\n"));
return phys;
......
......@@ -2,7 +2,9 @@
# Makefile for ppc64-specific library files..
#
export-objs := dec_and_lock.o
L_TARGET = lib.a
obj-y := checksum.o dec_and_lock.o string.o strcase.o copypage.o \
memcpy.o copyuser.o
export-objs := dec_and_lock.o
obj-y := checksum.o dec_and_lock.o string.o strcase.o
obj-y += copypage.o memcpy.o copyuser.o
......@@ -2,7 +2,7 @@
# Makefile for the linux ppc-specific parts of the memory manager.
#
EXTRA_CFLAGS = -mno-minimal-toc
EXTRA_CFLAGS += -mno-minimal-toc
obj-y := fault.o init.o extable.o imalloc.o
obj-y := fault.o init.o extable.o imalloc.o
obj-$(CONFIG_DISCONTIGMEM) += numa.o
obj-$(CONFIG_OPROFILE) += oprofile.o
DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \
oprof.o cpu_buffer.o buffer_sync.o \
event_buffer.o oprofile_files.o \
oprofilefs.o oprofile_stats.o )
oprofile-y := $(DRIVER_OBJS) init.o timer_int.o
oprofile-y := $(DRIVER_OBJS) init.o timer_int.o
# Makefile for xmon
EXTRA_CFLAGS = -mno-minimal-toc
EXTRA_CFLAGS += -mno-minimal-toc
obj-y := start.o xmon.o ppc-dis.o ppc-opc.o subr_prf.o setjmp.o
obj-y := start.o xmon.o ppc-dis.o ppc-opc.o subr_prf.o setjmp.o
......@@ -14,29 +14,13 @@
#include <asm/page.h>
#include <asm/prom.h>
#include <asm/processor.h>
/* Transition to udbg isn't quite done yet...but very close. */
#define USE_UDBG
#ifdef USE_UDBG
#include <asm/udbg.h>
#endif
#ifndef USE_UDBG
static volatile unsigned char *sccc, *sccd;
#endif
unsigned long TXRDY, RXRDY;
extern void xmon_printf(const char *fmt, ...);
static int xmon_expect(const char *str, unsigned int timeout);
#ifndef USE_UDBG
static int console = 0;
#endif
static int via_modem = 0;
/* static int xmon_use_sccb = 0; --Unused */
#define TB_SPEED 25000000
extern void *comport1;
static inline unsigned int readtb(void)
{
unsigned int ret;
......@@ -45,16 +29,10 @@ static inline unsigned int readtb(void)
return ret;
}
#ifndef USE_UDBG
void buf_access(void)
static void sysrq_handle_xmon(int key, struct pt_regs *pt_regs,
struct tty_struct *tty)
{
sccd[3] &= ~0x80; /* reset DLAB */
}
#endif
static void sysrq_handle_xmon(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
{
xmon(pt_regs);
xmon(pt_regs);
}
static struct sysrq_key_op sysrq_xmon_op =
{
......@@ -68,50 +46,12 @@ xmon_map_scc(void)
{
/* This maybe isn't the best place to register sysrq 'x' */
__sysrq_put_key_op('x', &sysrq_xmon_op);
#ifndef USE_UDBG
/* should already be mapped by the kernel boot */
sccd = (volatile unsigned char *) (((unsigned long)comport1));
sccc = (volatile unsigned char *) (((unsigned long)comport1)+5);
TXRDY = 0x20;
RXRDY = 1;
#endif
}
static int scc_initialized = 0;
void xmon_init_scc(void);
extern void pmu_poll(void);
int
xmon_write(void *handle, void *ptr, int nb)
{
#ifdef USE_UDBG
return udbg_write(ptr, nb);
#else
char *p = ptr;
int i, c, ct;
if (!scc_initialized)
xmon_init_scc();
ct = 0;
for (i = 0; i < nb; ++i) {
while ((*sccc & TXRDY) == 0) {
}
c = p[i];
if (c == '\n' && !ct) {
c = '\r';
ct = 1;
--i;
} else {
if (console)
printk("%c", c);
ct = 0;
}
buf_access();
*sccd = c;
}
return i;
#endif
}
int xmon_wants_key;
......@@ -119,68 +59,15 @@ int xmon_wants_key;
int
xmon_read(void *handle, void *ptr, int nb)
{
#ifdef USE_UDBG
return udbg_read(ptr, nb);
#else
char *p = ptr;
int i, c;
if (!scc_initialized)
xmon_init_scc();
for (i = 0; i < nb; ++i) {
do {
while ((*sccc & RXRDY) == 0)
;
buf_access();
c = *sccd;
} while (c == 0x11 || c == 0x13);
*p++ = c;
}
return i;
#endif
}
int
xmon_read_poll(void)
{
#ifdef USE_UDBG
return udbg_getc_poll();
#else
if ((*sccc & RXRDY) == 0) {
return -1;
}
buf_access();
return *sccd;
#endif
}
void
xmon_init_scc()
{
#ifndef USE_UDBG
sccd[3] = 0x83; eieio(); /* LCR = 8N1 + DLAB */
sccd[0] = 12; eieio(); /* DLL = 9600 baud */
sccd[1] = 0; eieio();
sccd[2] = 0; eieio(); /* FCR = 0 */
sccd[3] = 3; eieio(); /* LCR = 8N1 */
sccd[1] = 0; eieio(); /* IER = 0 */
#endif
scc_initialized = 1;
if (via_modem) {
for (;;) {
xmon_write(0, "ATE1V1\r", 7);
if (xmon_expect("OK", 5)) {
xmon_write(0, "ATA\r", 4);
if (xmon_expect("CONNECT", 40))
break;
}
xmon_write(0, "+++", 3);
xmon_expect("OK", 3);
}
}
}
void *xmon_stdin;
void *xmon_stdout;
void *xmon_stderr;
......
......@@ -155,12 +155,6 @@ struct prom_args {
prom_arg_t *rets; /* Pointer to return values in args[16]. */
};
typedef struct {
u32 printf; /* void (*printf)(char *, ...); */
u32 memdump; /* void (*memdump)(unsigned char *, unsigned long); */
u32 dummy; /* void (*dummy)(void); */
} yaboot_debug_t;
struct prom_t {
unsigned long entry;
ihandle chosen;
......@@ -171,9 +165,6 @@ struct prom_t {
unsigned long version;
unsigned long encode_phys_size;
struct bi_record *bi_recs;
#ifdef DEBUG_YABOOT
yaboot_debug_t *yaboot;
#endif
};
extern struct prom_t prom;
......@@ -183,7 +174,7 @@ extern int boot_cpuid;
/* Prototypes */
extern void abort(void);
extern unsigned long prom_init(unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long, yaboot_debug_t *);
unsigned long, unsigned long);
extern void prom_print(const char *msg);
extern void relocate_nodes(void);
extern void finish_device_tree(void);
......
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