-
Notifications
You must be signed in to change notification settings - Fork 7
/
pnp_utils_inc.h
69 lines (56 loc) · 2.5 KB
/
pnp_utils_inc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* peeknpoke header file
*
* Copyright (c) 2012, Intel Corporation.
* Hari Kanigeri <[email protected]>
* Asutosh Pathak <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PNP_UTILS_INC_H_
#define PNP_UTILS_INC_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <ctype.h>
#define VERSION_INFO 1.1
#define SMBUS_BYTE_DATA 2
#define SMBUS_WORD_DATA 3
#define SMBUS_BLOCK_DATA 5
#define I2C_SMBUS_BLOCK_DATA 8
int read_i2c_device(char bus, int addr, int reg, int size, int *result);
int write_i2c_device(char bus, int addr, int reg, int size, int value);
int block_write_i2c_device(char bus, int addr, int reg, int size, uint8_t array_size, uint8_t *values);
int block_read_i2c_device(char bus, int addr, int reg, int size, uint8_t array_size, uint8_t *result);
int msic_program (void);
void msic_read(unsigned short target);
void msic_write(unsigned short target, unsigned short value);
int hexstring_to_int(const char* hexString, unsigned int* result);
int hexstring_to_long(const char* hexString, uint64_t* result);
int addr_range_dump(unsigned int target, unsigned int numOfWords);
int reg_write(unsigned int target, unsigned int dataBitSize, unsigned int value);
int reg_read(unsigned int target, unsigned int dataBitSize);
uint64_t msr_reg_read(int cpu, unsigned int reg_offset, int print_enabled);
int msr_reg_write(int cpu, unsigned int reg_offset, uint64_t value);
int read_nc_port(int v, int port, int *ret_val);
int write_nc_port(int v, int port, int value);
int read_port(int port, int *port_value);
int write_port(int port, int port_value);
int write_pci_reg(int bus, int dev, int func, int reg, int port_value);
int read_pci_reg(int bus, int dev, int func, int reg, int *port_value);
int read_pci_dump(int bus, int dev, int func);
#endif /* PNP_UTILS_INC_H_ */