void set_up_temp_pg() { physaddr_t* redir = (physaddr_t* )RELOC((viraddr_t)temp_pg); physaddr_t* redir4m = (physaddr_t* )RELOC((viraddr_t)temp_pg4m); physaddr_t* redir1g = (physaddr_t* )RELOC((viraddr_t)temp_pg1g); uint32_t i = 0; #ifdef _PAE_ uint32_t j = (~0 - KERNEL_BASE_ADDR )/(1024 * PAGE_SIZE / 2); //mapping first 8MB memory; redir4m[0] = 0x000000 |_PAGE_RW |_PAGE_PRESENT | _PAGE_PSE; redir4m[1] = 0x200000 | _PAGE_RW | _PAGE_PRESENT | _PAGE_PSE; redir4m[2] = 0x400000 | _PAGE_RW | _PAGE_PRESENT | _PAGE_PSE; redir4m[3] = 0x600000 | _PAGE_RW | _PAGE_PRESENT | _PAGE_PSE; //mapping normal memory; for(i = 0;i <= j;i++) { redir1g[i] = (i << 21)| _PAGE_RW | _PAGE_PRESENT | _PAGE_PSE; } redir[0] = RELOC((viraddr_t)temp_pg4m) | _PAGE_PRESENT; redir[3] = RELOC((viraddr_t)temp_pg1g) | _PAGE_PRESENT; #else uint32_t j = (~0 - KERNEL_BASE_ADDR )/(1024 * PAGE_SIZE); //mapping first 4MB memory; redir[0] = _PAGE_RW | _PAGE_PRESENT | _PAGE_PSE; //mapping normal memory; for(;i <= j;i++) redir[(KERNEL_BASE_ADDR >> 22) + i] = (i << 22)|_PAGE_RW | _PAGE_PRESENT | _PAGE_PSE ; #endif/* _PAE_*/ }
void *get_early_console_base(const char *name) { if (!strcmp(name, RELOC("psc3"))) return (void *)MPC5XXX_PSC3; if (!strcmp(name, RELOC("psc6"))) return (void *)MPC5XXX_PSC6; return NULL; }
/* Set MSVDX Front end register */ void vld_dec_FE_state(object_context_p obj_context, psb_buffer_p buf) { psb_cmdbuf_p cmdbuf = obj_context->cmdbuf; context_DEC_p ctx = (context_DEC_p) obj_context->format_data; CTRL_ALLOC_HEADER *cmd_header = (CTRL_ALLOC_HEADER *)psb_cmdbuf_alloc_space(cmdbuf, sizeof(CTRL_ALLOC_HEADER)); cmd_header->ui32Cmd_AdditionalParams = CMD_CTRL_ALLOC_HEADER; cmd_header->ui32ExternStateBuffAddr = 0; if (buf) RELOC(cmd_header->ui32ExternStateBuffAddr, 0, buf); cmd_header->ui32MacroblockParamAddr = 0; /* Only EC needs to set this */ ctx->cmd_params = &cmd_header->ui32Cmd_AdditionalParams; ctx->p_slice_params = &cmd_header->ui32SliceParams; cmd_header->ui32SliceParams = 0; ctx->slice_first_pic_last = &cmd_header->uiSliceFirstMbYX_uiPicLastMbYX; *ctx->slice_first_pic_last = 0; ctx->p_range_mapping_base0 = &cmd_header->ui32AltOutputAddr[0]; ctx->p_range_mapping_base1 = &cmd_header->ui32AltOutputAddr[1]; ctx->alt_output_flags = &cmd_header->ui32AltOutputFlags; cmd_header->ui32AltOutputFlags = 0; cmd_header->ui32AltOutputAddr[0] = 0; cmd_header->ui32AltOutputAddr[1] = 0; }
// Start additional processor running bootstrap code at addr. // See Appendix B of MultiProcessor Specification. void lapic_startap(uint8_t apicid, uint32_t addr) { int i; uint16_t *wrv; // "The BSP must initialize CMOS shutdown code to 0AH // and the warm reset vector (DWORD based at 40:67) to point at // the AP startup code prior to the [universal startup algorithm]." outb(IO_RTC, 0xF); // offset 0xF is shutdown code outb(IO_RTC+1, 0x0A); wrv = (uint16_t *)RELOC(0x40<<4 | 0x67); // Warm reset vector wrv[0] = 0; wrv[1] = addr >> 4; // "Universal startup algorithm." // Send INIT (level-triggered) interrupt to reset other CPU. lapic_write(ICRHI, apicid<<ID_SHIFT); lapic_write(ICRLO, DLMODE_INIT | LEVEL | ASSERT); microdelay(200); lapic_write(ICRLO, DLMODE_INIT | LEVEL); microdelay(100); // should be 10ms, but too slow in Bochs! // Send startup IPI (twice!) to enter bootstrap code. // Regular hardware is supposed to only accept a STARTUP // when it is in the halted state due to an INIT. So the second // should be ignored, but it is part of the official Intel algorithm. // Bochs complains about the second one. Too bad for Bochs. for(i = 0; i < 2; i++){ lapic_write(ICRHI, apicid<<24); lapic_write(ICRLO, DLMODE_STARTUP | (addr>>12)); microdelay(200); } }
int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct rtc_time tm; int rcode = 0; int old_bus; /* switch to correct I2C bus */ old_bus = I2C_GET_BUS(); I2C_SET_BUS(CONFIG_SYS_RTC_BUS_NUM); switch (argc) { case 2: /* set date & time */ if (strcmp(argv[1],"reset") == 0) { puts ("Reset RTC...\n"); rtc_reset (); } else { /* initialize tm with current time */ rcode = rtc_get (&tm); if(!rcode) { /* insert new date & time */ if (mk_date (argv[1], &tm) != 0) { puts ("## Bad date format\n"); break; } /* and write to RTC */ rcode = rtc_set (&tm); if(rcode) puts("## Set date failled\n"); } else { puts("## Get date failled\n"); } } /* FALL TROUGH */ case 1: /* get date & time */ rcode = rtc_get (&tm); if (rcode) { puts("## Get date failled\n"); break; } printf ("Date: %4d-%02d-%02d (%sday) Time: %2d:%02d:%02d\n", tm.tm_year, tm.tm_mon, tm.tm_mday, (tm.tm_wday<0 || tm.tm_wday>6) ? "unknown " : RELOC(weekdays[tm.tm_wday]), tm.tm_hour, tm.tm_min, tm.tm_sec); break; default: cmd_usage(cmdtp); rcode = 1; } /* switch back to original I2C bus */ I2C_SET_BUS(old_bus); return rcode; }
long int initdram (int board_type) { ulong dramsize = 0; ulong dramsize2 = 0; ulong test1, test2; if ((ulong)RELOC(initdram) > (2 << 30)) { /* setup SDRAM chip selects */ *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001b;/* 256MB at 0x0 */ *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x10000000;/* disabled */ __asm__ volatile ("sync"); /* setup config registers */ *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1; *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2; __asm__ volatile ("sync"); #if SDRAM_DDR && SDRAM_TAPDELAY /* set tap delay */ *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY; __asm__ volatile ("sync"); #endif /* find RAM size using SDRAM CS0 only */ sdram_start(0); test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x10000000); sdram_start(1); test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x10000000); if (test1 > test2) { sdram_start(0); dramsize = test1; } else { dramsize = test2; } /* memory smaller than 1MB is impossible */ if (dramsize < (1 << 20)) { dramsize = 0; } /* set SDRAM CS0 size according to the amount of RAM found */ if (dramsize > 0) { *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 + __builtin_ffs(dramsize >> 20) - 1; } else {
/* Programme the Alt output if there is a rotation*/ void vld_dec_setup_alternative_frame(object_context_p obj_context) { uint32_t cmd = 0; psb_cmdbuf_p cmdbuf = obj_context->cmdbuf; context_DEC_p ctx = (context_DEC_p) obj_context->format_data; psb_surface_p src_surface = obj_context->current_render_target->psb_surface; psb_surface_p out_loop_surface = obj_context->current_render_target->out_loop_surface; int ved_scaling = (CONTEXT_SCALING(obj_context) && !ctx->yuv_ctx); /* In VPP ctx, current_render_target is rotated surface */ if (ctx->yuv_ctx && (VAEntrypointVideoProc == obj_context->entry_point)) { drv_debug_msg(VIDEO_DEBUG_GENERAL, "Setup second-pass rotation\n"); out_loop_surface = src_surface; src_surface = ctx->yuv_ctx->src_surface; } if (CONTEXT_ALTERNATIVE_OUTPUT(obj_context) || obj_context->entry_point == VAEntrypointVideoProc) { if (ved_scaling) { out_loop_surface = obj_context->current_render_target->scaling_surface; #ifndef BAYTRAIL tng_ved_write_scale_reg(obj_context); REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS,ALTERNATIVE_OUTPUT_PICTURE_ROTATION, SCALE_INPUT_SIZE_SEL, 1); REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS,ALTERNATIVE_OUTPUT_PICTURE_ROTATION, SCALE_ENABLE, 1); #endif } if (out_loop_surface == NULL) { drv_debug_msg(VIDEO_DEBUG_GENERAL, "out-loop surface is NULL, abort msvdx alternative output\n"); return; } if (GET_SURFACE_INFO_rotate(out_loop_surface) != obj_context->msvdx_rotate && !ved_scaling) drv_debug_msg(VIDEO_DEBUG_WARNING, "Display rotate mode does not match surface rotate mode!\n"); /* CRendecBlock RendecBlk( mCtrlAlloc , RENDEC_REGISTER_OFFSET(MSVDX_CMDS, VC1_LUMA_RANGE_MAPPING_BASE_ADDRESS) ); */ psb_cmdbuf_rendec_start(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_CMDS, VC1_LUMA_RANGE_MAPPING_BASE_ADDRESS)); psb_cmdbuf_rendec_write_address(cmdbuf, &out_loop_surface->buf, out_loop_surface->buf.buffer_ofs); psb_cmdbuf_rendec_write_address(cmdbuf, &out_loop_surface->buf, out_loop_surface->buf.buffer_ofs + out_loop_surface->chroma_offset); psb_cmdbuf_rendec_end(cmdbuf); REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1); REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, out_loop_surface->stride_mode); REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(out_loop_surface)); RELOC(*ctx->p_range_mapping_base0, out_loop_surface->buf.buffer_ofs, &out_loop_surface->buf); RELOC(*ctx->p_range_mapping_base1, out_loop_surface->buf.buffer_ofs + out_loop_surface->chroma_offset, &out_loop_surface->buf); } if (obj_context->profile == VAProfileVP8Version0_3 || obj_context->profile == VAProfileJPEGBaseline || ctx->yuv_ctx) { psb_cmdbuf_rendec_start(cmdbuf, (REG_MSVDX_CMD_OFFSET + MSVDX_CMDS_AUX_LINE_BUFFER_BASE_ADDRESS_OFFSET)); psb_cmdbuf_rendec_write_address(cmdbuf, &ctx->aux_line_buffer_vld, ctx->aux_line_buffer_vld.buffer_ofs); psb_cmdbuf_rendec_end(cmdbuf); REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION, USE_AUX_LINE_BUF, 1); if (ctx->yuv_ctx) REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 1); } /* Set the rotation registers */ psb_cmdbuf_rendec_start(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION)); psb_cmdbuf_rendec_write(cmdbuf, cmd); *ctx->alt_output_flags = cmd; cmd = 0; REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, EXTENDED_ROW_STRIDE, EXT_ROW_STRIDE, src_surface->stride / 64); psb_cmdbuf_rendec_write(cmdbuf, cmd); psb_cmdbuf_rendec_end(cmdbuf); }
void relocate_refs (reloc_t *reloc, int offset) { int o; while (reloc) { debug (0, "reloc %s:%x %s %x", reloc->space ? (reloc->space == pr.near_data ? "near" : "far") : "code", reloc->offset, reloc_name[reloc->type], offset); switch (reloc->type) { case rel_none: break; case rel_op_a_def: if (offset > 65535) error (0, "def offset too large"); else pr.code->code[reloc->offset].a = offset; break; case rel_op_b_def: if (offset > 65535) error (0, "def offset too large"); else pr.code->code[reloc->offset].b = offset; break; case rel_op_c_def: if (offset > 65535) error (0, "def offset too large"); else pr.code->code[reloc->offset].c = offset; break; case rel_op_a_op: o = offset - reloc->offset; if (o < -32768 || o > 32767) error (0, "relative offset too large"); else pr.code->code[reloc->offset].a = o; break; case rel_op_b_op: o = offset - reloc->offset; if (o < -32768 || o > 32767) error (0, "relative offset too large"); else pr.code->code[reloc->offset].b = o; break; case rel_op_c_op: o = offset - reloc->offset; if (o < -32768 || o > 32767) error (0, "relative offset too large"); else pr.code->code[reloc->offset].c = o; break; case rel_def_op: if (offset > pr.code->size) { error (0, "invalid statement offset: %d >= %d, %d", offset, pr.code->size, reloc->offset); } else RELOC (reloc) = offset; break; case rel_def_def: case rel_def_func: RELOC (reloc) = offset; break; case rel_def_string: break; case rel_def_field: break; case rel_op_a_def_ofs: o = offset + pr.code->code[reloc->offset].a; if (o < 0 || o > 65535) error (0, "def offset out of range"); else pr.code->code[reloc->offset].a = o; break; case rel_op_b_def_ofs: o = offset + pr.code->code[reloc->offset].b; if (o < 0 || o > 65535) error (0, "def offset out of range"); else pr.code->code[reloc->offset].b = o; break; case rel_op_c_def_ofs: o = offset + pr.code->code[reloc->offset].c; if (o < 0 || o > 65535) error (0, "def offset out of range"); else pr.code->code[reloc->offset].c = o; break; case rel_def_def_ofs: RELOC (reloc) += offset; break; case rel_def_field_ofs: //FIXME what is correct here? //RELOC (reloc) += pr.data->data[offset].integer_var; RELOC (reloc) += pr.near_data->data[offset].integer_var; break; } reloc = reloc->next; } }
static void display_banner (void) { printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string)); printf(RELOC("Board: " CONFIG_BOARDINFO "\n")); }
static int do_date(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct rtc_time tm; int rcode = 0; int old_bus __maybe_unused; /* switch to correct I2C bus */ #ifdef CONFIG_DM_RTC struct udevice *dev; rcode = uclass_get_device(UCLASS_RTC, 0, &dev); if (rcode) { printf("Cannot find RTC: err=%d\n", rcode); return CMD_RET_FAILURE; } #elif defined(CONFIG_SYS_I2C) old_bus = i2c_get_bus_num(); i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM); #else old_bus = I2C_GET_BUS(); I2C_SET_BUS(CONFIG_SYS_RTC_BUS_NUM); #endif switch (argc) { case 2: /* set date & time */ if (strcmp(argv[1],"reset") == 0) { puts ("Reset RTC...\n"); #ifdef CONFIG_DM_RTC rcode = dm_rtc_reset(dev); if (!rcode) rcode = dm_rtc_set(dev, &default_tm); #else rtc_reset(); rcode = rtc_set(&default_tm); #endif if (rcode) puts("## Failed to set date after RTC reset\n"); } else { /* initialize tm with current time */ #ifdef CONFIG_DM_RTC rcode = dm_rtc_get(dev, &tm); #else rcode = rtc_get(&tm); #endif if (!rcode) { /* insert new date & time */ if (mk_date(argv[1], &tm) != 0) { puts ("## Bad date format\n"); break; } /* and write to RTC */ #ifdef CONFIG_DM_RTC rcode = dm_rtc_set(dev, &tm); #else rcode = rtc_set(&tm); #endif if (rcode) { printf("## Set date failed: err=%d\n", rcode); } } else { puts("## Get date failed\n"); } } /* FALL TROUGH */ case 1: /* get date & time */ #ifdef CONFIG_DM_RTC rcode = dm_rtc_get(dev, &tm); #else rcode = rtc_get(&tm); #endif if (rcode) { puts("## Get date failed\n"); break; } printf ("Date: %4d-%02d-%02d (%sday) Time: %2d:%02d:%02d\n", tm.tm_year, tm.tm_mon, tm.tm_mday, (tm.tm_wday<0 || tm.tm_wday>6) ? "unknown " : RELOC(weekdays[tm.tm_wday]), tm.tm_hour, tm.tm_min, tm.tm_sec); break; default: rcode = CMD_RET_USAGE; } /* switch back to original I2C bus */ #ifdef CONFIG_SYS_I2C i2c_set_bus_num(old_bus); #elif !defined(CONFIG_DM_RTC) I2C_SET_BUS(old_bus); #endif return rcode ? CMD_RET_FAILURE : 0; }