applesmc: cosmetic whitespace and indentation cleanup

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>
Message-id: 1497639316-22202-2-git-send-email-gsomlo@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gabriel L. Somlo 2017-06-16 14:55:14 -04:00 committed by Gerd Hoffmann
parent 4c8c1cc544
commit 36bcd0350c
1 changed files with 50 additions and 48 deletions

View File

@ -39,16 +39,19 @@
/* #define DEBUG_SMC */
#define APPLESMC_DEFAULT_IOBASE 0x300
/* data port used by Apple SMC */
#define APPLESMC_DATA_PORT 0x0
/* command/status port used by Apple SMC */
#define APPLESMC_CMD_PORT 0x4
#define APPLESMC_NR_PORTS 32
#define APPLESMC_READ_CMD 0x10
#define APPLESMC_WRITE_CMD 0x11
#define APPLESMC_GET_KEY_BY_INDEX_CMD 0x12
#define APPLESMC_GET_KEY_TYPE_CMD 0x13
enum {
APPLESMC_DATA_PORT = 0x00,
APPLESMC_CMD_PORT = 0x04,
APPLESMC_NUM_PORTS = 0x20,
};
enum {
APPLESMC_READ_CMD = 0x10,
APPLESMC_WRITE_CMD = 0x11,
APPLESMC_GET_KEY_BY_INDEX_CMD = 0x12,
APPLESMC_GET_KEY_TYPE_CMD = 0x13,
};
#ifdef DEBUG_SMC
#define smc_debug(...) fprintf(stderr, "AppleSMC: " __VA_ARGS__)
@ -77,12 +80,11 @@ struct AppleSMCState {
uint32_t iobase;
uint8_t cmd;
uint8_t status;
uint8_t key[4];
char key[4];
uint8_t read_pos;
uint8_t data_len;
uint8_t data_pos;
uint8_t data[255];
uint8_t charactic[4];
char *osk;
QLIST_HEAD(, AppleSMCData) data_def;
};
@ -141,8 +143,7 @@ static void applesmc_io_data_write(void *opaque, hwaddr addr, uint64_t val,
}
}
static uint64_t applesmc_io_data_read(void *opaque, hwaddr addr1,
unsigned size)
static uint64_t applesmc_io_data_read(void *opaque, hwaddr addr, unsigned size)
{
AppleSMCState *s = opaque;
uint8_t retval = 0;
@ -157,20 +158,21 @@ static uint64_t applesmc_io_data_read(void *opaque, hwaddr addr1,
if (s->data_pos == s->data_len) {
s->status = 0x00;
smc_debug("EOF\n");
} else
} else {
s->status = 0x05;
}
}
smc_debug("DATA Read b: %#x = %#x\n", addr1, retval);
}
smc_debug("DATA Read b: %#x = %#x\n", addr, retval);
return retval;
}
static uint64_t applesmc_io_cmd_read(void *opaque, hwaddr addr1, unsigned size)
static uint64_t applesmc_io_cmd_read(void *opaque, hwaddr addr, unsigned size)
{
AppleSMCState *s = opaque;
smc_debug("CMD Read B: %#x\n", addr1);
smc_debug("CMD Read B: %#x\n", addr);
return s->status;
}