[merge] merge back from smp branch
This commit is contained in:
@@ -65,13 +65,13 @@ void platform_halt(platform_halt_action suggested_action,
|
||||
case HALT_ACTION_SHUTDOWN:
|
||||
case HALT_ACTION_HALT:
|
||||
printf("HALT: spinning forever... (reason = %d)\n", reason);
|
||||
enter_critical_section();
|
||||
arch_disable_ints();
|
||||
for(;;)
|
||||
arch_idle();
|
||||
break;
|
||||
case HALT_ACTION_REBOOT:
|
||||
printf("REBOOT\n");
|
||||
enter_critical_section();
|
||||
arch_disable_ints();
|
||||
for (;;) {
|
||||
zynq_slcr_unlock();
|
||||
SLCR->PSS_RST_CTRL = 1;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <kernel/timer.h>
|
||||
#include <kernel/thread.h>
|
||||
#include <kernel/vm.h>
|
||||
#include <kernel/spinlock.h>
|
||||
#include <kernel/debug.h>
|
||||
#include <platform/interrupts.h>
|
||||
#include <platform/debug.h>
|
||||
@@ -55,6 +56,8 @@
|
||||
#define GEM_RX_BUF_SIZE 1536
|
||||
#define GEM_TX_BUF_SIZE 1536
|
||||
|
||||
static spin_lock_t lock = SPIN_LOCK_INITIAL_VALUE;
|
||||
|
||||
struct gem_desc {
|
||||
uint32_t addr;
|
||||
uint32_t ctrl;
|
||||
@@ -132,7 +135,8 @@ void queue_pkts_in_tx_tbl(void) {
|
||||
pktbuf_t *p;
|
||||
unsigned int cur_pos;
|
||||
|
||||
enter_critical_section();
|
||||
spin_lock_saved_state_t irqstate;
|
||||
spin_lock_irqsave(&lock, irqstate);
|
||||
if (list_is_empty(&gem.tx_queue)) {
|
||||
goto exit;
|
||||
}
|
||||
@@ -168,7 +172,7 @@ void queue_pkts_in_tx_tbl(void) {
|
||||
gem.regs->net_ctrl |= NET_CTRL_START_TX;
|
||||
|
||||
exit:
|
||||
exit_critical_section();
|
||||
spin_unlock_irqrestore(&lock, irqstate);
|
||||
}
|
||||
|
||||
int gem_send_raw_pkt(struct pktbuf *p)
|
||||
@@ -186,10 +190,11 @@ int gem_send_raw_pkt(struct pktbuf *p)
|
||||
// XXX handle multi part buffers
|
||||
arch_clean_cache_range((vaddr_t)p->data, p->dlen);
|
||||
|
||||
enter_critical_section();
|
||||
spin_lock_saved_state_t irqstate;
|
||||
spin_lock_irqsave(&lock, irqstate);
|
||||
list_add_tail(&gem.tx_queue, &p->list);
|
||||
queue_pkts_in_tx_tbl();
|
||||
exit_critical_section();
|
||||
spin_unlock_irqrestore(&lock, irqstate);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#define SDRAM_BASE (0x00100000)
|
||||
#define SDRAM_APERTURE_SIZE (0x3ff00000)
|
||||
#define SRAM_BASE (0x0)
|
||||
#define SRAM_BASE_HIGH (0xfffc0000)
|
||||
#define SRAM_APERTURE_SIZE (0x00040000)
|
||||
#define SRAM_SIZE (0x00040000)
|
||||
|
||||
|
||||
@@ -278,6 +278,12 @@ struct mmu_initial_mapping mmu_initial_mappings[] = {
|
||||
.flags = MMU_INITIAL_MAPPING_FLAG_DEVICE,
|
||||
.name = "hw-fc000000" },
|
||||
|
||||
/* sram high aperture */
|
||||
{ .phys = 0xfff00000,
|
||||
.virt = 0xfff00000,
|
||||
.size = 0x00100000,
|
||||
.flags = MMU_INITIAL_MAPPING_FLAG_DEVICE },
|
||||
|
||||
/* identity map to let the boot code run */
|
||||
{ .phys = SRAM_BASE,
|
||||
.virt = SRAM_BASE,
|
||||
|
||||
@@ -4,6 +4,8 @@ MODULE := $(LOCAL_DIR)
|
||||
|
||||
ARCH := arm
|
||||
ARM_CPU := cortex-a9-neon
|
||||
WITH_SMP ?= 1
|
||||
SMP_MAX_CPUS := 2
|
||||
|
||||
MODULE_DEPS := \
|
||||
lib/bio \
|
||||
@@ -13,6 +15,7 @@ MODULE_DEPS := \
|
||||
dev/interrupt/arm_gic \
|
||||
dev/timer/arm_cortex_a9
|
||||
|
||||
|
||||
GLOBAL_INCLUDES += \
|
||||
$(LOCAL_DIR)/include
|
||||
|
||||
|
||||
@@ -41,14 +41,15 @@ FUNCTION(platform_reset)
|
||||
str r11, [r12]
|
||||
dsb
|
||||
|
||||
#if !WITH_SMP
|
||||
0:
|
||||
/* stay trapped here forever */
|
||||
wfe
|
||||
b 0b
|
||||
|
||||
ldr pc, foo
|
||||
foo:
|
||||
.word 0xa
|
||||
#else
|
||||
/* pass on through the reset vector, where the arm arch code will trap the cpu */
|
||||
b arm_reset
|
||||
#endif
|
||||
|
||||
DATA(__cpu_trapped)
|
||||
.word 0
|
||||
|
||||
Reference in New Issue
Block a user