3db86aab554edbb4244c8d1a1c90f152eee768afstevel * CDDL HEADER START
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The contents of this file are subject to the terms of the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Common Development and Distribution License (the "License").
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * You may not use this file except in compliance with the License.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * See the License for the specific language governing permissions
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * and limitations under the License.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * When distributing Covered Code, include this CDDL HEADER in each
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If applicable, add the following below this CDDL HEADER, with the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * fields enclosed by brackets "[]" replaced with your own identifying
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * information: Portions Copyright [yyyy] [name of copyright owner]
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * CDDL HEADER END
193974072f41a843678abf5f61979c748687e66bSherry Moore * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Use is subject to license terms.
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank#define DELAY_TIME 5000000 /* 5 seconds, in microseconds */
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank#define CPU_SIGNATURE_DELAY_TIME 5000000 /* 5 secs, in microsecs */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * functions local to this driver.
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg,
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_attach(dev_info_t *dip, ddi_attach_cmd_t cmd);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_detach(dev_info_t *dip, ddi_detach_cmd_t cmd);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_add_intr_handlers(void);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void rmclomv_dr_data_handler(const char *, int);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_open(dev_t *dev_p, int flag, int otyp, cred_t *cred_p);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_close(dev_t dev, int flag, int otyp, cred_t *cred_p);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_ioctl(dev_t dev, int cmd, intptr_t arg, int mode,
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void rmclomv_checkrmc_start(void);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void rmclomv_checkrmc_destroy(void);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void rmclomv_checkrmc_wakeup(void *);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void rmclomv_refresh_start(void);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void rmclomv_refresh_destroy(void);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void rmclomv_refresh_wakeup(void);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void rmclomv_reset_cache(rmclomv_cache_section_t *new_chain,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_cache_section_t *new_subchain, dp_get_sysinfo_r_t *sysinfo);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic rmclomv_cache_section_t *create_cache_section(int sensor_type, int num);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int get_sensor_by_name(const rmclomv_cache_section_t *section,
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int validate_section_entry(rmclomv_cache_section_t *section,
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int add_names_to_section(rmclomv_cache_section_t *section);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void free_section(rmclomv_cache_section_t *section);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic void add_section(rmclomv_cache_section_t **head,
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_do_cmd(int req_cmd, int resp_cmd, int resp_len,
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int do_psu_cmd(intptr_t arg, int mode, envmon_indicator_t *env_ind,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel dp_get_psu_status_t *rmc_psu, dp_get_psu_status_r_t *rmc_psu_r,
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic uint_t rmc_set_watchdog_timer(uint_t timeoutval);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Driver entry points
3db86aab554edbb4244c8d1a1c90f152eee768afstevel 0, /* ref count */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Loadable module support.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel &mod_driverops, /* Type of module. This is a driver */
193974072f41a843678abf5f61979c748687e66bSherry Moore "rmclomv control driver", /* Name of the module */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Device info
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic ddi_iblock_cookie_t rmclomv_soft_iblock_cookie;
3db86aab554edbb4244c8d1a1c90f152eee768afstevelextern void (*abort_seq_handler)();
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* key_position is effective key-position. Set to locked if unknown */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* real_key_position starts off as unknown and records value actually seen */
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic rsci8 real_key_position = RMC_KEYSWITCH_POS_UNKNOWN;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * mutexes which protect the interrupt handlers.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * mutex to protect the handle_name cache
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * mutex to protect the RMC state
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Payloads of the event handlers.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Checkrmc commands..
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Checkrmc thread state
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_checkrmc_sig = RMCLOMV_CHECKRMC_WAIT;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * RMC state data
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * RMC error indicator values (status from last RMC command)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* fail RMC after 5 minutes without a good response */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * rmclomv_rmc_state is the state reported in OperationalStatus.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * rmclomv_rmc_error reflects the result of the last RMC interaction.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * rmclomv_rmcfailcount is used by the rmclomv_checkrmc thread to count
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * failures in its regular status polls. Once RMCLOMV_RMCFAILTHRESHOLD
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * is reached, rmclomv_rmc_state is marked as RMCLOMV_RMCSTATE_FAILED.
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_rmc_state = RMCLOMV_RMCSTATE_UNKNOWN;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Refresh commands..
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Refresh thread state
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic int rmclomv_refresh_sig = RMCLOMV_REFRESH_WAIT;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * timeout id
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Handle-name cache
3db86aab554edbb4244c8d1a1c90f152eee768afstevel#define RELEASE_CACHE mutex_exit(&rmclomv_cache_lock);
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic rmclomv_cache_section_t *rmclomv_cache; /* main handle-names */
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic rmclomv_cache_section_t *rmclomv_subcache; /* derived names */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * static strings
3db86aab554edbb4244c8d1a1c90f152eee768afstevel mutex_init(&rmclomv_event_hdlr_lock, NULL, MUTEX_DEFAULT, NULL);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel mutex_init(&rmclomv_checkrmc_lock, NULL, MUTEX_DRIVER, NULL);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel mutex_init(&rmclomv_refresh_lock, NULL, MUTEX_DRIVER, NULL);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel mutex_init(&rmclomv_cache_lock, NULL, MUTEX_DRIVER, NULL);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel mutex_init(&rmclomv_state_lock, NULL, MUTEX_DRIVER, NULL);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng mutex_init(×ync_lock, NULL, MUTEX_DEFAULT, NULL);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cv_init(&rmclomv_checkrmc_sig_cv, NULL, CV_DRIVER, NULL);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cv_init(&rmclomv_refresh_sig_cv, NULL, CV_DRIVER, NULL);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* ARGSUSED */
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **resultp)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * only allow one instance
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Register with rmc_comm to prevent it being detached
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * (in the unlikely event that its attach succeeded on a
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * platform whose platmod doesn't lock it down).
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* Remember the dev info */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Add the handlers which watch for unsolicited messages
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * and post event to Sysevent Framework.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Check whether we have an application watchdog
3db86aab554edbb4244c8d1a1c90f152eee768afstevel tod_ops.tod_set_watchdog_timer = rmc_set_watchdog_timer;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel tod_ops.tod_clear_watchdog_timer = rmc_clear_watchdog_timer;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Now is a good time to activate hardware watchdog
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * (if one exists).
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (watchdog_enable && tod_ops.tod_set_watchdog_timer != NULL)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Set time interval and start timesync routine.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Also just this once set the Solaris clock
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * to the RMC clock.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Remove the handlers which watch for unsolicited messages
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * and post event to Sysevent Framework.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* Forget the dev info */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (ddi_get_soft_iblock_cookie(rmclomv_dip, DDI_SOFTINT_HIGH,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = ddi_add_softintr(rmclomv_dip, DDI_SOFTINT_HIGH,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel &rmclomv_softintr_id, &rmclomv_soft_iblock_cookie, NULL,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_event_payload_msg.msg_buf = (caddr_t)&rmclomv_event_payload;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_event_payload_msg.msg_len = sizeof (rmclomv_event_payload);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = rmc_comm_reg_intr(DP_RMC_EVENTS, rmclomv_event_data_handler,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel &rmclomv_event_payload_msg, NULL, &rmclomv_event_hdlr_lock);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to unregister DP_RMC_EVENTS "
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank "ignoring debug enter sequence");
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* ARGSUSED */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Create a cache section structure
3db86aab554edbb4244c8d1a1c90f152eee768afstevel size_t len = offsetof(rmclomv_cache_section_t, entry[0]) +
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_cache_section_t *ptr = kmem_zalloc(len, KM_SLEEP);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Free a cache_section.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * adds supplied section to end of cache chain
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * must be called with cache locked
3db86aab554edbb4244c8d1a1c90f152eee768afsteveladd_section(rmclomv_cache_section_t **head, rmclomv_cache_section_t *section)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * This function releases all cache sections and exchanges the two
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * chain heads for new values.
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_reset_cache(rmclomv_cache_section_t *new_chain,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_cache_section_t *new_subchain, dp_get_sysinfo_r_t *sysinfo)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel bzero(&rmclomv_sysinfo_data, sizeof (rmclomv_sysinfo_data));
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * cache must be locked before calling rmclomv_find_section
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_find_section(rmclomv_cache_section_t *start, uint16_t sensor)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel while ((next != NULL) && (next->sensor_type != sensor))
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Return a string presenting the keyswitch position
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * For unknown values returns "Unknown"
3db86aab554edbb4244c8d1a1c90f152eee768afstevelstatic char *
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return ("NORMAL");
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return ("DIAG");
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return ("LOCKED");
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return ("STBY");
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return ("UNKNOWN");
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The sensor id name is sought in the supplied section and if found
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * its index within the section is written to *index.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Return value is zero for success, otherwise -1.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The cache must be locked before calling get_sensor_by_name
3db86aab554edbb4244c8d1a1c90f152eee768afstevelget_sensor_by_name(const rmclomv_cache_section_t *section,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (strcmp(name, section->entry[i].handle_name.name) == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (-1);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * fills in the envmon_handle name
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * if it is unknown (not cached), the dp_handle_t is returned as a hex-digit
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_hdl_to_envhdl(dp_handle_t hdl, envmon_handle_t *envhdl)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (next = rmclomv_cache; next != NULL; next = next->next_section) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Sought handle not currently cached.
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_dr_data_handler(const char *fru_name, int hint)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel (void) snprintf(attach_pnt, sizeof (attach_pnt), "%s", fru_name);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_alloc(&attr_list, NV_UNIQUE_NAME_TYPE, KM_NOSLEEP);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "Failed to allocate name-value list for %s event", EC_DR);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, DR_AP_ID, attach_pnt);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Add the hint
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, DR_HINT, SE_HINT2STR(hint));
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = ddi_log_sysevent(rmclomv_dip, DDI_VENDOR_SUNW, EC_DR,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel ESC_DR_AP_STATE_CHANGE, attr_list, NULL, DDI_NOSLEEP);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevelfan_sysevent(char *fru_name, char *sensor_name, int sub_event)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_alloc(&attr_list, NV_UNIQUE_NAME_TYPE, KM_NOSLEEP);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "Failed to allocate name-value list for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, ENV_FRU_ID, fru_name);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, ENV_FRU_RESOURCE_ID, sensor_name);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, ENV_FRU_DEVICE, ENV_RESERVED_ATTR);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel (sub_event == RMC_ENV_FAULT_EVENT) ? ENV_FAILED : ENV_OK);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, ENV_MSG, fan_str);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = ddi_log_sysevent(rmclomv_dip, DDI_VENDOR_SUNW, EC_ENV,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevelthreshold_sysevent(char *fru_name, char *sensor_name, int sub_event,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel subclass = (event_type == 'T') ? ESC_ENV_TEMP : ESC_ENV_POWER;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_alloc(&attr_list, NV_UNIQUE_NAME_TYPE, KM_NOSLEEP);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "Failed to allocate name-value list for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, ENV_FRU_ID, fru_name);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, ENV_FRU_RESOURCE_ID, sensor_name);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, ENV_FRU_DEVICE, ENV_RESERVED_ATTR);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_int32(attr_list, ENV_FRU_STATE, ENV_OK);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_int32(attr_list, ENV_FRU_STATE, ENV_WARNING);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_int32(attr_list, ENV_FRU_STATE, ENV_FAILED);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "sensor %s/%s is now outside warning thresholds", fru_name,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "sensor %s/%s is now outside shutdown thresholds", fru_name,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = nvlist_add_string(attr_list, ENV_MSG, sensor_str);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "Failed to add attr [%s] for %s/%s event",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = ddi_log_sysevent(rmclomv_dip, DDI_VENDOR_SUNW, EC_ENV,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel real_key_position = payload->event_info.ev_keysw.key_position;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_NOTE, "keyswitch change event - state = %s",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((real_key_position != RMC_KEYSWITCH_POS_UNKNOWN) &&
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* treat unknown key position as locked */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * send appropriate sysevent
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_hdl_to_envhdl(payload->event_info.ev_hpunot.hpu_hdl,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Wake up the refresh thread.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Wake up the checkrmc thread for an early indication to PICL
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_hdl_to_envhdl(payload->event_info.ev_envnot.env_hdl,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* split name into fru name and sensor name */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* must have at least one '.' */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* find last '.' - convert the others to '/' */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* is it a voltage or temperature sensor? */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((*ptr == 'V' || *ptr == 'T') && *(ptr + 1) == '_') {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * is it a fan sensor?
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Fan sensor names end either in RS, F0 or F1
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((*ptr == 'R' && *(ptr + 1) == 'S' && *(ptr + 2) == '\0') ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel (*ptr == 'F' && *(ptr + 1) == '0' && *(ptr + 2) == '\0') ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel (*ptr == 'F' && *(ptr + 1) == '1' && *(ptr + 2) == '\0')) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel message[ payload->event_info.ev_rmclog.log_record_size] = '\0';
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Logs have a 10 character prefix - specifying the severity of
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * the event being logged. Thus all the magic number 10s down
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/*ARGSUSED*/
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_open(dev_t *dev_p, int flag, int otyp, cred_t *cred_p)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((flag & FWRITE) != 0 && (error = drv_priv(cred_p)) != 0)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/*ARGSUSED*/
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_close(dev_t dev, int flag, int otyp, cred_t *cred_p)
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_do_cmd(int req_cmd, int resp_cmd, int resp_len, intptr_t arg_req,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * RMC returned an error or failed to respond.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Where the RMC itself is implicated, rmclomv_rmc_error
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * is set non-zero. It is cleared after an error free exchange.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Two failure cases are distinguished:
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * RMCLOMV_RMCSTATE_FAILED and RMCLOMV_RMCSTATE_DOWNLOAD.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel switch (rv) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* invalid/NULL soft state structure */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * firmware download in progress,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * can you come back later?
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* memory problems */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* resend failed */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* reply not received - retries exceeded */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* reply not received - command has timed out */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* data protocol cmd not supported */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* invalid argument(s) */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* generic error */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * validate_section_entry checks that the entry at the specified index
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * is valid and not duplicated by an entry above. If these tests fail
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * the entry is removed and B_FALSE returned. Otherwise returns B_TRUE.
3db86aab554edbb4244c8d1a1c90f152eee768afstevelvalidate_section_entry(rmclomv_cache_section_t *section, int index)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "rmclomv: empty handle_name, handle 0x%x type %x",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel continue; /* skip special entries */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "rmclomv: null handle id for \"%s\" type %x",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel } else if (i == index) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel } else if (section->entry[index].handle == entry->handle) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "rmclomv: duplicate handle 0x%x type %x",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "rmclomv: duplicate handle_name \"%s\", "
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * need to remove the entry at index
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Populate a section containing handles with corresponding names
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The supplied section structure must not be publically visible and the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * name cache must not be locked either (because RMC i/o is required).
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * This is the place where a sanity check is applied. Entries containing
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * duplicate handles, duplicate names or empty names are removed and the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * structure is compacted. As a result num_entries may be reduced.
3db86aab554edbb4244c8d1a1c90f152eee768afsteveladd_names_to_section(rmclomv_cache_section_t *section)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < section->num_entries; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel continue; /* skip special entries */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * now ditch invalid and duplicate entries
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < section->num_entries; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel while (validate_section_entry(section, index) == B_FALSE)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The supplied (PSU) cache section is traversed and entries are created
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * for the individual indicators belonging to a PSU. These entries are
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * placed in a private chain. The caller, subsequently acquires the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * cache lock and copies the chain head to make it public.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The handle-names for PSU indicators are derived from the parent PSU
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle-name.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * NOTE: add_names_to_section() may have reduced psu_section->num_entries
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * so DON'T USE psu_resp->num_psus
3db86aab554edbb4244c8d1a1c90f152eee768afstevelmake_psu_subsections(rmclomv_cache_section_t *psu_section,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_cache_section_t **chain_head, dp_get_psu_status_r_t *psu_resp)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < psu_section->num_entries; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Adjust number of entries value in cache section
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * to match the facts.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < psu_section->num_entries; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < psu_section->num_entries; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < psu_section->num_entries; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* defines for accessing union fields */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Data area to read sensor data into
3db86aab554edbb4244c8d1a1c90f152eee768afstevel static union {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* defines for accessing union fields */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel retval = rmclomv_do_cmd(DP_GET_SYSINFO, DP_GET_SYSINFO_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel retval = rmclomv_do_cmd(DP_GET_FRU_STATUS, DP_GET_FRU_STATUS_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Reserve space for special additional entries in the FRU section
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * add special entry for RMC itself
3db86aab554edbb4244c8d1a1c90f152eee768afstevel (void) snprintf(entry->handle_name.name, sizeof (envmon_handle_t),
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * populate any other FRU entries
3db86aab554edbb4244c8d1a1c90f152eee768afstevel fru_section->entry[RMCLOMV_NUM_SPECIAL_FRUS + index].handle =
3db86aab554edbb4244c8d1a1c90f152eee768afstevel fru_section->entry[RMCLOMV_NUM_SPECIAL_FRUS + index].ind_mask =
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel retval = rmclomv_do_cmd(DP_GET_VOLTS, DP_GET_VOLTS_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel RMCRESBUFLEN, (intptr_t)&volts_cmd, (intptr_t)&volts_r);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < volts_r.num_volts; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel retval = rmclomv_do_cmd(DP_GET_FAN_STATUS, DP_GET_FAN_STATUS_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < ampi_r.num_circuit_brks; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel retval = rmclomv_do_cmd(DP_GET_LED_STATE, DP_GET_LED_STATE_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The command DP_GET_ALARM_STATE may not be valid on
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * some RMC versions, so we ignore the return value
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * and proceed
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel for (index = 0; index < alarm_r.num_alarms; index++) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel retval = rmclomv_do_cmd(DP_GET_PSU_STATUS, DP_GET_PSU_STATUS_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The PSUs must be probed last so that the response data
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * (psu_r) is available for make_psu_subsections() below.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Note that all the responses share the same data area
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * which is declared as a union.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * now add nodes derived from PSUs
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel make_psu_subsections(psu_section, &derived_chain, &psu_r);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * name cache sections all set, exchange new for old
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_reset_cache(my_chain, derived_chain, &sysinfo);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * RMC is not responding, ditch any existing cache
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * and just leave the special SC FRU node
3db86aab554edbb4244c8d1a1c90f152eee768afstevel sensor->lowthresholds.warning = ENVMON_VAL_UNAVAILABLE;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel sensor->lowthresholds.shutdown = ENVMON_VAL_UNAVAILABLE;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel sensor->lowthresholds.poweroff = ENVMON_VAL_UNAVAILABLE;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel sensor->highthresholds.warning = ENVMON_VAL_UNAVAILABLE;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel sensor->highthresholds.shutdown = ENVMON_VAL_UNAVAILABLE;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel sensor->highthresholds.poweroff = ENVMON_VAL_UNAVAILABLE;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel fan->lowthresholds.shutdown = ENVMON_VAL_UNAVAILABLE;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel fan->lowthresholds.poweroff = ENVMON_VAL_UNAVAILABLE;
3db86aab554edbb4244c8d1a1c90f152eee768afsteveldo_psu_cmd(intptr_t arg, int mode, envmon_indicator_t *env_ind,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel dp_get_psu_status_t *rmc_psu, dp_get_psu_status_r_t *rmc_psu_r,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure we've got PSU handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel section = rmclomv_find_section(rmclomv_subcache, detector_type);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* request for first handle */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((section == NULL) || (section->num_entries == 0))
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure name is properly terminated */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((section == NULL) || (get_sensor_by_name(section,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a sensor, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the indicator status
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((sensor_status == ENVMON_SENSOR_OK) && (rmclomv_rmc_error ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_do_cmd(DP_GET_PSU_STATUS, DP_GET_PSU_STATUS_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((env_ind->sensor_status = sensor_status) == ENVMON_SENSOR_OK) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((rmc_psu_r->psu_status[0].flag & DP_PSU_PRESENCE) == 0)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel (rmc_psu_r->psu_status[0].flag & indicator_mask) == 0 ?
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/*ARGSUSED*/
3db86aab554edbb4244c8d1a1c90f152eee768afstevelrmclomv_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *cred_p,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * A number of OK/not_OK indicators are supported by PSUs
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * (voltage, current, fan, temperature). So the maximum
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * number of such indicators relates to the maximum number
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * of power-supplies.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel lomv_sysinfo.maxVoltSens = rmclomv_sysinfo_data.maxVolt;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * the ALOM-Solaris interface does not include
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * amp sensors, so we can hard code this value
3db86aab554edbb4244c8d1a1c90f152eee768afstevel lomv_sysinfo.maxTempSens = rmclomv_sysinfo_data.maxTemp;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel lomv_sysinfo.maxFanSens = rmclomv_sysinfo_data.maxFan;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (ddi_copyout((caddr_t)&lomv_sysinfo, (caddr_t)arg,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got volts handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* request for first handle */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure name is properly terminated */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a sensor, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the sensor value
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((sensor_status == ENVMON_SENSOR_OK) && (rmclomv_rmc_error ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (do_psu_cmd(arg, mode, &env_ind, &rmc_psu, &rmc_psu_r,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (do_psu_cmd(arg, mode, &env_ind, &rmc_psu, &rmc_psu_r,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (do_psu_cmd(arg, mode, &env_ind, &rmc_psu, &rmc_psu_r,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got temperature handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* request for first handle */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure name is properly terminated */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a sensor, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the sensor value
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((sensor_status == ENVMON_SENSOR_OK) && (rmclomv_rmc_error ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_do_cmd(DP_GET_TEMPERATURES, DP_GET_TEMPERATURES_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got fan handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* request for first handle */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure name is properly terminated */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a sensor, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the sensor value
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((sensor_status == ENVMON_SENSOR_OK) && (rmclomv_rmc_error ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_do_cmd(DP_GET_FAN_STATUS, DP_GET_FAN_STATUS_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got amp indicator handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* request for first handle */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure name is properly terminated */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified an indicator, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the indicator status
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((sensor_status == ENVMON_SENSOR_OK) && (rmclomv_rmc_error ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_do_cmd(DP_GET_CIRCUIT_BRKS, DP_GET_CIRCUIT_BRKS_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (rmc_ampi_r.circuit_brk_status[0].sensor_status !=
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If rmclomv_rmc_error is set there is no way
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * that we read information from RSC. Just copy
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * out an inaccessible evironmental.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got hpu handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * At this point the cache is locked and section points to
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * the section relating to hpus.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* request for first handle */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure name is properly terminated */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified an hpu, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the hpu status
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* this is the pseudo SC node */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If rmclomv_rmc_error is set there is no way
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * that we read information from RSC. Just copy
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * out an inaccessible environmental.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got LED handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* request for first handle */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure name is properly terminated */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a LED, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the LED status
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((sensor_status == ENVMON_SENSOR_OK) && (rmclomv_rmc_error ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * start with some defaults then override
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If rmclomv_rmc_error is set there is no way
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * that we read information from RSC. Just copy
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * out an inaccessible environmental.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Ensure name is properly terminated.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got LED handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a LED, note its handle value
3db86aab554edbb4244c8d1a1c90f152eee768afstevel retval = rmclomv_do_cmd(DP_SET_LED_STATE, DP_SET_LED_STATE_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "ENVMONIOCSETLED: \"%s\" status: 0x%x",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Yes, I know this is ugly, but the V210 has no keyswitch,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * even though the ALOM returns a value for it
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (ddi_copyin((caddr_t)arg, (caddr_t)&env_alarminfo,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got ALARM handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* request for first handle */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* ensure name is properly terminated */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (get_sensor_by_name(section, env_alarminfo.id.name,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a ALARM, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the ALARM status
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmclomv_do_cmd(DP_GET_ALARM_STATE, DP_GET_ALARM_STATE_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * start with some defaults then override
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If rmclomv_rmc_error is set there is no way
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * that we read information from RSC. Just copy
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * out an inaccessible environmental.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (ddi_copyout((caddr_t)&env_alarminfo, (caddr_t)arg,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (env_alarmctl.alarm_state < RMCLOMV_MIN_ALARM_STATE ||
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Ensure name is properly terminated.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got ALARM handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a ALARM, note its handle value
3db86aab554edbb4244c8d1a1c90f152eee768afstevel rmc_setalarm.state = (rsci8)env_alarmctl.alarm_state;
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "ENVMONIOCSETALARM: \"%s\" status: "
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cmn_err(CE_WARN, "DP_GET_SDP_VERSION failed, ret=%d\n",
3db86aab554edbb4244c8d1a1c90f152eee768afstevel } else if (rmc_sdpver_r.version < SDP_RESPONDS_TO_ALL_CMDS) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel DP_GET_CHASSIS_SERIALNUM_R, sizeof (rmc_serialnum_r),
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (retval != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* ARGSUSED */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel CALLB_CPR_INIT(&cprinfo, &rmclomv_checkrmc_lock, callb_generic_cpr,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "rmclomv_checkrmc");
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Initial entry to this for loop is made with
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * rmclomv_checkrmc_sig set to RMCLOMV_PROCESS_NOW. So the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * following while loop drops through the first time. A
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * timeout call is made just before polling the RMC. Its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * interrupt routine sustains this loop by injecting additional
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * state changes and cv events.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Wait for someone to tell me to continue.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel while (rmclomv_checkrmc_sig == RMCLOMV_CHECKRMC_WAIT) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel CALLB_CPR_SAFE_END(&cprinfo, &rmclomv_checkrmc_lock);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * mustn't hold same lock as timeout called with
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * when cancelling timer
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* RMCLOMV_CHECKRMC_EXITNOW implies signal by _detach(). */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (rmclomv_checkrmc_sig == RMCLOMV_CHECKRMC_EXITNOW) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* rmclomv_checkrmc_lock is held at this point! */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* NOTREACHED */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If the RMC is not responding, rmclomv_do_cmd() takes a
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * long time and eventually times out. We conclude that the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * RMC is broken if it doesn't respond to a number of polls
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * made 60 secs apart. So that the rmclomv_do_cmd() time-out
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * period isn't added to our 60 second timer, make the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * timeout() call before calling rmclomv_do_cmd().
3db86aab554edbb4244c8d1a1c90f152eee768afstevel err = rmclomv_do_cmd(DP_GET_SYSINFO, DP_GET_SYSINFO_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (err == 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* successful poll, reset fail count */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((err != 0) &&
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Failed response or no response from RMC.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Count the failure.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If threshold exceeded, send a DR event.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (rmclomv_rmcfailcount <= RMCLOMV_RMCFAILTHRESHOLD)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Re-enter the lock to prepare for another iteration.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * We must have the lock here to protect rmclomv_checkrmc_sig.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel tp = thread_create(NULL, 0, rmclomv_checkrmc, NULL, 0,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (tid != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Wait for rmclomv_checkrmc() to finish
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/*ARGSUSED*/
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (rmclomv_checkrmc_sig != RMCLOMV_CHECKRMC_EXITNOW)
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/* ARGSUSED */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel CALLB_CPR_INIT(&cprinfo, &rmclomv_refresh_lock, callb_generic_cpr,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "rmclomv_refresh");
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * Wait until the rmclomv_checkrmc() thread has had a chance to
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * run its main loop. This is done so that rmclomv_refresh will
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * only run its main loop once at start of day; otherwise, it may
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * run twice and generate warning messages when redundantly populating
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * its internal cache.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Wait for someone to tell me to continue.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel while (rmclomv_refresh_sig == RMCLOMV_REFRESH_WAIT) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel cv_wait(&rmclomv_refresh_sig_cv, &rmclomv_refresh_lock);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* RMCLOMV_REFRESH_EXITNOW implies signal by _detach(). */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (rmclomv_refresh_sig == RMCLOMV_REFRESH_EXITNOW) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* rmclomv_refresh_lock is held at this point! */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* NOTREACHED */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel ASSERT(rmclomv_refresh_sig == RMCLOMV_REFRESH_PROCESSNOW);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * We're not going to access rmclomv_sysinfo_data here,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * so there's no point in locking it before reading
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * rmclomv_sysinfo_valid. Also this avoids holding two
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * locks at once and the concommitant worry about deadlocks.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * We've just successfully read the RMC sysinfo
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * so the RMC must be operational. Update its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * state and if it was previously not OK, refresh
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * nodename, CPU signatures and watchdog settings.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel (void (*)(void))modgetsymvalue(
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "plat_nodename_set", 0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel "current_sgn", 0);
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * Delay before calling CPU_SIGNATURE, to allow
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * any pending asynchronous communications (i.e.
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * plat_timesync()) to complete. This helps to
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * prevent the situation where the message associated
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * with the CPU_SIGNATURE state cannot be sent to the
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * system controller.
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * Delay before calling
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * send_watchdog_msg, to allow
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * CPU_SIGNATURE() time to
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * complete; this increases the
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * chances of successfully sending
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * the watchdog message to the
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank * system controller.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * update keyswitch value in case it changed while the
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * RMC was out of action
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((real_key_position != RMC_KEYSWITCH_POS_UNKNOWN) &&
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* treat unknown key position as locked */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* treat unreadable key position as locked */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Re-enter the lock to prepare for another iteration.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * We must have the lock here to protect rmclomv_refresh_sig.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel tp = thread_create(NULL, 0, rmclomv_refresh, NULL, 0,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if (tid != 0) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Wait for rmclomv_refresh() to finish
3db86aab554edbb4244c8d1a1c90f152eee768afstevel (void) rmc_comm_request_nowait(&request, (msg == 1) ?
3db86aab554edbb4244c8d1a1c90f152eee768afstevel/*ARGSUSED*/
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((watchdog_enable == 0) || (watchdog_available == 0)) {
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If boothowto has RB_DEBUG set we never want to set the watchdog
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * support on.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * When the watchdog is shut off last_watchdog_msg goes from a
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * 0 to a 1. So we must test to see that last_watchdog_msg is
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * set to 1 indicating that watchdog was shut off and
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * After which we set last_watchdog_msg back to 0 so that we do not
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * run this code
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (1);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((watchdog_activated == 0) || (boothowto & RB_DEBUG))
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* Is the system coming up? */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* Request the time from the RMC clock. */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel retval = rmclomv_do_cmd(DP_GET_DATE_TIME, DP_GET_DATE_TIME_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If we were able to get the time lets set the local clock.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * The time returned from RMC is in Unix time format.
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * If we couldn't get the time we'll accept the drift so as not
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * to cause congestion on the I2C bus or cause boot
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * performance regressions.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng timesync_tid = timeout(plat_timesync, NULL, timesync_interval);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * Interfaces to get/set alarm relays from outside
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got ALARM handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a ALARM, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the ALARM status
3db86aab554edbb4244c8d1a1c90f152eee768afstevel if ((sensor_status == ENVMON_SENSOR_OK) && (rmclomv_rmc_error ||
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank rmclomv_do_cmd(DP_GET_ALARM_STATE, DP_GET_ALARM_STATE_R,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * copy results into buffer for user
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * start with some defaults then override
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);
3db86aab554edbb4244c8d1a1c90f152eee768afstevel /* see if we've got ALARM handles cached */
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * user correctly identified a ALARM, note its
3db86aab554edbb4244c8d1a1c90f152eee768afstevel * handle value and request the ALARM status
3db86aab554edbb4244c8d1a1c90f152eee768afstevel u_rmc_setalarm.handle = section->entry[index].handle;
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank rmclomv_do_cmd(DP_SET_ALARM_STATE, DP_SET_ALARM_STATE_R,
f594b28ae1d884a53b99c552b3ee660cdea09026jfrank sizeof (u_rmc_setalarm_r), (intptr_t)&u_rmc_setalarm,
3db86aab554edbb4244c8d1a1c90f152eee768afstevel return (0);