/* * netip_subsystem_pm.h * * GPL LICENSE SUMMARY * * Copyright(c) 2015-2016 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * 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 St - Fifth Floor, Boston, MA 02110-1301 USA. * The full GNU General Public License is included in this distribution * in the file called LICENSE.GPL. * * Contact Information: * Intel Corporation * 2200 Mission College Blvd. * Santa Clara, CA 97052 * */ #ifndef _NETIP_SUBSYSTEM_PM_H #define _NETIP_SUBSYSTEM_PM_H /**Defines that indicates the type of message received * message handling while loop thread uses these values */ #define NETIP_MSG_NONE 0 #define NETIP_PROPERTIES_MSG 1 #define NETIP_STATUS_MSG 2 #define NETIP_STATUS_REQUEST_REPLY 3 #define MAX_BOARD_INTERFACES 4 /**Bit position 3 in sysfs service level vector that indicates whether we are on Battery or not */ #define NETSS_BIT_MASK_ON_BATTERY (8) /**Bit mask to extract power level of netip or service. two bits */ #define NETSS_BIT_MASK_POWER_LEVEL (3) /**NetIP subsystem message tag used for properties, configure and status messages */ #define NETSS_MSG_TAG_PROPS_CNFGR_STAT (0) /**NetIP subsystem message tag used for service request and service request reply */ #define NETSS_MSG_TAG_SERVICE_REQ_RPLY (1) /**Macro to get the individual service level from the service vector */ #define NETSS_GET_SERVICE_POWER_LEVEL(id, val) ((val >> (2*(id+1))) & NETSS_BIT_MASK_POWER_LEVEL) /**Macro to set the individual service level in the service status vector */ #define NETSS_SET_SERVICE_POWER_LEVEL(id, val) ((val & NETSS_BIT_MASK_POWER_LEVEL) << (2*(id+1))) /**Macro to clear the individual service level from the service status vector */ #define NETSS_CLEAR_SERVICE_POWER_LEVEL(id, val) (val &= ~(NETSS_BIT_MASK_POWER_LEVEL << (2*(id+1)))) /** Opcode Enumeration */ typedef enum netss_opcodes { NETSS_OPCODE_NETIP_PROPERTIES = 1, NETSS_OPCODE_SERVICE_STATUS = 2, NETSS_OPCODE_SERVICE_REQUEST_REPLY = 3, NETSS_OPCODE_CONFIGURE = 4, /** Tag used from ARM to ATOM msgs*/ NETSS_OPCODE_PORT_MAPPING = 4, /** Tag used from ATOM to ARM msgs*/ NETSS_OPCODE_SERVICE_REQUEST = 5, }netss_opcodes_t; /**NetIP subsystem overall power level */ typedef enum netss_level_state { NETSS_POWER_LEVEL_ENABLE = 0, NETSS_POWER_LEVEL_RESERVED = 1, NETSS_POWER_LEVEL_DISABLE = 2, NETSS_POWER_LEVEL_DEEP_STANDBY = 3, NETSS_POWER_LEVEL_INVALID = 4, }netss_power_level_t; /**NetIP subsystem individual service power level */ typedef enum netss_service_power_level_state { NETSS_SERVICE_POWER_LEVEL_ON = 0, NETSS_SERVICE_POWER_LEVEL_LOW = 1, NETSS_SERVICE_POWER_LEVEL_RESERVED = 2, NETSS_SERVICE_POWER_LEVEL_OFF = 3, }netss_service_power_level_t; /**NetIP subsystem service status */ typedef enum netss_service_status_type { NETSS_SERVICE_STATUS_UNUSABLE = 0, NETSS_SERVICE_STATUS_INITIALIZED }netss_service_status_type_t; enum netss_port_map_id { NETSS_PORTMAP_BARE = 0, NETSS_PORTMAP_EXSW = 1, NETSS_PORTMAP_ETHPHY = 2, NETSS_PORTMAP_SFP = 3, }; enum netss_board_interface_id { NETSS_BRD_INTRFC_SGMII0 = 9, NETSS_BRD_INTRFC_SGMII1 = 8, NETSS_BRD_INTRFC_RGMII2 = 11, NETSS_BRD_INTRFC_RGMII3 = 12, }; typedef struct netss_msg_info { uint32_t type; /**Netip properties or service status msg */ uint32_t len; /**Payload length */ uint8_t payload[64]; /**Payload */ struct mutex lock; } netss_msg_info_t; typedef struct netss_service_status { uint8_t id; uint8_t state; }netss_service_status_t; typedef union netss_msg_header { uint8_t opcode; uint32_t header; } netss_msg_header_t; typedef struct netss_configure_msg { netss_msg_header_t hdr; /**header of the message */ //uint32_t num_ds_chan; /**Number of QAM DS channels */ uint8_t docsis_chan[32]; /** each byte if 1, indicates that it is a docsis channel */ uint32_t cm_mode; /**Cable modem operational mode */ uint32_t RCE_floor; /** */ uint32_t RCE_filter; /** */ } netss_configure_msg_t; typedef struct netss_service_status_msg { netss_msg_header_t hdr; /**header of the message */ uint32_t netip_level; /** ARM11 power state 0==Active, 2==low power, 3==disable */ netss_service_status_t service[0]; }netss_service_status_msg_t; typedef struct netss_service_request_msg { netss_msg_header_t hdr; /**header of the message */ uint32_t onBattery; /**1 == system is on battery or 0 system is on AC power */ uint32_t netip_level; /** ARM11 power state 0==Active, 2==low power, 3==disable */ netss_service_status_t service[0]; }netss_service_request_msg_t; struct netss_service_request_stats { unsigned long start; unsigned long end; char *old_state; }; enum netss_xgmii_dev_uid { NETSS_SGMII0_UID = 0, NETSS_SGMII1_UID = 1, NETSS_RGMII2_UID = 2, NETSS_RGMII3_UID = 3 }; #endif