예제 #1
0
파일: shpchp_hpc.c 프로젝트: ivucica/linux
static int hpc_get_power_status(struct slot * slot, u8 *status)
{
	struct controller *ctrl = slot->ctrl;
	u32 slot_reg;
	u8 state;
	
	DBG_ENTER_ROUTINE 

	slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
	state = (slot_reg & SLOT_STATE_MASK) >> SLOT_STATE_SHIFT;

	switch (state) {
	case SLOT_STATE_PWRONLY:
		*status = 2;	/* Powered only */
		break;
	case SLOT_STATE_ENABLED:
		*status = 1;	/* Enabled */
		break;
	case SLOT_STATE_DISABLED:
		*status = 0;	/* Disabled */
		break;
	default:
		*status = 0xFF;	/* Reserved */
		break;
	}

	DBG_LEAVE_ROUTINE 
	return 0;
}
예제 #2
0
파일: shpchp_hpc.c 프로젝트: ivucica/linux
static int hpc_get_attention_status(struct slot *slot, u8 *status)
{
	struct controller *ctrl = slot->ctrl;
	u32 slot_reg;
	u8 state;
	
	DBG_ENTER_ROUTINE 

	slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
	state = (slot_reg & ATN_LED_STATE_MASK) >> ATN_LED_STATE_SHIFT;

	switch (state) {
	case ATN_LED_STATE_ON:
		*status = 1;	/* On */
		break;
	case ATN_LED_STATE_BLINK:
		*status = 2;	/* Blink */
		break;
	case ATN_LED_STATE_OFF:
		*status = 0;	/* Off */
		break;
	default:
		*status = 0xFF;	/* Reserved */
		break;
	}

	DBG_LEAVE_ROUTINE 
	return 0;
}
예제 #3
0
파일: shpchp_hpc.c 프로젝트: 020gzh/linux
static int hpc_get_latch_status(struct slot *slot, u8 *status)
{
	struct controller *ctrl = slot->ctrl;
	u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));

	*status = !!(slot_reg & MRL_SENSOR);	/* 0 -> close; 1 -> open */

	return 0;
}
예제 #4
0
파일: shpchp_hpc.c 프로젝트: 020gzh/linux
static int hpc_get_adapter_status(struct slot *slot, u8 *status)
{
	struct controller *ctrl = slot->ctrl;
	u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
	u8 state = (slot_reg & PRSNT_MASK) >> PRSNT_SHIFT;

	*status = (state != 0x3) ? 1 : 0;

	return 0;
}
예제 #5
0
파일: shpchp_hpc.c 프로젝트: ivucica/linux
static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
{
	int retval = 0;
	struct controller *ctrl = slot->ctrl;
	u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
	u8 m66_cap  = !!(slot_reg & MHZ66_CAP);
	u8 pi, pcix_cap;

	DBG_ENTER_ROUTINE 

	if ((retval = hpc_get_prog_int(slot, &pi)))
		return retval;

	switch (pi) {
	case 1:
		pcix_cap = (slot_reg & PCIX_CAP_MASK_PI1) >> PCIX_CAP_SHIFT;
		break;
	case 2:
		pcix_cap = (slot_reg & PCIX_CAP_MASK_PI2) >> PCIX_CAP_SHIFT;
		break;
	default:
		return -ENODEV;
	}

	dbg("%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n",
	    __FUNCTION__, slot_reg, pcix_cap, m66_cap);

	switch (pcix_cap) {
	case 0x0:
		*value = m66_cap ? PCI_SPEED_66MHz : PCI_SPEED_33MHz;
		break;
	case 0x1:
		*value = PCI_SPEED_66MHz_PCIX;
		break;
	case 0x3:
		*value = PCI_SPEED_133MHz_PCIX;
		break;
	case 0x4:
		*value = PCI_SPEED_133MHz_PCIX_266;
		break;
	case 0x5:
		*value = PCI_SPEED_133MHz_PCIX_533;
		break;
	case 0x2:
	default:
		*value = PCI_SPEED_UNKNOWN;
		retval = -ENODEV;
		break;
	}

	dbg("Adapter speed = %d\n", *value);
	DBG_LEAVE_ROUTINE 
	return retval;
}
static int hpc_get_power_status(struct slot * slot, u8 *status)
{
	struct controller *ctrl = slot->ctrl;
	u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
	u8 state = (slot_reg & SLOT_STATE_MASK) >> SLOT_STATE_SHIFT;

	switch (state) {
	case SLOT_STATE_PWRONLY:
		*status = 2;	
		break;
	case SLOT_STATE_ENABLED:
		*status = 1;	
		break;
	case SLOT_STATE_DISABLED:
		*status = 0;	
		break;
	default:
		*status = 0xFF;	
		break;
	}

	return 0;
}
static int hpc_get_attention_status(struct slot *slot, u8 *status)
{
	struct controller *ctrl = slot->ctrl;
	u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
	u8 state = (slot_reg & ATN_LED_STATE_MASK) >> ATN_LED_STATE_SHIFT;

	switch (state) {
	case ATN_LED_STATE_ON:
		*status = 1;	
		break;
	case ATN_LED_STATE_BLINK:
		*status = 2;	
		break;
	case ATN_LED_STATE_OFF:
		*status = 0;	
		break;
	default:
		*status = 0xFF;	
		break;
	}

	return 0;
}