PPC commit
This commit is contained in:
parent
fe0b6bc0c5
commit
6510b2a77b
16 changed files with 363 additions and 286 deletions
|
|
@ -1,3 +1,2 @@
|
|||
dir boot
|
||||
#dir boot
|
||||
dir lib
|
||||
dir smp
|
||||
|
|
|
|||
|
|
@ -1,131 +1,239 @@
|
|||
/* -*- asm -*-
|
||||
* $ $
|
||||
*
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* Copyright 2000 AG Electronics Ltd. */
|
||||
/* This code is distributed without warranty under the GPL v2 (see COPYING) */
|
||||
|
||||
#include <arch/asm.h>
|
||||
#include <arch/intel.h>
|
||||
#define ASM
|
||||
#include "ppcreg.h"
|
||||
#include <ppc_asm.tmpl>
|
||||
|
||||
#define BSP_IOREGION1 0x80000000
|
||||
#define BSP_IOMASK1 BAT_BL_256M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
|
||||
#define BSP_IOREGION2 0xFD000000
|
||||
#define BSP_IOMASK2 BAT_BL_32M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
|
||||
|
||||
#include <pciconf.h>
|
||||
#ifdef SMP
|
||||
#include <cpu/p6/apic.h>
|
||||
#endif
|
||||
/*
|
||||
* This is the entry code the code in .reset section
|
||||
* jumps to this address.
|
||||
*
|
||||
*/
|
||||
.section ".rom.data", "a", @progbits
|
||||
.section ".rom.text", "ax", @progbits
|
||||
|
||||
intel_chip_post_macro(0x01) /* delay for chipsets */
|
||||
.globl _start
|
||||
.type _start, @function
|
||||
.globl __bss_end
|
||||
.globl __start_address_check
|
||||
|
||||
/*
|
||||
* Locate at hreset vector
|
||||
*/
|
||||
.space (0x100)
|
||||
|
||||
_start:
|
||||
b system_reset
|
||||
|
||||
/*
|
||||
* Space for exception table
|
||||
*/
|
||||
.space (0x3000)
|
||||
|
||||
system_reset:
|
||||
isync
|
||||
|
||||
/*
|
||||
* Disable dcache and MMU, so that init_memory stands a chance
|
||||
*/
|
||||
li r0, 0
|
||||
sync
|
||||
mtspr HID0, r0
|
||||
sync
|
||||
mtmsr r0
|
||||
isync
|
||||
|
||||
/*
|
||||
* Invalidate BATS
|
||||
*/
|
||||
mtibatu 0, r0
|
||||
mtibatu 1, r0
|
||||
mtibatu 2, r0
|
||||
mtibatu 3, r0
|
||||
isync
|
||||
mtdbatu 0, r0
|
||||
mtdbatu 1, r0
|
||||
mtdbatu 2, r0
|
||||
mtdbatu 3, r0
|
||||
isync
|
||||
|
||||
/*
|
||||
* Clear segment registers
|
||||
*/
|
||||
mtsr 0, r0
|
||||
isync
|
||||
mtsr 1, r0
|
||||
isync
|
||||
mtsr 2, r0
|
||||
isync
|
||||
mtsr 3, r0
|
||||
isync
|
||||
mtsr 4, r0
|
||||
isync
|
||||
mtsr 5, r0
|
||||
isync
|
||||
mtsr 6, r0
|
||||
isync
|
||||
mtsr 7, r0
|
||||
isync
|
||||
mtsr 8, r0
|
||||
isync
|
||||
mtsr 9, r0
|
||||
isync
|
||||
mtsr 10, r0
|
||||
isync
|
||||
mtsr 11, r0
|
||||
isync
|
||||
mtsr 12, r0
|
||||
isync
|
||||
mtsr 13, r0
|
||||
isync
|
||||
mtsr 14, r0
|
||||
isync
|
||||
mtsr 15, r0
|
||||
isync
|
||||
|
||||
/*
|
||||
* Initialize northbridge. This has to happen early because it
|
||||
* resets memory. Memory is on at this point, albeit with
|
||||
* pessimistic settings. We reconfigure later using I2C.
|
||||
*/
|
||||
bl bsp_init_northbridge
|
||||
|
||||
/*
|
||||
* CACHE_RAM_BASE - this is a 128KB BAT covering the
|
||||
* __start_data address. We allocate it in the cache so
|
||||
* that we can continue running and
|
||||
* report a memory failure in early startup code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set up DBATs
|
||||
*/
|
||||
//lis r2, CACHE_RAM_BASE@ha
|
||||
//lis r2, _RAMBASE@ha
|
||||
//ori r3, r2, BAT_BL_256M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
|
||||
//ori r2, r2, BAT_READ_WRITE
|
||||
lis r2, 0@ha
|
||||
ori r3, r2, BAT_BL_256M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
|
||||
ori r2, r2, BAT_READ_WRITE
|
||||
mtdbatu 0, r3
|
||||
mtdbatl 0, r2
|
||||
isync
|
||||
|
||||
//lis r2, _ROMBASE@ha
|
||||
//ori r3, r2, BAT_BL_16M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
|
||||
//ori r2, r2, BAT_READ_ONLY
|
||||
//mtdbatu 1, r3
|
||||
//mtdbatl 1, r2
|
||||
lis r2, 0xfc000000@ha
|
||||
ori r3, r2, BAT_BL_64M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
|
||||
ori r2, r2, BAT_CACHE_INHIBITED | BAT_GUARDED | BAT_READ_WRITE
|
||||
mtdbatu 1, r3
|
||||
mtdbatl 1, r2
|
||||
isync
|
||||
|
||||
lis r2, BSP_IOREGION1@h
|
||||
ori r3, r2, BSP_IOMASK1
|
||||
ori r2, r2, BAT_CACHE_INHIBITED | BAT_GUARDED | BAT_READ_WRITE
|
||||
mtdbatu 2, r3
|
||||
mtdbatl 2, r2
|
||||
isync
|
||||
|
||||
//lis r2, BSP_IOREGION2@h
|
||||
//ori r3, r2, BSP_IOMASK2
|
||||
//ori r2, r2, BAT_CACHE_INHIBITED | BAT_GUARDED | BAT_READ_WRITE
|
||||
//mtdbatu 3, r3
|
||||
//mtdbatl 3, r2
|
||||
|
||||
/*
|
||||
* IBATS
|
||||
*/
|
||||
lis r2, 0@ha
|
||||
ori r3, r2, BAT_BL_256M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
|
||||
ori r2, r2, BAT_READ_WRITE
|
||||
mtibatu 0, r3
|
||||
mtibatl 0, r2
|
||||
isync
|
||||
|
||||
lis r2, _ROMBASE@ha
|
||||
ori r3, r2, BAT_BL_16M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
|
||||
ori r2, r2, BAT_READ_ONLY
|
||||
mtibatu 1, r3
|
||||
mtibatl 1, r2
|
||||
isync
|
||||
|
||||
/*
|
||||
* Invalidate tlb entries
|
||||
*/
|
||||
lis r3, 0
|
||||
lis r5, 0x4
|
||||
isync
|
||||
tlblp:
|
||||
tlbie r3
|
||||
sync
|
||||
addi r3, r3, 0x1000
|
||||
cmp 0, 0, r3, r5
|
||||
blt tlblp
|
||||
|
||||
sync
|
||||
|
||||
/*
|
||||
* Enable MMU
|
||||
*/
|
||||
mfmsr r2
|
||||
ori r2, r2, MSR_DR | MSR_IR
|
||||
isync
|
||||
mtmsr r2
|
||||
isync
|
||||
|
||||
/*
|
||||
* Relocate payload (text & data) to ram
|
||||
*/
|
||||
lis r3, _liseg@ha
|
||||
addi r3, r3, _liseg@l
|
||||
lis r4, _iseg@ha
|
||||
addi r4, r4, _iseg@l
|
||||
|
||||
/*
|
||||
* Skip if they're the same
|
||||
*/
|
||||
cmp 0, 0, r3, r4
|
||||
beq skip
|
||||
|
||||
lis r7, _eliseg@ha
|
||||
addi r7, r7, _eliseg@l
|
||||
|
||||
relocate_loop:
|
||||
lwzx r5, 0, r3
|
||||
stwx r5, 0, r4
|
||||
addi r3, r3, 4
|
||||
addi r4, r4, 4
|
||||
cmp 0, 0, r3, r7
|
||||
ble relocate_loop
|
||||
|
||||
skip:
|
||||
/*
|
||||
* Enable L1 dcache
|
||||
*/
|
||||
mfspr r2, HID0
|
||||
ori r2, r2, HID0_DCE | HID0_DCFI
|
||||
sync
|
||||
mtspr HID0, r2
|
||||
|
||||
/*
|
||||
* Enable L1 icache
|
||||
*/
|
||||
mfspr r2, HID0
|
||||
ori r2, r2, HID0_ICE | HID0_ICFI
|
||||
isync
|
||||
mtspr HID0, r2
|
||||
|
||||
/*
|
||||
* Start payload
|
||||
*/
|
||||
b _iseg
|
||||
|
||||
#include "crt0_includes.h"
|
||||
|
||||
CONSOLE_DEBUG_TX_STRING($str_after_ram)
|
||||
|
||||
/* clear boot_complete flag */
|
||||
xorl %ebp, %ebp
|
||||
__main:
|
||||
|
||||
/*
|
||||
* Copy data into RAM and clear the BSS. Since these segments
|
||||
* isn\'t really that big we just copy/clear using bytes, not
|
||||
* double words.
|
||||
*/
|
||||
intel_chip_post_macro(0x11) /* post 11 */
|
||||
|
||||
cld /* clear direction flag */
|
||||
|
||||
/* copy linuxBIOS from it's initial load location to
|
||||
* the location it is compiled to run at.
|
||||
* Normally this is copying from FLASH ROM to RAM.
|
||||
*/
|
||||
leal EXT(_liseg), %esi
|
||||
leal EXT(_iseg), %edi
|
||||
cmpl %esi, %edi
|
||||
jz .Lnocopy
|
||||
movl $EXT(_eliseg), %ecx
|
||||
subl %esi, %ecx
|
||||
jz .Lnocopy /* should not happen */
|
||||
rep
|
||||
movsb
|
||||
.Lnocopy:
|
||||
intel_chip_post_macro(0x12) /* post 12 */
|
||||
|
||||
/** clear stack */
|
||||
leal EXT(_stack), %edi
|
||||
movl $EXT(_estack), %ecx
|
||||
subl %edi, %ecx
|
||||
xorl %eax, %eax
|
||||
rep
|
||||
stosb
|
||||
|
||||
/** clear bss */
|
||||
leal EXT(_bss), %edi
|
||||
movl $EXT(_ebss), %ecx
|
||||
subl %edi, %ecx
|
||||
jz .Lnobss
|
||||
xorl %eax, %eax
|
||||
rep
|
||||
stosb
|
||||
.Lnobss:
|
||||
|
||||
/* set new stack */
|
||||
movl $_estack, %esp
|
||||
#ifdef SMP
|
||||
/* Get the cpu id */
|
||||
movl $APIC_DEFAULT_BASE, %edi
|
||||
movl APIC_ID(%edi), %eax
|
||||
shrl $24, %eax
|
||||
|
||||
/* Get the cpu index (MAX_CPUS on error) */
|
||||
movl $-4, %ebx
|
||||
1: addl $4, %ebx
|
||||
cmpl $(MAX_CPUS << 2), %ebx
|
||||
je 2
|
||||
cmpl %eax, EXT(initial_apicid)(%ebx)
|
||||
jne 1b
|
||||
2: shrl $2, %ebx
|
||||
|
||||
/* Now compute the appropriate stack */
|
||||
movl %ebx, %eax
|
||||
movl $STACK_SIZE, %ebx
|
||||
mull %ebx
|
||||
subl %eax, %esp
|
||||
#endif
|
||||
|
||||
/* push the boot_complete flag */
|
||||
pushl %ebp
|
||||
|
||||
/* Save the stack location */
|
||||
movl %esp, %ebp
|
||||
|
||||
/*
|
||||
* Now we are finished. Memory is up, data is copied and
|
||||
* bss is cleared. Now we call the main routine and
|
||||
* let it do the rest.
|
||||
*/
|
||||
intel_chip_post_macro(0xfe) /* post fe */
|
||||
|
||||
CONSOLE_DEBUG_TX_STRING($str_pre_main)
|
||||
|
||||
/* memory is up. Let\'s do the rest in C -- much easier. */
|
||||
|
||||
intel_chip_post_macro(0xfd) /* post fe */
|
||||
|
||||
/* Resort the stack location */
|
||||
movl %ebp, %esp
|
||||
|
||||
/* The boot_complete flag has already been pushed */
|
||||
call EXT(hardwaremain)
|
||||
/*NOTREACHED*/
|
||||
.Lhlt:
|
||||
intel_chip_post_macro(0xee) /* post fe */
|
||||
hlt
|
||||
jmp .Lhlt
|
||||
|
||||
.section ".rom.data"
|
||||
str_after_ram: .string "Copying LinuxBIOS to ram.\r\n"
|
||||
str_pre_main: .string "Jumping to LinuxBIOS.\r\n"
|
||||
.previous
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
* Memory map:
|
||||
*
|
||||
* _RAMBASE
|
||||
* : text segment
|
||||
* : data segment
|
||||
* : bss segment
|
||||
* : heap
|
||||
|
|
@ -26,14 +27,14 @@
|
|||
* We use ELF as output format. So that we can
|
||||
* debug the code in some form.
|
||||
*/
|
||||
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
|
||||
OUTPUT_ARCH(i386)
|
||||
|
||||
OUTPUT_FORMAT("elf32-powerpc")
|
||||
ENTRY(_start)
|
||||
|
||||
TARGET(binary)
|
||||
INPUT(linuxbios_payload)
|
||||
SECTIONS
|
||||
{
|
||||
. = DEFINED(_ROMBASE)? _ROMBASE : _RAMBASE;
|
||||
. = _ROMBASE;
|
||||
/* This section might be better named .setup */
|
||||
.rom . : {
|
||||
_rom = .;
|
||||
|
|
@ -44,88 +45,17 @@ SECTIONS
|
|||
}
|
||||
_lrom = LOADADDR(.rom);
|
||||
_elrom = LOADADDR(.rom) + SIZEOF(.rom);
|
||||
. = DEFINED(_ROMBASE)? _RAMBASE : . ;
|
||||
/*
|
||||
* First we place the code and read only data (typically const declared).
|
||||
* This get placed in rom.
|
||||
*/
|
||||
.text . : AT (_elrom) {
|
||||
_text = .;
|
||||
*(.text);
|
||||
*(.text.*);
|
||||
. = ALIGN(16);
|
||||
_etext = .;
|
||||
|
||||
.payload . : {
|
||||
_payload = . ;
|
||||
linuxbios_payload(*)
|
||||
_epayload = . ;
|
||||
}
|
||||
_ltext = LOADADDR(.text);
|
||||
_eltext = LOADADDR(.text) + SIZEOF(.text);
|
||||
.rodata . : AT(_eltext){
|
||||
_rodata = .;
|
||||
. = ALIGN(4);
|
||||
streams = . ;
|
||||
*(.rodata.streams)
|
||||
estreams = .;
|
||||
. = ALIGN(4);
|
||||
pci_drivers = . ;
|
||||
*(.rodata.pci_drivers)
|
||||
epci_drivers = . ;
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
_erodata = .;
|
||||
}
|
||||
_lrodata = LOADADDR(.rodata);
|
||||
_elrodata = LOADADDR(.rodata) + SIZEOF(.rodata);
|
||||
/*
|
||||
* After the code we place initialized data (typically initialized
|
||||
* global variables). This gets copied into ram by startup code.
|
||||
* __data_start and __data_end shows where in ram this should be placed,
|
||||
* whereas __data_loadstart and __data_loadend shows where in rom to
|
||||
* copy from.
|
||||
*/
|
||||
.data . : AT(_elrodata) {
|
||||
_data = .;
|
||||
*(.data)
|
||||
_edata = .;
|
||||
}
|
||||
_ldata = LOADADDR(.data);
|
||||
_eldata = LOADADDR(.data) + SIZEOF(.data);
|
||||
/* The initialized data segment.
|
||||
* This is all of the data that we copy from rom into the ram.
|
||||
*/
|
||||
_iseg = _text;
|
||||
_eiseg = _edata;
|
||||
_liseg = _ltext;
|
||||
_eliseg = _eldata;
|
||||
/*
|
||||
* bss does not contain data, it is just a space that should be zero
|
||||
* initialized on startup. (typically uninitialized global variables)
|
||||
* crt0.S fills between _bss and _ebss with zeroes.
|
||||
*/
|
||||
_bss = .;
|
||||
.bss . : {
|
||||
*(.bss)
|
||||
*(.sbss)
|
||||
*(COMMON)
|
||||
}
|
||||
_ebss = .;
|
||||
_end = .;
|
||||
_stack = .;
|
||||
.stack . : {
|
||||
/* Reserve a stack for each possible cpu, +1 extra */
|
||||
. = ((MAX_CPUS * STACK_SIZE) + STACK_SIZE) ;
|
||||
}
|
||||
_estack = .;
|
||||
_heap = .;
|
||||
.heap . : {
|
||||
/* Reserve 256K for the heap */
|
||||
. = HEAP_SIZE ;
|
||||
. = ALIGN(4);
|
||||
}
|
||||
_eheap = .;
|
||||
/* The ram segment
|
||||
* This is all address of the memory resident copy of linuxBIOS.
|
||||
*/
|
||||
_ram_seg = _text;
|
||||
_eram_seg = _eheap;
|
||||
_iseg = _RAMBASE;
|
||||
_eiseg = _iseg + SIZEOF(.payload);
|
||||
_liseg = _payload;
|
||||
_eliseg = _epayload;
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.comment)
|
||||
*(.note)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
option _ROMBASE=0xf0000
|
||||
option _RAMBASE=0x4000
|
||||
option ROM_IMAGE_SIZE=65536
|
||||
option PAYLOAD_SIZE=458752
|
||||
|
||||
# By default we only have one cpu
|
||||
option MAX_CPUS=1
|
||||
# Reserve 256K for the heap
|
||||
|
|
@ -10,36 +5,36 @@ option HEAP_SIZE=0x40000
|
|||
# Reserve 8K for each stack
|
||||
option STACK_SIZE=0x2000
|
||||
|
||||
# By default on x86 we have a memory hole between 640K and 1MB
|
||||
option MEMORY_HOLE=1
|
||||
|
||||
ldscript arch/i386/config/ldscript.base
|
||||
|
||||
# How do I add -mprefered-stack-boundary=2 if the compiler supports it?
|
||||
# On x86 tt results in a code size reduction.
|
||||
#
|
||||
ldscript arch/ppc/config/ldscript.base
|
||||
|
||||
dir /src/config
|
||||
|
||||
makerule all : romimage ;
|
||||
makerule floppy : all ; mcopy -o romimage a:
|
||||
makerule romimage : linuxbios.rom payload.block ; cat payload.block linuxbios.rom > romimage
|
||||
makerule all : linuxbios.sunix ;
|
||||
|
||||
makerule linuxbios.sdos: linuxbios ;
|
||||
addaction linuxbios.sdos $(OBJCOPY) linuxbios --change-addresses 0x1100000 -O srec $@
|
||||
|
||||
makerule linuxbios.sunix: linuxbios.sdos ;
|
||||
addaction linuxbios.sunix tr -d '\015' < linuxbios.sdos > linuxbios.sunix
|
||||
|
||||
#makerule all : romimage ;
|
||||
#makerule floppy : all ; mcopy -o romimage a:
|
||||
#makerule romimage : linuxbios.rom payload.block ; cat payload.block linuxbios.rom > romimage
|
||||
|
||||
#makerule linuxbios.rom: linuxbios.strip ;
|
||||
#addaction linuxbios.rom export size=`ls -l linuxbios.strip | (read p c u g size r ; echo $$size)` ; \
|
||||
#addaction linuxbios.rom echo $$size ; \
|
||||
#addaction linuxbios.rom dd if=linuxbios.strip of=linuxbios.rom bs=1 seek=`expr $(ROM_IMAGE_SIZE) - $$size`
|
||||
|
||||
|
||||
makerule linuxbios.rom: linuxbios.strip ;
|
||||
addaction linuxbios.rom export size=`ls -l linuxbios.strip | (read p c u g size r ; echo $$size)` ; \
|
||||
addaction linuxbios.rom echo $$size ; \
|
||||
addaction linuxbios.rom dd if=linuxbios.strip of=linuxbios.rom bs=1 seek=`expr $(ROM_IMAGE_SIZE) - $$size`
|
||||
#makerule payload.block : $(if $(PAYLOAD),$(PAYLOAD), linux.bin.gz) ; dd conv=sync bs=$(PAYLOAD_SIZE) if=$< of=$@
|
||||
|
||||
|
||||
makerule payload.block : $(if $(PAYLOAD),$(PAYLOAD), linux.bin.gz) ; dd conv=sync bs=$(PAYLOAD_SIZE) if=$< of=$@
|
||||
|
||||
makerule linux.bin.gz: linux.bin ;gzip -f -3 linux.bin
|
||||
makerule linux.bin: $(LINUX) ; objcopy -O binary -R .note -R .comment -S $< $@
|
||||
#makerule linux.bin.gz: linux.bin ;gzip -f -3 linux.bin
|
||||
#makerule linux.bin: $(LINUX) ; $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S $< $@
|
||||
|
||||
|
||||
addaction clean rm -f romimage linux.* payload.*
|
||||
|
||||
# do standard config files that the user need not specify
|
||||
# for now, this is just 'lib', but it may be more later.
|
||||
dir /src/arch/i386
|
||||
dir /src/arch/ppc
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef I386_STDDEF_H
|
||||
#define I386_STDDEF_H
|
||||
#ifndef PPC_STDDEF_H
|
||||
#define PPC_STDDEF_H
|
||||
|
||||
typedef long ptrdiff_t;
|
||||
typedef unsigned long size_t;
|
||||
|
|
@ -12,4 +12,4 @@ typedef unsigned int wint_t;
|
|||
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#endif /* I386_STDDEF_H */
|
||||
#endif /* PPC_STDDEF_H */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef I386_STDINT_H
|
||||
#define I386_STDINT_H
|
||||
#ifndef PPC_STDINT_H
|
||||
#define PPC_STDINT_H
|
||||
|
||||
/* Exact integral types */
|
||||
typedef unsigned char uint8_t;
|
||||
|
|
@ -49,4 +49,4 @@ typedef long long int intmax_t;
|
|||
typedef unsigned long long uintmax_t;
|
||||
|
||||
|
||||
#endif /* I386_STDINT_H */
|
||||
#endif /* PPC_STDINT_H */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
object i386_subr.o
|
||||
object params.o
|
||||
object hardwaremain.o
|
||||
object pirq_routing.o HAVE_PIRQ_TABLE
|
||||
object vgabios.o CONFIG_VGABIOS
|
||||
object idt.o CONFIG_REALMODE_IDT
|
||||
option CONFIG_LOGICAL_CPUS=1
|
||||
object c_start.S
|
||||
object setup.o
|
||||
object id.o
|
||||
object timer.o
|
||||
object timebase.S
|
||||
object floats.S
|
||||
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ expr CONFIG_UNCOMPRESSED=!CONFIG_COMPRESS
|
|||
makedefine LINUXBIOS_PAYLOAD-$(CONFIG_COMPRESS):=linuxbios_payload.nrv2b
|
||||
makedefine LINUXBIOS_PAYLOAD-$(CONFIG_UNCOMPRESSED):=linuxbios_payload.bin
|
||||
|
||||
addaction linuxbios_c nm -n linuxbios_c | sort > linuxbios_c.map
|
||||
addaction linuxbios_c $(CROSS_COMPILE)nm -n linuxbios_c | sort > linuxbios_c.map
|
||||
makerule linuxbios_payload.bin: linuxbios_c; $(OBJCOPY) -O binary $< $@
|
||||
makerule linuxbios_payload.nrv2b: linuxbios_payload.bin nrv2b ; ./nrv2b e $< $@
|
||||
makerule linuxbios_payload: $(LINUXBIOS_PAYLOAD-1) ; cp $(LINUXBIOS_PAYLOAD-1) linuxbios_payload
|
||||
makerule linuxbios: crt0.o linuxbios_payload ldscript.ld ; $(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o
|
||||
addaction linuxbios nm -n linuxbios | sort > linuxbios.map
|
||||
makerule linuxbios: crt0.o linuxbios_payload ldscript.ld; $(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o
|
||||
addaction linuxbios $(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map
|
||||
|
||||
makerule linuxbios.a : $(OBJECTS-1) ; rm -f linuxbios.a
|
||||
addaction linuxbios.a ar cr linuxbios.a $(OBJECTS-1)
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@
|
|||
#define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
|
||||
#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
|
||||
#define PCI_FUNC(devfn) ((devfn) & 0x07)
|
||||
#define PCI_BDF(bus,dev,func) ((bus) << 16 | (dev) << 11 | (func) << 8)
|
||||
|
||||
|
||||
#include <types.h>
|
||||
|
|
@ -344,6 +345,15 @@ struct pci_dev {
|
|||
struct pci_dev_operations *ops;
|
||||
};
|
||||
|
||||
struct pci_ops {
|
||||
int (*read_byte) (u8 bus, int devfn, int where, u8 * val);
|
||||
int (*read_word) (u8 bus, int devfn, int where, u16 * val);
|
||||
int (*read_dword) (u8 bus, int devfn, int where, u32 * val);
|
||||
int (*write_byte) (u8 bus, int devfn, int where, u8 val);
|
||||
int (*write_word) (u8 bus, int devfn, int where, u16 val);
|
||||
int (*write_dword) (u8 bus, int devfn, int where, u32 val);
|
||||
};
|
||||
|
||||
extern struct pci_dev pci_root; /* root bus */
|
||||
extern struct pci_dev *pci_devices; /* list of all devices */
|
||||
|
||||
|
|
@ -409,6 +419,7 @@ int pci_debugwrite_config_word(struct pci_dev *dev, u8 where, u16 val);
|
|||
int pci_debugwrite_config_dword(struct pci_dev *dev, u8 where, u32 val);
|
||||
void pci_set_master(struct pci_dev *dev);
|
||||
void pci_set_method(void);
|
||||
int pci_set_direct(struct pci_ops *);
|
||||
void pci_enumerate(void);
|
||||
void pci_configure(void);
|
||||
void pci_enable(void);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ static void flush_window(void)
|
|||
void gunzip_setup(void)
|
||||
{
|
||||
/* common globals -- don't rely on init! */
|
||||
printk_debug(__FUNCTION__ "\n");
|
||||
printk_debug("%s\n", __FUNCTION__ );
|
||||
outcnt = 0;
|
||||
bytes_out = 0;
|
||||
output_ptr = 0;
|
||||
|
|
|
|||
|
|
@ -35,16 +35,6 @@ unsigned long pci_memory_base = 0xc0000000;
|
|||
|
||||
static const struct pci_ops *conf;
|
||||
|
||||
struct pci_ops {
|
||||
int (*read_byte) (u8 bus, int devfn, int where, u8 * val);
|
||||
int (*read_word) (u8 bus, int devfn, int where, u16 * val);
|
||||
int (*read_dword) (u8 bus, int devfn, int where, u32 * val);
|
||||
int (*write_byte) (u8 bus, int devfn, int where, u8 val);
|
||||
int (*write_word) (u8 bus, int devfn, int where, u16 val);
|
||||
int (*write_dword) (u8 bus, int devfn, int where, u32 val);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Direct access to PCI hardware...
|
||||
*/
|
||||
|
|
@ -199,12 +189,13 @@ static int pci_sanity_check(const struct pci_ops *o)
|
|||
#define PCI_CLASS_DISPLAY_VGA 0x0300
|
||||
#define PCI_VENDOR_ID_COMPAQ 0x0e11
|
||||
#define PCI_VENDOR_ID_INTEL 0x8086
|
||||
#define PCI_VENDOR_ID_MOTOROLA 0x1057
|
||||
|
||||
for (bus = 0, devfn = 0; devfn < 0x100; devfn++)
|
||||
if ((!o->read_word(bus, devfn, PCI_CLASS_DEVICE, &x) &&
|
||||
(x == PCI_CLASS_BRIDGE_HOST || x == PCI_CLASS_DISPLAY_VGA)) ||
|
||||
(!o->read_word(bus, devfn, PCI_VENDOR_ID, &x) &&
|
||||
(x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ)))
|
||||
(x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ || x == PCI_VENDOR_ID_MOTOROLA)))
|
||||
return 1;
|
||||
printk_err("PCI: Sanity check failed\n");
|
||||
return 0;
|
||||
|
|
@ -385,6 +376,12 @@ void pci_set_method()
|
|||
conf = pci_check_direct();
|
||||
}
|
||||
|
||||
int pci_set_direct(struct pci_ops *method)
|
||||
{
|
||||
conf = method;
|
||||
return pci_sanity_check(method);
|
||||
}
|
||||
|
||||
/* allocating resources on PCI is a mess. The reason is that
|
||||
* the BAR size is actually two things: one is the size, and
|
||||
* the other is the alignment of the data. Take, for example, the
|
||||
|
|
@ -892,13 +889,11 @@ handle_superio(int pass, struct superio *all_superio[], int nsuperio)
|
|||
|
||||
for (i = 0; i < nsuperio; i++){
|
||||
s = all_superio[i];
|
||||
printk_debug(__FUNCTION__
|
||||
" Pass %d, check #%d, s %p s->super %p\n",
|
||||
pass, i, s, s->super);
|
||||
printk_debug("%s: Pass %d, check #%d, s %p s->super %p\n",
|
||||
__FUNCTION__, pass, i, s, s->super);
|
||||
if (!s->super) {
|
||||
printk_debug(__FUNCTION__
|
||||
" Pass %d, Skipping #%d as it has no superio pointer!\n",
|
||||
pass, i);
|
||||
printk_debug("%s: Pass %d, Skipping #%d as it has no superio pointer!\n",
|
||||
__FUNCTION__, pass, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -906,12 +901,12 @@ handle_superio(int pass, struct superio *all_superio[], int nsuperio)
|
|||
pass, s->super->name);
|
||||
|
||||
// if no port is assigned use the defaultport
|
||||
printk_info(__FUNCTION__ " port 0x%x, defaultport 0x%x\n",
|
||||
s->port, s->super->defaultport);
|
||||
printk_info("%s: port 0x%x, defaultport 0x%x\n",
|
||||
__FUNCTION__, s->port, s->super->defaultport);
|
||||
if (!s->port)
|
||||
s->port = s->super->defaultport;
|
||||
|
||||
printk_info(__FUNCTION__ " Using port 0x%x\n", s->port);
|
||||
printk_info("%s: Using port 0x%x\n", __FUNCTION__, s->port);
|
||||
|
||||
// need to have both pre_pci_init and devfn defined.
|
||||
if (s->super->pre_pci_init && (pass == 0)) {
|
||||
|
|
@ -924,7 +919,7 @@ handle_superio(int pass, struct superio *all_superio[], int nsuperio)
|
|||
printk_debug(" Call finishup\n");
|
||||
s->super->finishup(s);
|
||||
}
|
||||
printk_debug(__FUNCTION__ " Pass %d, done #%d\n", pass, i);
|
||||
printk_debug("%s: Pass %d, done #%d\n", __FUNCTION__, pass, i);
|
||||
}
|
||||
printk_debug("handle_superio done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,6 +144,33 @@ static inline unsigned long uart_rx_bytes(unsigned base_port,
|
|||
|
||||
inline void uart_init(unsigned base_port, unsigned divisor)
|
||||
{
|
||||
/*
|
||||
* enable divisor access
|
||||
*/
|
||||
outb(0x80 | UART_LCS, base_port + UART_LCR);
|
||||
|
||||
/*
|
||||
* set divisior
|
||||
*/
|
||||
outb((divisor >> 8) & 0xFF, base_port + UART_DLM);
|
||||
outb(divisor & 0xFF, base_port + UART_DLL);
|
||||
|
||||
/*
|
||||
* disable divisor access
|
||||
*/
|
||||
outb(UART_LCS, base_port + UART_LCR);
|
||||
|
||||
/*
|
||||
* set polled mode
|
||||
*/
|
||||
outb(0x0, base_port + UART_IER);
|
||||
|
||||
/*
|
||||
* enable and clear FIFOs
|
||||
*/
|
||||
outb(0x07, base_port + UART_FCR);
|
||||
outb(0x03, base_port + UART_MCR);
|
||||
#if 0
|
||||
/* disable interrupts */
|
||||
outb(0x0, base_port + UART_IER);
|
||||
/* enable fifo's */
|
||||
|
|
@ -153,6 +180,7 @@ inline void uart_init(unsigned base_port, unsigned divisor)
|
|||
outb(divisor & 0xFF, base_port + UART_DLL);
|
||||
outb((divisor >> 8) & 0xFF, base_port + UART_DLM);
|
||||
outb(UART_LCS, base_port + UART_LCR);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ttys0_init(void)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ void post_code(uint8_t value)
|
|||
{
|
||||
#ifdef SERIAL_POST
|
||||
printk_info("POST: 0x%02x\n", value);
|
||||
#endif
|
||||
#elsif !define(NO_POST)
|
||||
outb(value, 0x80);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
object keyboard.o
|
||||
object mc146818rtc.o
|
||||
object mc146818rtc.o CONFIG_MC146818RTC
|
||||
object isa-dma.o
|
||||
object i8259.o
|
||||
object i8259.o CONFIG_I8259
|
||||
object udelay_timer2.o CONFIG_UDELAY_TIMER2
|
||||
object beep.o
|
||||
object beep.o CONFIG_BEEP
|
||||
object vga_load_regs.o VIDEO_CONSOLE
|
||||
object font_8x16.o VIDEO_CONSOLE
|
||||
object vga_set_mode.o VIDEO_CONSOLE
|
||||
|
|
|
|||
|
|
@ -167,7 +167,8 @@ static int init_drive(unsigned base, int driveno)
|
|||
|
||||
printk_info("%s \n", harddisk_info[driveno].model_number);
|
||||
|
||||
printk_info(__FUNCTION__ " sectors_per_track=[%d], num_heads=[%d], num_cylinders=[%d]\n",
|
||||
printk_info("%s: sectors_per_track=[%d], num_heads=[%d], num_cylinders=[%d]\n",
|
||||
__FUNCTION__,
|
||||
harddisk_info[driveno].num_sectors_per_track,
|
||||
harddisk_info[driveno].num_heads,
|
||||
harddisk_info[driveno].num_cylinders);
|
||||
|
|
@ -332,9 +333,9 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
|
|||
int address_mode = harddisk_info[drive].address_mode;
|
||||
//int i;
|
||||
|
||||
printk_info(__FUNCTION__ " drive[%d], buffer[%08x], block[%08x], offset[%d], n_bytes[%d]\n",
|
||||
drive, buffer, block, byte_offset, n_bytes);
|
||||
printk_info(__FUNCTION__ " block(%08x) to addr(%08x)\r", block, (int)buffer);
|
||||
printk_info("%s: drive[%d], buffer[%08x], block[%08x], offset[%d], n_bytes[%d]\n",
|
||||
__FUNCTION__, drive, buffer, block, byte_offset, n_bytes);
|
||||
printk_info("%s: block(%08x) to addr(%08x)\r", __FUNCTION__, block, (int)buffer);
|
||||
if ((drive < 0) || (drive >= NUM_HD) ||
|
||||
(harddisk_info[drive].drive_exists == 0))
|
||||
{
|
||||
|
|
@ -360,7 +361,7 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
|
|||
IDE_DH_HEAD(track % harddisk_info[drive].num_heads) |
|
||||
IDE_DH_DRIVE(drive) |
|
||||
IDE_DH_CHS;
|
||||
printk_info(__FUNCTION__ " CHS: track=[%d], sector_number=[%d], cylinder=[%d]\n", track, cmd.sector_number, cmd.cylinder);
|
||||
printk_info("%s: CHS: track=[%d], sector_number=[%d], cylinder=[%d]\n", __FUNCTION__, track, cmd.sector_number, cmd.cylinder);
|
||||
/*
|
||||
*/
|
||||
} else {
|
||||
|
|
@ -379,8 +380,8 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
|
|||
IDE_DH_DRIVE(drive) |
|
||||
IDE_DH_LBA;
|
||||
#endif
|
||||
printk_info(__FUNCTION__ " LBA: drivehead[%0x], cylinder[%04x], sector[%0x], block[%8x]\n",
|
||||
cmd.drivehead, cmd.cylinder, cmd.sector_number, block & 0x0fffffff);
|
||||
printk_info("%s: LBA: drivehead[%0x], cylinder[%04x], sector[%0x], block[%8x]\n",
|
||||
__FUNCTION__, cmd.drivehead, cmd.cylinder, cmd.sector_number, block & 0x0fffffff);
|
||||
/*
|
||||
*/
|
||||
}
|
||||
|
|
@ -411,9 +412,9 @@ int ide_write_sector(int drive, void * buffer, unsigned int block ) {
|
|||
int address_mode = harddisk_info[drive].address_mode;
|
||||
//int i;
|
||||
|
||||
printk_info(__FUNCTION__ " drive[%d], buffer[%08x], block[%08x]\n",
|
||||
drive, buffer, block);
|
||||
printk_info(__FUNCTION__ " block(%08x) from addr(%08x)\r", block, (int)buffer);
|
||||
printk_info("%s: drive[%d], buffer[%08x], block[%08x]\n",
|
||||
__FUNCTION__, drive, buffer, block);
|
||||
printk_info("%s: block(%08x) from addr(%08x)\r", __FUNCTION__, block, (int)buffer);
|
||||
if ((drive < 0) || (drive >= NUM_HD) ||
|
||||
(harddisk_info[drive].drive_exists == 0))
|
||||
{
|
||||
|
|
@ -439,7 +440,7 @@ int ide_write_sector(int drive, void * buffer, unsigned int block ) {
|
|||
IDE_DH_HEAD(track % harddisk_info[drive].num_heads) |
|
||||
IDE_DH_DRIVE(drive) |
|
||||
IDE_DH_CHS;
|
||||
printk_info(__FUNCTION__ " CHS: track=[%d], sector_number=[%d], cylinder=[%d]\n", track, cmd.sector_number, cmd.cylinder);
|
||||
printk_info("%s: CHS: track=[%d], sector_number=[%d], cylinder=[%d]\n", __FUNCTION__, track, cmd.sector_number, cmd.cylinder);
|
||||
/*
|
||||
*/
|
||||
} else {
|
||||
|
|
@ -458,8 +459,8 @@ int ide_write_sector(int drive, void * buffer, unsigned int block ) {
|
|||
IDE_DH_DRIVE(drive) |
|
||||
IDE_DH_LBA;
|
||||
#endif
|
||||
printk_info(__FUNCTION__ " LBA: drivehead[%0x], cylinder[%04x], sector[%0x], block[%8x]\n",
|
||||
cmd.drivehead, cmd.cylinder, cmd.sector_number, block & 0x0fffffff);
|
||||
printk_info("%s: LBA: drivehead[%0x], cylinder[%04x], sector[%0x], block[%8x]\n",
|
||||
__FUNCTION__, cmd.drivehead, cmd.cylinder, cmd.sector_number, block & 0x0fffffff);
|
||||
/*
|
||||
*/
|
||||
}
|
||||
|
|
@ -510,8 +511,8 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
|
|||
IDE_DH_DRIVE(drive) |
|
||||
IDE_DH_CHS;
|
||||
|
||||
printk_info(__FUNCTION__ " track=[%d], sector_number=[%d], cylinder=[%d]\n",
|
||||
track, cmd.sector_number, cmd.cylinder);
|
||||
printk_info("%s: track=[%d], sector_number=[%d], cylinder=[%d]\n",
|
||||
__FUNCTION__, track, cmd.sector_number, cmd.cylinder);
|
||||
write_command(base, IDE_CMD_READ_MULTI_RETRY, &cmd);
|
||||
if ((inb_p(IDE_REG_STATUS(base)) & 1) != 0) {
|
||||
return 1;
|
||||
|
|
@ -524,7 +525,7 @@ int ide_read_sector(int drive, void * buffer, unsigned int block, int byte_offse
|
|||
} else {
|
||||
status = ide_read_data(base, buffer, IDE_SECTOR_SIZE);
|
||||
}
|
||||
printk_info(__FUNCTION__ " status = [%d]\n", status);
|
||||
printk_info("%s: status = [%d]\n", __FUNCTION__, status);
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -325,6 +325,14 @@ def keyboard(dir, keyboard_name):
|
|||
def cpu(dir, cpu_name):
|
||||
common_command_action(dir, 'cpu', cpu_name)
|
||||
|
||||
# COMMAND: pmc <vendor>/<pmc card name>
|
||||
#
|
||||
# This command may only be used once. Executes the
|
||||
# config file $(TOP)/src/pmc/<vendor>/<pmc card name>/Config
|
||||
#
|
||||
def pmc(dir, pmc_name):
|
||||
common_command_action(dir, 'pmc', pmc_name)
|
||||
|
||||
# COMMAND: northsouthbridge <vendor>/<northsouthbridge name>
|
||||
#
|
||||
# This command may only be used once. Executes the config file
|
||||
|
|
@ -824,6 +832,7 @@ command_actions = {
|
|||
'target' : target,
|
||||
'mainboard' : mainboard,
|
||||
'cpu' : cpu,
|
||||
'pmc' : pmc,
|
||||
'northbridge' : northbridge,
|
||||
'southbridge' : southbridge,
|
||||
'northsouthbridge' : northsouthbridge,
|
||||
|
|
@ -1048,7 +1057,7 @@ CPUFLAGS := $(foreach _var_,$(VARIABLES),$(call D_item,$(_var_)))
|
|||
# print out all the object dependencies
|
||||
file.write("\n# object dependencies (objectrules:)\n")
|
||||
# There is ALWAYS a crt0.o
|
||||
file.write("OBJECTS-1 := crt0.o\n")
|
||||
#file.write("OBJECTS-1 := crt0.o\n")
|
||||
file.write("DRIVERS-1 :=\n")
|
||||
for objrule in objectrules:
|
||||
obj_name = objrule[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue