|
Packit |
961e70 |
/*
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
This file is provided under a dual BSD/GPLv2 license. When using or
|
|
Packit |
961e70 |
redistributing this file, you may do so under either license.
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
GPL LICENSE SUMMARY
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
Copyright(c) 2015 Intel Corporation.
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
This program is free software; you can redistribute it and/or modify
|
|
Packit |
961e70 |
it under the terms of version 2 of the GNU General Public License as
|
|
Packit |
961e70 |
published by the Free Software Foundation.
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
This program is distributed in the hope that it will be useful, but
|
|
Packit |
961e70 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
961e70 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
961e70 |
General Public License for more details.
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
Contact Information:
|
|
Packit |
961e70 |
Intel Corporation, www.intel.com
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
BSD LICENSE
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
Copyright(c) 2015 Intel Corporation.
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
Redistribution and use in source and binary forms, with or without
|
|
Packit |
961e70 |
modification, are permitted provided that the following conditions
|
|
Packit |
961e70 |
are met:
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
* Redistributions of source code must retain the above copyright
|
|
Packit |
961e70 |
notice, this list of conditions and the following disclaimer.
|
|
Packit |
961e70 |
* Redistributions in binary form must reproduce the above copyright
|
|
Packit |
961e70 |
notice, this list of conditions and the following disclaimer in
|
|
Packit |
961e70 |
the documentation and/or other materials provided with the
|
|
Packit |
961e70 |
distribution.
|
|
Packit |
961e70 |
* Neither the name of Intel Corporation nor the names of its
|
|
Packit |
961e70 |
contributors may be used to endorse or promote products derived
|
|
Packit |
961e70 |
from this software without specific prior written permission.
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit |
961e70 |
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit |
961e70 |
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit |
961e70 |
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit |
961e70 |
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit |
961e70 |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit |
961e70 |
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit |
961e70 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit |
961e70 |
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
961e70 |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
961e70 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
*/
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
#ifndef OPA_SERVICE_H
|
|
Packit |
961e70 |
#define OPA_SERVICE_H
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
/* This file contains all the lowest level routines calling into sysfs */
|
|
Packit |
961e70 |
/* and qib driver. All other calls are based on these routines. */
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
#include <libgen.h>
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
#include "opa_intf.h"
|
|
Packit |
961e70 |
#include "opa_udebug.h"
|
|
Packit |
961e70 |
#include "opa_byteorder.h"
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
/* upper and lower bounds for HFI port numbers */
|
|
Packit |
961e70 |
#define HFI_MIN_PORT 1
|
|
Packit |
961e70 |
#define HFI_MAX_PORT 1
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
/* any unit id to match. */
|
|
Packit |
961e70 |
#define HFI_UNIT_ID_ANY ((long)-1)
|
|
Packit |
961e70 |
/* any port num to match. */
|
|
Packit |
961e70 |
#define HFI_PORT_NUM_ANY ((long)0)
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
/* Statistics maintained by the driver */
|
|
Packit |
961e70 |
int hfi_get_stats(uint64_t *, int);
|
|
Packit |
961e70 |
int hfi_get_stats_names(char **namep);
|
|
Packit |
961e70 |
/* Counters maintained in the chip, globally, and per-prot */
|
|
Packit |
961e70 |
int hfi_get_ctrs_unit(int unitno, uint64_t *, int);
|
|
Packit |
961e70 |
int hfi_get_ctrs_unit_names(int unitno, char **namep);
|
|
Packit |
961e70 |
int hfi_get_ctrs_port(int unitno, int port, uint64_t *, int);
|
|
Packit |
961e70 |
int hfi_get_ctrs_port_names(int unitno, char **namep);
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
/* sysfs helper routines (only those currently used are exported;
|
|
Packit |
961e70 |
* try to avoid using others) */
|
|
Packit |
961e70 |
|
|
Packit Service |
7ed5cc |
/* Initializes the following sysfs helper routines.
|
|
Packit Service |
7ed5cc |
sysfs_init() returns 0 on success, non-zero on an error: */
|
|
Packit Service |
7ed5cc |
int sysfs_init(const char *dflt_hfi_class_path);
|
|
Packit Service |
7ed5cc |
/* Complementary */
|
|
Packit Service |
7ed5cc |
void sysfs_fini(void);
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
/* read a string value into buff, no more than size bytes.
|
|
Packit |
961e70 |
returns the number of bytes read */
|
|
Packit |
961e70 |
size_t hfi_sysfs_unit_port_read(uint32_t unit, uint32_t port, const char *attr,
|
|
Packit |
961e70 |
char *buff, size_t size);
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
/* read up to one page of malloc'ed data (caller must free), returning
|
|
Packit |
961e70 |
number of bytes read or -1 */
|
|
Packit |
961e70 |
int hfi_hfifs_read(const char *attr, char **datap);
|
|
Packit |
961e70 |
int hfi_hfifs_unit_read(uint32_t unit, const char *attr, char **data);
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
int64_t hfi_sysfs_unit_read_node_s64(uint32_t unit);
|
|
Packit |
961e70 |
/* these read directly into supplied buffer and take a count */
|
|
Packit |
961e70 |
int hfi_hfifs_rd(const char *, void *, int);
|
|
Packit |
961e70 |
int hfi_hfifs_unit_rd(uint32_t unit, const char *, void *, int);
|
|
Packit |
961e70 |
|
|
Packit |
961e70 |
#endif /* OPA_SERVICE_H */
|