From a69d978be8a068944466e776de87527fb104a878 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Mon, 15 Nov 2010 19:35:14 +0000 Subject: C and other Super I/O cosmetic fixes. - Random coding style, whitespace and cosmetic fixes. - Consistently use the same spacing and 4-hexdigit port number format in the pnp_dev_info[] arrays. - Drop dead/unused code and less useful comments. - Add missing "(C)" characters and copyright years. - Shorten and simplify some code snippets. - Use u8/u16/etc. everywhere. Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6073 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/superio/nsc/pc87417/Makefile.inc | 2 +- src/superio/nsc/pc87417/pc87417.h | 4 ++-- src/superio/nsc/pc87417/pc87417_early_init.c | 21 ++++++++-------- src/superio/nsc/pc87417/pc87417_early_serial.c | 4 ++-- src/superio/nsc/pc87417/superio.c | 33 ++++++++++++-------------- 5 files changed, 30 insertions(+), 34 deletions(-) (limited to 'src/superio/nsc/pc87417') diff --git a/src/superio/nsc/pc87417/Makefile.inc b/src/superio/nsc/pc87417/Makefile.inc index d1236155ff..3da2f1720d 100644 --- a/src/superio/nsc/pc87417/Makefile.inc +++ b/src/superio/nsc/pc87417/Makefile.inc @@ -20,5 +20,5 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## -#config chip.h ramstage-$(CONFIG_SUPERIO_NSC_PC87417) += superio.c + diff --git a/src/superio/nsc/pc87417/pc87417.h b/src/superio/nsc/pc87417/pc87417.h index c2051f6a75..e24084cafa 100644 --- a/src/superio/nsc/pc87417/pc87417.h +++ b/src/superio/nsc/pc87417/pc87417.h @@ -3,7 +3,7 @@ * * Copyright (C) 2000 AG Electronics Ltd. * Copyright (C) 2003-2004 Linux Networx - * Copyright (C) 2004 Tyan by yhlu + * Copyright (C) 2004 Tyan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,7 +115,7 @@ #define PC87417_XWBCNF 0x16 #if defined(__PRE_RAM__) && !defined(__ROMCC__) -void pc87417_enable_serial(device_t dev, unsigned iobase); +void pc87417_enable_serial(device_t dev, u16 iobase); void pc87417_enable_dev(device_t dev); #endif diff --git a/src/superio/nsc/pc87417/pc87417_early_init.c b/src/superio/nsc/pc87417/pc87417_early_init.c index c9332eedbe..a635beb61d 100644 --- a/src/superio/nsc/pc87417/pc87417_early_init.c +++ b/src/superio/nsc/pc87417/pc87417_early_init.c @@ -3,7 +3,7 @@ * * Copyright (C) 2000 AG Electronics Ltd. * Copyright (C) 2003-2004 Linux Networx - * Copyright (C) 2004 Tyan by yhlu + * Copyright (C) 2004 Tyan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ static void pc87417_disable_dev(device_t dev) pnp_set_enable(dev, 0); } -static void pc87417_enable_dev(device_t dev, unsigned iobase) +static void pc87417_enable_dev(device_t dev, u16 iobase) { pnp_set_logical_device(dev); pnp_set_enable(dev, 0); @@ -39,17 +39,16 @@ static void pc87417_enable_dev(device_t dev, unsigned iobase) static void xbus_cfg(device_t dev) { - uint8_t i, data; - uint16_t xbus_index; + u8 i, data; + u16 xbus_index; pnp_set_logical_device(dev); - /* select proper BIOS size (4MB) */ - pnp_write_config(dev, PC87417_XMEMCNF2, (pnp_read_config(dev, PC87417_XMEMCNF2)) | 0x04); + /* Select proper BIOS size (4MB). */ + pnp_write_config(dev, PC87417_XMEMCNF2, + (pnp_read_config(dev, PC87417_XMEMCNF2)) | 0x04); xbus_index = pnp_read_iobase(dev, 0x60); - /* enable writes to devices attached to XCS0 (XBUS Chip Select 0) */ - for (i=0; i<= 0xf; i++) { - outb((i<<4), xbus_index + PC87417_HAP0); - } - return; + /* Enable writes to devices attached to XCS0 (XBUS Chip Select 0). */ + for (i = 0; i <= 0xf; i++) + outb((i << 4), xbus_index + PC87417_HAP0); } diff --git a/src/superio/nsc/pc87417/pc87417_early_serial.c b/src/superio/nsc/pc87417/pc87417_early_serial.c index 8d748046c6..c30d9487a8 100644 --- a/src/superio/nsc/pc87417/pc87417_early_serial.c +++ b/src/superio/nsc/pc87417/pc87417_early_serial.c @@ -3,7 +3,7 @@ * * Copyright (C) 2000 AG Electronics Ltd. * Copyright (C) 2003-2004 Linux Networx - * Copyright (C) 2004 Tyan by yhlu + * Copyright (C) 2004 Tyan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ #include #include "pc87417.h" -void pc87417_enable_serial(device_t dev, unsigned iobase) +void pc87417_enable_serial(device_t dev, u16 iobase) { pnp_set_logical_device(dev); pnp_set_enable(dev, 0); diff --git a/src/superio/nsc/pc87417/superio.c b/src/superio/nsc/pc87417/superio.c index 1eee9595bf..fede61e6bd 100644 --- a/src/superio/nsc/pc87417/superio.c +++ b/src/superio/nsc/pc87417/superio.c @@ -3,7 +3,7 @@ * * Copyright (C) 2000 AG Electronics Ltd. * Copyright (C) 2003-2004 Linux Networx - * Copyright (C) 2004 Tyan by yhlu + * Copyright (C) 2004 Tyan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,15 +34,12 @@ static void init(device_t dev) { - struct superio_nsc_pc87417_config *conf; + struct superio_nsc_pc87417_config *conf = dev->chip_info; struct resource *res0; - /* Wishlist handle well known programming interfaces more - * generically. - */ - if (!dev->enabled) { + + if (!dev->enabled) return; - } - conf = dev->chip_info; + switch(dev->path.pnp.device) { case PC87417_SP1: res0 = find_resource(dev, PNP_IDX_IO0); @@ -67,16 +64,16 @@ static struct device_operations ops = { }; static struct pnp_info pnp_dev_info[] = { - { &ops, PC87417_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07fa, 0}, }, - { &ops, PC87417_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x04f8, 0}, }, - { &ops, PC87417_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, }, - { &ops, PC87417_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, }, - { &ops, PC87417_SWC, PNP_IO0 | PNP_IRQ0, { 0xfff0, 0 }, }, - { &ops, PC87417_KBCM, PNP_IRQ0 }, - { &ops, PC87417_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7f8, 0 }, { 0x7f8, 0x4}, }, - { &ops, PC87417_GPIO, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } }, - { &ops, PC87417_XBUS, PNP_IO0 | PNP_IRQ0, { 0xffe0, 0 } }, - { &ops, PC87417_RTC, PNP_IO0 | PNP_IO1, { 0xfffe, 0 }, {0xfffe, 0x4} }, + { &ops, PC87417_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, }, + { &ops, PC87417_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, }, + { &ops, PC87417_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, }, + { &ops, PC87417_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, + { &ops, PC87417_SWC, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, }, + { &ops, PC87417_KBCM, PNP_IRQ0, }, + { &ops, PC87417_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, }, + { &ops, PC87417_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, }, + { &ops, PC87417_XBUS, PNP_IO0 | PNP_IRQ0, {0xffe0, 0}, }, + { &ops, PC87417_RTC, PNP_IO0 | PNP_IO1, {0xfffe, 0}, {0xfffe, 4}, }, }; static void enable_dev(struct device *dev) -- cgit v1.2.3