#define SIO_BASE1 0x2E /* 1st command-reg to check */ #define SIO_BASE2 0x4E /* alt command-reg to check */
#define SIO_SID 0x20 /* SuperI/O ID Register */ #define SIO_SID_PC87365 0xe5 /* Expected value in ID Register for PC87365 */ #define SIO_SID_PC87366 0xe9 /* Expected value in ID Register for PC87366 */
/* try the 2 possible values, read a hardware reg to verify */
superio_cmd = SIO_BASE1;
id = superio_inb(SIO_SID); if (id == SIO_SID_PC87365 || id == SIO_SID_PC87366) return superio_cmd;
superio_cmd = SIO_BASE2;
id = superio_inb(SIO_SID); if (id == SIO_SID_PC87365 || id == SIO_SID_PC87366) return superio_cmd;
staticint pc8736x_gpio_current(unsigned minor)
{ int port, bit;
minor &= 0x1f;
port = minor >> 3;
bit = minor & 7; return ((pc8736x_gpio_shadow[port] >> bit) & 0x01);
}
staticvoid __init pc8736x_init_shadow(void)
{ int port;
/* read the current values driven on the GPIO signals */ for (port = 0; port < 4; ++port)
pc8736x_gpio_shadow[port]
= inb_p(pc8736x_gpio_base + port_offset[port]
+ PORT_OUT);
}
staticstruct cdev pc8736x_gpio_cdev;
staticint __init pc8736x_gpio_init(void)
{ int rc;
dev_t devid;
pdev = platform_device_alloc(DEVNAME, 0); if (!pdev) return -ENOMEM;
if (!pc8736x_superio_present()) {
rc = -ENODEV;
dev_err(&pdev->dev, "no device found\n"); goto undo_platform_dev_add;
}
pc8736x_gpio_ops.dev = &pdev->dev;
/* Verify that chip and it's GPIO unit are both enabled. My BIOS does this, so I take minimum action here
*/
rc = superio_inb(SIO_CF1); if (!(rc & 0x01)) {
rc = -ENODEV;
dev_err(&pdev->dev, "device not enabled\n"); goto undo_platform_dev_add;
}
device_select(SIO_GPIO_UNIT); if (!superio_inb(SIO_UNIT_ACT)) {
rc = -ENODEV;
dev_err(&pdev->dev, "GPIO unit not enabled\n"); goto undo_platform_dev_add;
}
/* read the GPIO unit base addr that chip responds to */
pc8736x_gpio_base = (superio_inb(SIO_BASE_HADDR) << 8
| superio_inb(SIO_BASE_LADDR));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.