Exemple #1
0
int enter_c2(unsigned int cpu, int index, int *sub_state)
{
	exynos_cpu.power_down(cpu);

	spin_lock(&c2_lock);
	update_c2_state(true, cpu);

	/*
	 * This function determines whether to power down the cluster/enter LPC
	 * or not. If idle time is not enough, skip this routine.
	 */
	if (get_next_event_time_us(cpu) < min(cpd_residency, lpc_residency))
		goto out;

	/*
	 * If LPC is available, write flag to internal RAM. By this, know whether
	 * AP put into LPC or not in EL3 PSCI handler.
	 */
	if (
#ifdef CONFIG_SOC_EXYNOS7420
		get_cluster_id(cpu) &&
#endif
		is_lpc_available(lpc_residency)) {
		exynos_ss_cpuidle(EXYNOS_SS_LPC_INDEX, 0, 0, ESS_FLAG_IN);
#ifdef CONFIG_SOC_EXYNOS7420
		write_lpc_flag(ENTER_LPC);
		*sub_state |= LPC_STATE;
#endif
		s3c24xx_serial_fifo_wait();
	}

	/*
	 * Power down of LITTLE cluster have nothing to gain power consumption,
	 * so does not support. For you reference, cluster id "1" indicates LITTLE.
	 */
	if (get_cluster_id(cpu))
		goto out;

	/* If cluster is not busy, enable cpu sequcner to shutdown cluster */
	if (!is_cpus_busy(cpd_residency, cpu_coregroup_mask(cpu))) {
		exynos_cpu_sequencer_ctrl(true);
		*sub_state |= CPD_STATE;
		index++;
	}

out:
	spin_unlock(&c2_lock);

	return index;
}
Exemple #2
0
void read() {
  int cluster_id = 0;
  int new_cluster_id = 0;
  int argument_pointer = 0;
  int prev_pointer = 0;
  int empty_index = 0;
  int entry_id = 0;
  int file_size = 0;

  while (argument[argument_pointer] != 0) {
    prev_pointer = argument_pointer;
    argument_pointer += basename(argument + argument_pointer, filename);
    argument_pointer += 1;  // skip "/"
  }

  prev_pointer -= 1;
  while (prev_pointer < argument_pointer) {
    argument[prev_pointer] = 0;
    prev_pointer += 1;
  }

  if (resolve_argument_path(argument[ARGUMENT_HEAP_SIZE-1], argument, resolve_result) == -1) {
    copy_string(argument, file_not_found_error_message);
    return;
  }
  directory_id = resolve_result[2];

  entry_id = find_entry_by_name(directory_id, filename);

  if (entry_id == ENTRY_NOT_FOUND_ID) {
    buffer[0] = EOF;
    file_id = 0;
  } else {
    file_id = get_cluster_id(directory_id, entry_id);
    file_size = get_file_size(directory_id, entry_id);
    read_file(file_id, file_size, file_content);

    {
      int line = 0;
      int column = 0;
      int ptr = 0;
      int got_newline = 0;

      initialize_array(buffer, 2400, 0);

      while (ptr < file_size) {
        buffer[C(line, column)] = file_content[ptr];
        if (file_content[ptr] == '\n') {
          line += 1;
          column = 0;
        } else {
          column += 1;
        }
        ptr += 1;
      }

      buffer[C(line, column)] = EOF;
    }
  }
}
Exemple #3
0
void wakeup_from_c2(unsigned int cpu)
{
	exynos_cpu.power_up(cpu);

	update_c2_state(false, cpu);

	if (!get_cluster_id(cpu))
		exynos_cpu_sequencer_ctrl(false);
}
Exemple #4
0
void get_bin_cluster_id() {
  int root_entry = 0;
  int entry_id = find_entry_by_name(root_entry, bin_token);
  if (entry_id == ENTRY_NOT_FOUND_ID) {
    put_char('n');
    put_char('o');
    put_char(' ');
    put_char('b');
    put_char('i');
    put_char('n');
    return;
  }
  bin_cluster_id = get_cluster_id(root_entry, entry_id);
}
Exemple #5
0
void execute_bin(char * program, char * argument) {
  int entry_id     = find_entry_by_name(bin_cluster_id, program);
  int cluster_id   = get_cluster_id(bin_cluster_id, entry_id);
  int program_size = get_file_size(bin_cluster_id, entry_id);

  if (entry_id == ENTRY_NOT_FOUND_ID) {
    put_char('n');
    put_char('o');
    put_char(' ');
    put_char('s');
    put_char('u');
    put_char('c');
    put_char('h');
    put_char(' ');
    put_char('b');
    put_char('i');
    put_char('n');
    return;
  }

  read_file(cluster_id, program_size, file_content);
  execute(file_content, program_size, argument);
  print_return_argument(argument);
}