diff options
Diffstat (limited to 'src/superio')
-rw-r--r-- | src/superio/NSC/pc87366/chip.h | 2 | ||||
-rw-r--r-- | src/superio/NSC/pc87366/superio.c | 22 | ||||
-rw-r--r-- | src/superio/NSC/pc97307/chip.h | 8 | ||||
-rw-r--r-- | src/superio/NSC/pc97307/pc97307.h | 10 | ||||
-rw-r--r-- | src/superio/NSC/pc97307/superio.c | 93 | ||||
-rw-r--r-- | src/superio/via/vt1211/chip.h | 2 | ||||
-rw-r--r-- | src/superio/via/vt1211/vt1211.c | 2 | ||||
-rw-r--r-- | src/superio/winbond/w83627thf/chip.h | 2 | ||||
-rw-r--r-- | src/superio/winbond/w83627thf/superio.c | 22 |
9 files changed, 99 insertions, 64 deletions
diff --git a/src/superio/NSC/pc87366/chip.h b/src/superio/NSC/pc87366/chip.h index a3bebf2e1e..90ea8c69cc 100644 --- a/src/superio/NSC/pc87366/chip.h +++ b/src/superio/NSC/pc87366/chip.h @@ -5,7 +5,7 @@ #define SIO_COM2_BASE 0x2F8 #endif -extern struct chip_control superio_NSC_pc87366_control; +extern struct chip_operations superio_NSC_pc87366_control; #include <pc80/keyboard.h> #include <uart8250.h> diff --git a/src/superio/NSC/pc87366/superio.c b/src/superio/NSC/pc87366/superio.c index 0d1f878ec8..6b8db55573 100644 --- a/src/superio/NSC/pc87366/superio.c +++ b/src/superio/NSC/pc87366/superio.c @@ -23,19 +23,19 @@ static void init(device_t dev) if (!dev->enabled) { return; } - conf = dev->chip->chip_info; + conf = dev->chip_info; switch(dev->path.u.pnp.device) { case PC87366_SP1: - res0 = get_resource(dev, PNP_IDX_IO0); + res0 = find_resource(dev, PNP_IDX_IO0); init_uart8250(res0->base, &conf->com1); break; case PC87366_SP2: - res0 = get_resource(dev, PNP_IDX_IO0); + res0 = find_resource(dev, PNP_IDX_IO0); init_uart8250(res0->base, &conf->com2); break; case PC87366_KBCK: - res0 = get_resource(dev, PNP_IDX_IO0); - res1 = get_resource(dev, PNP_IDX_IO1); + res0 = find_resource(dev, PNP_IDX_IO0); + res1 = find_resource(dev, PNP_IDX_IO1); init_pc_keyboard(res0->base, res1->base, &conf->keyboard); break; } @@ -64,13 +64,13 @@ static struct pnp_info pnp_dev_info[] = { }; -static void enumerate(struct chip *chip) +static void enable_dev(struct device *dev) { - pnp_enumerate(chip, sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), - &pnp_ops, pnp_dev_info); + pnp_enable_device(dev, &pnp_ops, + sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); } -struct chip_control superio_NSC_pc87366_control = { - .enumerate = enumerate, - .name = "NSC 87366" +struct chip_operations superio_NSC_pc87366_control = { + .enable_dev = enable_dev, + .name = "NSC 87366" }; diff --git a/src/superio/NSC/pc97307/chip.h b/src/superio/NSC/pc97307/chip.h index fd78e8e89f..369c47a44b 100644 --- a/src/superio/NSC/pc97307/chip.h +++ b/src/superio/NSC/pc97307/chip.h @@ -14,9 +14,13 @@ #define SIO_COM2_BASE 0x2F8 #endif -extern struct chip_control superio_NSC_pc97307_control; +extern struct chip_operations superio_NSC_pc97307_control; + +#include <pc80/keyboard.h> +#include <uart8250.h> struct superio_NSC_pc97307_config { - int port; + struct uart8250 com1, com2; + struct pc_keyboard keyboard; }; #endif /* _SUPERIO_NSC_PC97307 */ diff --git a/src/superio/NSC/pc97307/pc97307.h b/src/superio/NSC/pc97307/pc97307.h new file mode 100644 index 0000000000..fa1f7f69b5 --- /dev/null +++ b/src/superio/NSC/pc97307/pc97307.h @@ -0,0 +1,10 @@ +#define PC97307_KBCK 0x00 /* Keyboard */ +#define PC97307_KBCM 0x01 /* Mouse */ +#define PC97307_RTC 0x02 /* Real-Time Clock */ +#define PC97307_FDC 0x03 /* Floppy */ +#define PC97307_PP 0x04 /* Parallel port */ +#define PC97307_SP2 0x05 /* Com2 */ +#define PC97307_SP1 0x06 /* Com1 */ +#define PC97307_GPIO 0x07 +#define PC97307_PM 0x08 /* Power Management */ + diff --git a/src/superio/NSC/pc97307/superio.c b/src/superio/NSC/pc97307/superio.c index 2fb62e1c93..a0732d05f2 100644 --- a/src/superio/NSC/pc97307/superio.c +++ b/src/superio/NSC/pc97307/superio.c @@ -4,44 +4,41 @@ #include <arch/io.h> #include <console/console.h> #include "chip.h" +#include "pc97307.h" -void pnp_output(char address, char data) -{ - outb(address, PNP_CFGADDR); - outb(data, PNP_CFGDATA); -} - -void sio_enable(struct chip *chip, enum chip_pass pass) +static void init(device_t dev) { + struct superio_NSC_pc97307_config *conf; + struct resource *res0, *res1; - unsigned char reg; + if (!dev->enabled) { + return; + } + conf = dev->chip; + switch(dev->path.u.pnp.device) { + case PC97307_SP1: + res0 = find_resource(dev, PNP_IDX_IO0); + init_uart8250(res0->base, &conf->com1); + break; - switch (pass) { - case CONF_PASS_PRE_PCI: - printk_info("Configuring PC97307...\n"); + case PC97307_SP2: + res0 = find_resource(dev, PNP_IDX_IO0); + init_uart8250(res0->base, &conf->com2); + break; + case PC97307_KBCK: /* Enable keyboard */ - pnp_output(0x07, 0x00); - pnp_output(0x30, 0x00); /* Disable keyboard */ - pnp_output(0xf0, 0x40); /* Set KBC clock to 8 Mhz */ - pnp_output(0x30, 0x01); /* Enable keyboard */ - - /* Enable mouse */ - pnp_output(0x07, 0x01); - pnp_output(0x30, 0x01); - - /* Enable rtc */ - pnp_output(0x07, 0x02); - pnp_output(0x30, 0x01); + pnp_set_logical_device(dev); + pnp_set_enable(dev, 0); /* Disable keyboard */ + pnp_write_config(dev, 0xf0, 0x40); /* Set KBC clock to 8 Mhz */ + pnp_set_enable(dev, 1); /* Enable keyboard */ - /* Enable fdc */ - pnp_output(0x07, 0x03); - pnp_output(0x30, 0x01); - - /* Enable parallel port */ - pnp_output(0x07, 0x04); - pnp_output(0x30, 0x01); + res0 = find_resource(dev, PNP_IDX_IO0); + res1 = find_resource(dev, PNP_IDX_IO1); + init_pc_keyboard(res0->base, res1->base, &conf->keyboard); + break; + case PC97307_FDC: /* Set up floppy in PS/2 mode */ outb(0x09, SIO_CONFIG_RA); reg = inb(SIO_CONFIG_RD); @@ -49,13 +46,37 @@ void sio_enable(struct chip *chip, enum chip_pass pass) outb(reg, SIO_CONFIG_RD); outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */ break; - default: - /* nothing yet */ - break; + } } -struct chip_control superio_NSC_pc97307_control = { - enable: sio_enable, - name: "NSC 97307" +static struct device_operations ops = { + .read_resources = pnp_read_resources, + .set_resources = pnp_set_resources, + .enable_resources = pnp_enable_resources, + .enable = pnp_enable, + .init = init, +}; + +static struct pnp_info pnp_dev_info[] = { + { &ops, PC97307_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0xffb, 0 }, { 0xffb, 0x4}, }, + { &ops, PC97307_KBCM, PNP_IRQ0 }, + { &ops, PC97307_RTC, PNP_IO0 | PNP_IRQ0, { 0xfffe, 0}, }, + { &ops, PC97307_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0xfffa, 0}, }, + { &ops, PC97307_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x03fc, 0}, }, + { &ops, PC97307_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0xfff8, 0 }, }, + { &ops, PC97307_SP1, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 }, }, + { &ops, PC97307_GPIO, PNP_IO0, { 0xfff8, 0 } }, + { &ops, PC97307_PM, PNP_IO0, { 0xfffe, 0 } }, +}; + +static void enable_dev(struct device *dev) +{ + pnp_enable_device(dev, &pnp_ops, + sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); +} + +struct chip_operations superio_NSC_pc97307_control = { + .enable_dev = enable_dev, + .name = "NSC 97307" }; diff --git a/src/superio/via/vt1211/chip.h b/src/superio/via/vt1211/chip.h index 76a5a5babd..fc461cc635 100644 --- a/src/superio/via/vt1211/chip.h +++ b/src/superio/via/vt1211/chip.h @@ -1,7 +1,7 @@ #ifndef _SUPERIO_VIA_VT1211 #define _SUPERIO_VIA_VT1211 -extern struct chip_control superio_via_vt1211_control; +extern struct chip_operations superio_via_vt1211_control; struct superio_via_vt1211_config { /* PCI function enables */ diff --git a/src/superio/via/vt1211/vt1211.c b/src/superio/via/vt1211/vt1211.c index 923a098317..5a92ebcfc6 100644 --- a/src/superio/via/vt1211/vt1211.c +++ b/src/superio/via/vt1211/vt1211.c @@ -141,7 +141,7 @@ static void enumerate(struct chip *chip) chip->dev->ops = &default_pci_ops_bus; } -struct chip_control superio_via_vt1211_control = { +struct chip_operations superio_via_vt1211_control = { .enumerate = enumerate, .enable = superio_init, .name = "VIA vt1211" diff --git a/src/superio/winbond/w83627thf/chip.h b/src/superio/winbond/w83627thf/chip.h index d0cd7edf79..a25b944b19 100644 --- a/src/superio/winbond/w83627thf/chip.h +++ b/src/superio/winbond/w83627thf/chip.h @@ -5,7 +5,7 @@ #define SIO_COM2_BASE 0x2F8 #endif -extern struct chip_control superio_winbond_w83627thf_control; +extern struct chip_operations superio_winbond_w83627thf_control; #include <pc80/keyboard.h> #include <uart8250.h> diff --git a/src/superio/winbond/w83627thf/superio.c b/src/superio/winbond/w83627thf/superio.c index db0b308ec1..378be49f16 100644 --- a/src/superio/winbond/w83627thf/superio.c +++ b/src/superio/winbond/w83627thf/superio.c @@ -25,19 +25,19 @@ static void init(device_t dev) if (!dev->enable) { return; } - conf = dev->chip->chip_info; + conf = dev->chip_info; switch(dev->path.u.pnp.device) { case W83627HF_SP1: - res0 = get_resource(dev, PNP_IDX_IO0); + res0 = find_resource(dev, PNP_IDX_IO0); init_uart8250(res0->base, &conf->com1); break; case W83627HF_SP2: - res0 = get_resource(dev, PNP_IDX_IO0); + res0 = find_resource(dev, PNP_IDX_IO0); init_uart8250(res0->base, &conf->com2); break; case W83627HF_KBC: - res0 = get_resource(dev, PNP_IDX_IO0); - res1 = get_resource(dev, PNP_IDX_IO1); + res0 = find_resource(dev, PNP_IDX_IO0); + res1 = find_resource(dev, PNP_IDX_IO1); init_pc_keyboard(res0->base, res1->base, &conf->keyboard); break; } @@ -66,13 +66,13 @@ static struct pnp_info pnp_dev_info[] = { { &ops, W83627HF_HWM, PNP_IO0 | PNP_IRQ0, { 0xff8, 0 } }, }; -static void enumerate(struct chip *chip) +static void enable_dev(device_t dev) { - pnp_enumerate(chip, sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), - &pnp_ops, pnp_dev_info); + pnp_enable_device(dev, &pnp_ops, + sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); } -struct chip_control superio_winbond_w83627thf_control = { - .enumerate = enumerate, - .name = "Winbond w83627thf" +struct chip_operations superio_winbond_w83627thf_control = { + .enable_dev = enable_dev, + .name = "Winbond w83627thf" }; |