/* applesmc_get_key_type - get key type, and put the result in type (char). Returns zero on success or a negative error on failure. Callers must hold applesmc_lock.  */
static int applesmc_get_key_type(char *key, char *type)
/* applesmc_get_key_type - get key type, and put the result in type (char). Returns zero on success or a negative error on failure. Callers must hold applesmc_lock.  */
static int applesmc_get_key_type(char *key, char *type)
{
	int i;
	if (send_command(APPLESMC_GET_KEY_TYPE_CMD))
		return -EIO;
	for (i = 0; i < 4; i++) {
		outb(key[i], APPLESMC_DATA_PORT);
		if (__wait_status(0x04))
			return -EIO;
	}
	outb(6, APPLESMC_DATA_PORT);
	for (i = 0; i < 6; i++) {
		if (__wait_status(0x05))
			return -EIO;
		type[i] = inb(APPLESMC_DATA_PORT);
	}
	type[5] = 0;
	return 0;
}