2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _SYS_LIBPRTDIAG_H
2N/A#define _SYS_LIBPRTDIAG_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/openpromio.h>
2N/A#include <sys/cheetahregs.h>
2N/A#include "pdevinfo.h"
2N/A#include "display.h"
2N/A#include "pdevinfo_sun4u.h"
2N/A#include "display_sun4u.h"
2N/A
2N/A#ifdef DEBUG
2N/A#define D_PRINTF printf
2N/A#else
2N/A#define D_PRINTF
2N/A#endif
2N/A
2N/A#define EXIT_MSG(msg, err) \
2N/A { printf("\n%s failed with %d\n", msg, err); exit(err); }
2N/A
2N/A/* global data */
2N/A#define PCI_DEVICE(x) ((x >> 11) & 0x1f)
2N/A#define PCI_REG_TO_DEV(x) ((x & 0xf800) >> 11)
2N/A#define PCI_REG_TO_FUNC(x) ((x & 0x700) >> 8)
2N/A#define BUS_TYPE "UPA"
2N/A#define MAX_SLOTS_PER_IO_BD 8
2N/A
2N/A
2N/Aint sys_clk; /* System clock freq. (in MHz) */
2N/A
2N/A/*
2N/A * Defines for identifying PCI devices
2N/A */
2N/A#define PCI_BRIDGE_CLASS 0x6
2N/A#define PCI_CLASS_SHIFT 0x10
2N/A#define PCI_PCI_BRIDGE_SUBCLASS 0x4
2N/A#define PCI_SUBCLASS_SHIFT 0x8
2N/A#define PCI_SUBCLASS_MASK 0xFF00
2N/A#define PCI_SUBCLASS_OTHER 0x80
2N/A
2N/A#define CLASS_REG_TO_SUBCLASS(class) (((class) & PCI_SUBCLASS_MASK) \
2N/A >> PCI_SUBCLASS_SHIFT)
2N/A#define CLASS_REG_TO_CLASS(class) ((class) >> PCI_CLASS_SHIFT)
2N/A
2N/A/*
2N/A * display functions
2N/A */
2N/Aint error_check(Sys_tree *tree, struct system_kstat_data *kstats);
2N/Aint disp_fail_parts(Sys_tree *tree);
2N/Avoid display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats);
2N/Avoid display_diaginfo(int flag, Prom_node *root, Sys_tree *tree,
2N/A struct system_kstat_data *kstats);
2N/Avoid resolve_board_types(Sys_tree *);
2N/Avoid display_boardnum(int num);
2N/Avoid display_platform_specific_header(void);
2N/A
2N/A/*
2N/A * cpu functions
2N/A */
2N/Avoid display_cpu_devices(Sys_tree *);
2N/Avoid display_cpus(Board_node *);
2N/Avoid display_mid(int mid);
2N/Auint_t get_cpu_freq(Prom_node *);
2N/Aint get_ecache_size(Prom_node *);
2N/A
2N/A/*
2N/A * io functions
2N/A */
2N/AProm_node *find_pci_bus(Prom_node *, int, int);
2N/Aint get_pci_bus(Prom_node *);
2N/Aint get_pci_device(Prom_node *);
2N/Aint get_pci_to_pci_device(Prom_node *);
2N/Avoid free_io_cards(struct io_card *);
2N/Astruct io_card *insert_io_card(struct io_card *, struct io_card *);
2N/Achar *fmt_manf_id(unsigned int, char *);
2N/Aint get_sbus_slot(Prom_node *);
2N/Avoid display_io_devices(Sys_tree *tree);
2N/Avoid display_pci(Board_node *bnode);
2N/Avoid display_io_cards(struct io_card *);
2N/Avoid display_ffb(Board_node *, int);
2N/Avoid display_sbus(Board_node *);
2N/Aint populate_slot_name_arr(Prom_node *pci, int *slot_name_bits,
2N/A char **slot_name_arr, int num_slots);
2N/Aint get_card_frequency(Prom_node *pci);
2N/Avoid get_dev_func_num(Prom_node *card_node, int *dev_no, int *func_no);
2N/Avoid get_pci_class_codes(Prom_node *card_node, int *class_code,
2N/A int *subclass_code);
2N/Aint is_pci_bridge(Prom_node *card_node, char *name);
2N/Aint is_pci_bridge_other(Prom_node *card_node, char *name);
2N/Avoid get_pci_card_model(Prom_node *card_node, char *model);
2N/Avoid create_io_card_name(Prom_node *card_node, char *name,
2N/A char *card_name);
2N/Avoid display_psycho_pci(Board_node *bnode);
2N/Avoid get_slot_number_str(struct io_card *card, char **slot_name_arr,
2N/A int slot_name_bits);
2N/Avoid distinguish_identical_io_cards(char *name, Prom_node *node,
2N/A struct io_card *card);
2N/Avoid decode_qlc_card_model_prop(Prom_node *card_node, struct io_card *card);
2N/A
2N/A/*
2N/A * kstat functions
2N/A */
2N/Avoid read_platform_kstats(Sys_tree *tree,
2N/A struct system_kstat_data *sys_kstat,
2N/A struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep);
2N/Avoid read_sun4u_kstats(Sys_tree *, struct system_kstat_data *);
2N/A
2N/A/*
2N/A * memory functions
2N/A */
2N/Avoid display_memorysize(Sys_tree *tree, struct system_kstat_data *kstats,
2N/A struct grp_info *grps, struct mem_total *memory_total);
2N/Avoid display_memoryconf(Sys_tree *tree, struct grp_info *grps);
2N/A
2N/A/*
2N/A * prom functions
2N/A */
2N/Avoid platform_disp_prom_version(Sys_tree *);
2N/Avoid disp_prom_version(Prom_node *);
2N/Avoid add_node(Sys_tree *, Prom_node *);
2N/AProm_node *find_device(Board_node *, int, char *);
2N/AProm_node *walk(Sys_tree *, Prom_node *, int);
2N/Aint get_pci_class_code_reg(Prom_node *);
2N/A
2N/A/*
2N/A * libdevinfo functions
2N/A */
2N/Aint do_devinfo(int, char *, int, int);
2N/A
2N/A/*
2N/A * mc-us3 memory functions and structs
2N/A */
2N/Atypedef struct memory_bank {
2N/A int id;
2N/A int portid;
2N/A ushort_t valid;
2N/A ushort_t uk;
2N/A uint_t um;
2N/A uchar_t lk;
2N/A uchar_t lm;
2N/A uint64_t bank_size;
2N/A char *bank_status;
2N/A struct memory_bank *next; /* mc in the devtree */
2N/A struct memory_bank *seg_next; /* in the segment */
2N/A} memory_bank_t;
2N/A
2N/Atypedef struct memory_seg {
2N/A int id;
2N/A int intlv; /* interleave for this segment */
2N/A uint64_t base; /* base address for this segment */
2N/A uint64_t size; /* size of this segment */
2N/A int nbanks; /* number of banks in this segment */
2N/A memory_bank_t *banks; /* pointer to the banks of this seg */
2N/A struct memory_seg *next;
2N/A} memory_seg_t;
2N/A
2N/A#define NUM_MBANKS_PER_MC 4
2N/A
2N/Aint get_us3_mem_regs(Board_node *bnode);
2N/Avoid display_us3_banks(void);
2N/Aint display_us3_failed_banks(int system_failed);
2N/Avoid print_us3_memory_line(int portid, int bank_id, uint64_t bank_size,
2N/A char *bank_status, uint64_t dimm_size, uint32_t intlv, int seg_id);
2N/Avoid print_us3_failed_memory_line(int portid, int bank_id,
2N/A char *bank_status);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _SYS_LIBPRTDIAG_H */