ppc64-diag
Data Structures | Macros | Functions | Variables
convert_dt_node_props.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdint.h>
#include <dirent.h>
#include <fcntl.h>
#include "platform.h"

Data Structures

struct  drc_info_search_config
 

Macros

#define MAX_IRQ_SERVERS_PER_CPU   16
 
#define DRC_TYPE_LEN   16
 
#define DRC_NAME_LEN   256 /* Worst case length to expect */
 

Functions

static int search_drcindex_to_drcname (struct drc_info_search_config *, uint32_t, char *, int)
 
static int search_drcname_to_drcindex (struct drc_info_search_config *, char *, uint32_t *)
 
static int mem_drcindex_to_drcname (uint32_t drc_idx, char *drc_name, int buf_size)
 converts drcindex of mem type to drcname More...
 
int cpu_interruptserver_to_drcindex (uint32_t, uint32_t *)
 
int cpu_drcindex_to_drcname (uint32_t drc_idx, char *drc_name, int buf_size)
 converts drcindex of cpu type to drcname More...
 
int cpu_drcindex_to_interruptserver (uint32_t, uint32_t *, int)
 
int cpu_drcname_to_drcindex (char *drc_name, uint32_t *drc_idx)
 converts mem type drcname to drcindex More...
 
static void print_usage (char *command)
 
static int read_char_name (int fd, char *propname, int buf_size)
 
static int read_uint32 (int fd, uint32_t *retval)
 
static int search_drcindex_to_drcname_v1 (struct drc_info_search_config *sr, uint32_t drc_idx, char *drc_name, int buf_size)
 
static int search_drcname_to_drcindex_v1 (struct drc_info_search_config *sr, char *drc_name, uint32_t *drc_idx)
 
int main (int argc, char *argv[])
 

Variables

static struct option long_options []
 
static struct drc_info_search_config mem_to_name
 
static struct drc_info_search_config cpu_to_name
 

Detailed Description

Copyright (C) 2005 - 2016 IBM Corporation

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Macro Definition Documentation

◆ DRC_NAME_LEN

#define DRC_NAME_LEN   256 /* Worst case length to expect */

◆ DRC_TYPE_LEN

#define DRC_TYPE_LEN   16

◆ MAX_IRQ_SERVERS_PER_CPU

#define MAX_IRQ_SERVERS_PER_CPU   16

Referenced by main().

Function Documentation

◆ cpu_drcindex_to_drcname()

int cpu_drcindex_to_drcname ( uint32_t  drc_idx,
char *  drc_name,
int  buf_size 
)

cpu_drcindex_to_drcname

Parameters
drc_idx- drc index whose drc name is to be found.
drc_name- buffer for drc_name
buf_size- size of buffer.

References search_drcindex_to_drcname().

Referenced by main().

◆ cpu_drcindex_to_interruptserver()

int cpu_drcindex_to_interruptserver ( uint32_t  drc_idx,
uint32_t *  int_servs,
int  array_elements 
)

References read_uint32().

Referenced by main().

◆ cpu_drcname_to_drcindex()

int cpu_drcname_to_drcindex ( char *  drc_name,
uint32_t *  drc_idx 
)

cpu_drcname_to_drcindex

Parameters
drc_idx- drc index whose drc name is to be found.
drc_name- buffer for drc_name

References search_drcname_to_drcindex().

Referenced by main().

◆ cpu_interruptserver_to_drcindex()

int cpu_interruptserver_to_drcindex ( uint32_t  int_serv,
uint32_t *  drc_idx 
)

References read_uint32().

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ mem_drcindex_to_drcname()

static int mem_drcindex_to_drcname ( uint32_t  drc_idx,
char *  drc_name,
int  buf_size 
)
static

mem_drcindex_to_drcname

Parameters
drc_idx- drc index whose drc name is to be found.
drc_name- buffer for drc_name
buf_size- size of buffer.

References search_drcindex_to_drcname().

Referenced by main().

◆ print_usage()

static void print_usage ( char *  command)
static

Referenced by main().

◆ read_char_name()

static int read_char_name ( int  fd,
char *  propname,
int  buf_size 
)
static

◆ read_uint32()

static int read_uint32 ( int  fd,
uint32_t *  retval 
)
static

◆ search_drcindex_to_drcname()

static int search_drcindex_to_drcname ( struct drc_info_search_config sr,
uint32_t  drc_idx,
char *  drc_name,
int  buf_size 
)
static

◆ search_drcindex_to_drcname_v1()

static int search_drcindex_to_drcname_v1 ( struct drc_info_search_config sr,
uint32_t  drc_idx,
char *  drc_name,
int  buf_size 
)
static

◆ search_drcname_to_drcindex()

static int search_drcname_to_drcindex ( struct drc_info_search_config sr,
char *  drc_name,
uint32_t *  drc_idx 
)
static

◆ search_drcname_to_drcindex_v1()

static int search_drcname_to_drcindex_v1 ( struct drc_info_search_config sr,
char *  drc_name,
uint32_t *  drc_idx 
)
static

Variable Documentation

◆ cpu_to_name

struct drc_info_search_config cpu_to_name
static
Initial value:
= {
"CPU",
"/proc/device-tree/cpus/ibm,drc-indexes",
"/proc/device-tree/cpus/ibm,drc-names",
"/proc/device-tree/cpus/ibm,drc-info",
}

◆ long_options

struct option long_options[]
static
Initial value:
= {
{"context", required_argument, NULL, 'c'},
{"from", required_argument, NULL, 'f'},
{"to", required_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
{0,0,0,0}
}

Referenced by main().

◆ mem_to_name

struct drc_info_search_config mem_to_name
static
Initial value:
= {
"MEM",
"/proc/device-tree/ibm,drc-indexes",
"/proc/device-tree/ibm,drc-names",
"/proc/device-tree/ibm,drc-info",
}