ppc64-diag
Data Structures | Macros | Functions | Variables
prrn.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <time.h>
#include <librtas.h>
#include "rtas_errd.h"

Data Structures

struct  pmap_struct
 
struct  drconf_cell
 

Macros

#define OFDT_BASE   "/proc/device-tree"
 
#define OFDTPATH   "/proc/ppc64/ofdt"
 
#define DRCONF_PATH   "/proc/device-tree/ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory"
 

Functions

static int write_prrn_log (const char *buf, int len)
 
static void open_prrn_log (void)
 
static void close_prrn_log (void)
 
uint32_t get_drc_index (const char *path)
 
static void add_phandle_to_list (char *name, uint32_t phandle, uint32_t drc_index)
 
static struct pmap_structphandle_to_pms (uint32_t phandle)
 
static int add_std_phandles (char *parent, char *p)
 
static int add_drconf_phandles ()
 
static void free_phandles ()
 
static int add_phandles ()
 
static int do_update (char *cmd, int len)
 
static int update_properties (uint32_t phandle)
 
static void do_node_update (struct pmap_struct *pms, const char *type)
 
static void update_nodes (unsigned int *op, unsigned int n)
 
static void devtree_update (uint scope)
 
void handle_prrn_event (struct event *re)
 

Variables

static struct pmap_structplist
 
static int prrn_log_fd
 
static char prrn_filename [128]
 

Detailed Description

Copyright (C) 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

◆ DRCONF_PATH

#define DRCONF_PATH   "/proc/device-tree/ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory"

Referenced by add_drconf_phandles().

◆ OFDT_BASE

#define OFDT_BASE   "/proc/device-tree"

Referenced by add_phandles(), and add_std_phandles().

◆ OFDTPATH

#define OFDTPATH   "/proc/ppc64/ofdt"

Referenced by do_update().

Function Documentation

◆ add_drconf_phandles()

static int add_drconf_phandles ( )
static

add_drconf_phandles

Returns

References add_phandle_to_list(), drconf_cell::drc_index, and DRCONF_PATH.

Referenced by add_phandles().

◆ add_phandle_to_list()

static void add_phandle_to_list ( char *  name,
uint32_t  phandle,
uint32_t  drc_index 
)
static

add_phandle_to_list

Parameters
name
phandle

References pmap_struct::drc_index, pmap_struct::name, pmap_struct::next, pmap_struct::phandle, and plist.

Referenced by add_drconf_phandles(), and add_std_phandles().

◆ add_phandles()

static int add_phandles ( )
static

add_phandles

Returns

References add_drconf_phandles(), add_std_phandles(), free_phandles(), and OFDT_BASE.

Referenced by devtree_update().

◆ add_std_phandles()

static int add_std_phandles ( char *  parent,
char *  p 
)
static

add_std_phandles

Parameters
parent
p
Returns

References add_phandle_to_list(), dbg, pmap_struct::drc_index, get_drc_index(), OFDT_BASE, and pmap_struct::phandle.

Referenced by add_phandles().

◆ close_prrn_log()

static void close_prrn_log ( void  )
static

References prrn_log_fd.

Referenced by handle_prrn_event().

◆ devtree_update()

static void devtree_update ( uint  scope)
static

devtree_update

References add_phandles(), dbg, free_phandles(), and update_nodes().

Referenced by handle_prrn_event().

◆ do_node_update()

static void do_node_update ( struct pmap_struct pms,
const char *  type 
)
static

do_node_update

Not all nodes can be updated via a DLPAR operation, only those with a valid drc-index. For nodes without a drc-index we just update the prrn log file indicating that the node was updated in te device tree but that we cannot do a DLPAR operation.

Parameters
type
pms

References dbg, pmap_struct::drc_index, pmap_struct::name, pmap_struct::phandle, update_properties(), and write_prrn_log().

Referenced by update_nodes().

◆ do_update()

static int do_update ( char *  cmd,
int  len 
)
static

do_update

Parameters
cmd
len
Returns
0 on success, !0 otherwise

References dbg, and OFDTPATH.

Referenced by update_properties().

◆ free_phandles()

static void free_phandles ( )
static

free_phandles

References pmap_struct::name, pmap_struct::next, and plist.

Referenced by add_phandles(), and devtree_update().

◆ get_drc_index()

uint32_t get_drc_index ( const char *  path)

References pmap_struct::drc_index.

Referenced by add_std_phandles().

◆ handle_prrn_event()

void handle_prrn_event ( struct event re)

◆ open_prrn_log()

static void open_prrn_log ( void  )
static

References dbg, prrn_filename, and prrn_log_fd.

Referenced by handle_prrn_event().

◆ phandle_to_pms()

static struct pmap_struct* phandle_to_pms ( uint32_t  phandle)
static

phandle_to_name

Parameters
ph
Returns

References pmap_struct::next, pmap_struct::phandle, and plist.

Referenced by update_nodes(), and update_properties().

◆ update_nodes()

static void update_nodes ( unsigned int *  op,
unsigned int  n 
)
static

◆ update_properties()

static int update_properties ( uint32_t  phandle)
static

update_properties

Parameters
phandle
Returns
0 on success, !0 otherwise

References dbg, do_update(), pmap_struct::name, and phandle_to_pms().

Referenced by do_node_update().

◆ write_prrn_log()

static int write_prrn_log ( const char *  buf,
int  len 
)
static

References prrn_log_fd.

Referenced by do_node_update(), and update_nodes().

Variable Documentation

◆ plist

struct pmap_struct* plist
static

◆ prrn_filename

char prrn_filename[128]
static

Referenced by handle_prrn_event(), and open_prrn_log().

◆ prrn_log_fd

int prrn_log_fd
static