[LinuxBIOS] r327 - in LinuxBIOSv3: device lib
svn at openbios.org
svn at openbios.org
Sun May 20 01:55:26 CEST 2007
Author: stepan
Date: 2007-05-20 01:55:25 +0200 (Sun, 20 May 2007)
New Revision: 327
Modified:
LinuxBIOSv3/device/cardbus_device.c
LinuxBIOSv3/device/device_util.c
LinuxBIOSv3/device/hypertransport.c
LinuxBIOSv3/device/pci_device.c
LinuxBIOSv3/device/pciexp_device.c
LinuxBIOSv3/device/pcix_device.c
LinuxBIOSv3/device/pnp_device.c
LinuxBIOSv3/device/root_device.c
LinuxBIOSv3/device/smbus_ops.c
LinuxBIOSv3/lib/lzma.c
LinuxBIOSv3/lib/stage2.c
Log:
device code cleanup. this is the uncritical part of my device cleanup
patch. Most of it are printk_ cleanup fixes required for the v2->v3
transition, thus trivial.
Signed-off-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>
Modified: LinuxBIOSv3/device/cardbus_device.c
===================================================================
--- LinuxBIOSv3/device/cardbus_device.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/cardbus_device.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -172,7 +172,7 @@
/* Error check. */
ctrl |= (PCI_CB_BRIDGE_CTL_PARITY + PCI_CB_BRIDGE_CTL_SERR);
- printk_debug("%s bridge ctrl <- %04x\n", dev_path(dev), ctrl);
+ printk(BIOS_DEBUG, "%s bridge ctrl <- %04x\n", dev_path(dev), ctrl);
pci_write_config16(dev, PCI_BRIDGE_CONTROL, ctrl);
pci_dev_enable_resources(dev);
@@ -192,7 +192,7 @@
u32 buses;
u16 cr;
- printk_spew("%s for %s\n", __func__, dev_path(dev));
+ printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(dev));
bus = &dev->link[0];
bus->dev = dev;
@@ -238,7 +238,7 @@
pci_write_config32(dev, PCI_CB_PRIMARY_BUS, buses);
pci_write_config16(dev, PCI_COMMAND, cr);
- printk_spew("%s returns max %d\n", __func__, max);
+ printk(BIOS_SPEW, "%s returns max %d\n", __func__, max);
return max;
}
Modified: LinuxBIOSv3/device/device_util.c
===================================================================
--- LinuxBIOSv3/device/device_util.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/device_util.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -27,7 +27,6 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
-#include <stdlib.h>
#include <string.h>
/**
Modified: LinuxBIOSv3/device/hypertransport.c
===================================================================
--- LinuxBIOSv3/device/hypertransport.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/hypertransport.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -190,12 +190,11 @@
unsigned int new_freq;
pci_write_config8(cur->dev, cur->pos + cur->freq_off, freq);
reset_needed = 1;
- printk_spew("HyperT FreqP old %x new %x\n", old_freq, freq);
+ printk(BIOS_SPEW, "HyperT FreqP old %x new %x\n", old_freq, freq);
new_freq = pci_read_config8(cur->dev, cur->pos + cur->freq_off);
new_freq &= 0x0f;
if (new_freq != freq) {
- printk_err
- ("%s Hypertransport frequency would not set wanted: %x got: %x\n",
+ printk(BIOS_ERR, "%s Hypertransport frequency would not set wanted: %x got: %x\n",
dev_path(dev), freq, new_freq);
}
}
@@ -205,13 +204,12 @@
pci_write_config8(cur->dev, cur->pos + cur->config_off + 1,
present_width);
reset_needed = 1;
- printk_spew("HyperT widthP old %x new %x\n", old_width,
+ printk(BIOS_SPEW, "HyperT widthP old %x new %x\n", old_width,
present_width);
new_width =
pci_read_config8(cur->dev, cur->pos + cur->config_off + 1);
if (new_width != present_width) {
- printk_err
- ("%s Hypertransport width would not set wanted: %x got: %x\n",
+ printk(BIOS_ERR, "%s Hypertransport width would not set wanted: %x got: %x\n",
dev_path(dev), present_width, new_width);
}
}
@@ -223,13 +221,12 @@
unsigned int new_freq;
pci_write_config8(prev->dev, prev->pos + prev->freq_off, freq);
reset_needed = 1;
- printk_spew("HyperT freqU old %x new %x\n", old_freq, freq);
+ printk(BIOS_SPEW, "HyperT freqU old %x new %x\n", old_freq, freq);
new_freq =
pci_read_config8(prev->dev, prev->pos + prev->freq_off);
new_freq &= 0x0f;
if (new_freq != freq) {
- printk_err
- ("%s Hypertransport frequency would not set wanted: %x got: %x\n",
+ printk(BIOS_ERR, "%s Hypertransport frequency would not set wanted: %x got: %x\n",
dev_path(prev->dev), freq, new_freq);
}
}
@@ -240,14 +237,13 @@
pci_write_config8(prev->dev, prev->pos + prev->config_off + 1,
upstream_width);
reset_needed = 1;
- printk_spew("HyperT widthU old %x new %x\n", old_width,
+ printk(BIOS_SPEW, "HyperT widthU old %x new %x\n", old_width,
upstream_width);
new_width =
pci_read_config8(prev->dev,
prev->pos + prev->config_off + 1);
if (new_width != upstream_width) {
- printk_err
- ("%s Hypertransport width would not set wanted: %x got: %x\n",
+ printk(BIOS_ERR, "%s Hypertransport width would not set wanted: %x got: %x\n",
dev_path(prev->dev), upstream_width, new_width);
}
}
@@ -282,7 +278,7 @@
if (pos) {
unsigned int flags;
flags = pci_read_config16(dev, pos + PCI_CAP_FLAGS);
- printk_spew("Flags: 0x%04x\n", flags);
+ printk(BIOS_SPEW, "Flags: 0x%04x\n", flags);
if ((flags >> 13) == 0) {
/* Entry is a Slave secondary, success... */
break;
@@ -325,8 +321,7 @@
ctrl = pci_read_config16(prev.dev,
prev.pos + prev.ctrl_off);
if (ctrl & ((1 << 4) | (1 << 8))) {
- printk_alert
- ("Detected error on Hypertransport Link\n");
+ printk(BIOS_ALERT, "Detected error on Hypertransport Link\n");
return;
}
}
@@ -384,7 +379,7 @@
flags = pci_read_config16(&dummy, pos + PCI_CAP_FLAGS);
flags &= ~0x1f;
pci_write_config16(&dummy, pos + PCI_CAP_FLAGS, flags);
- printk_spew("Collapsing %s [%04x/%04x]\n",
+ printk(BIOS_SPEW, "Collapsing %s [%04x/%04x]\n",
dev_path(&dummy), dummy.vendor, dummy.device);
}
}
@@ -461,8 +456,7 @@
ctrl = pci_read_config16(prev.dev,
prev.pos + prev.ctrl_off);
if (ctrl & ((1 << 4) | (1 << 8))) {
- printk_alert
- ("Detected error on Hypertransport Link\n");
+ printk(BIOS_ALERT, "Detected error on Hypertransport Link\n");
goto end_of_chain;
}
}
@@ -480,8 +474,7 @@
/* Find the hypertransport link capability. */
pos = ht_lookup_slave_capability(dev);
if (pos == 0) {
- printk_err
- ("%s Hypertransport link capability not found",
+ printk(BIOS_ERR, "%s Hypertransport link capability not found",
dev_path(dev));
break;
}
@@ -513,7 +506,7 @@
/* Compute the number of unitids consumed. */
count = (flags >> 5) & 0x1f; /* Get unit count. */
- printk_spew("%s count: %04x static_count: %04x\n",
+ printk(BIOS_SPEW, "%s count: %04x static_count: %04x\n",
dev_path(dev), count, static_count);
if (count < static_count) {
count = static_count;
@@ -534,7 +527,7 @@
/* Setup the hypertransport link. */
bus->reset_needed |= ht_setup_link(&prev, dev, pos);
- printk_debug("%s [%04x/%04x] %s next_unitid: %04x\n",
+ printk(BIOS_DEBUG, "%s [%04x/%04x] %s next_unitid: %04x\n",
dev_path(dev),
dev->vendor, dev->device,
(dev->enabled ? "enabled" : "disabled"),
@@ -545,9 +538,9 @@
end_of_chain:
#if OPT_HT_LINK == 1
if (bus->reset_needed) {
- printk_info("HyperT reset needed\n");
+ printk(BIOS_INFO, "HyperT reset needed\n");
} else {
- printk_debug("HyperT reset not needed\n");
+ printk(BIOS_DEBUG, "HyperT reset not needed\n");
}
#endif
@@ -588,9 +581,9 @@
if (old_devices) {
struct device *left;
for (left = old_devices; left; left = left->sibling) {
- printk_debug("%s\n", dev_path(left));
+ printk(BIOS_DEBUG, "%s\n", dev_path(left));
}
- printk_err("HT: Left over static devices.\n");
+ printk(BIOS_ERR, "HT: Left over static devices.\n");
/* Put back the left over static device, and let
* pci_scan_bus() disable it.
*/
Modified: LinuxBIOSv3/device/pci_device.c
===================================================================
--- LinuxBIOSv3/device/pci_device.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/pci_device.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -605,7 +605,7 @@
command = pci_read_config16(dev, PCI_COMMAND);
command |= dev->command;
command |= (PCI_COMMAND_PARITY + PCI_COMMAND_SERR); // Error check.
- printk(BIOS_DEBUG, "%s: %s(%s) cmd <- %02x\n", __func__, dev->dtsname,
+ printk(BIOS_DEBUG, "%s: %s (%s) cmd <- %02x\n", __func__, dev->dtsname,
dev_path(dev), command);
pci_write_config16(dev, PCI_COMMAND, command);
}
@@ -1039,7 +1039,7 @@
#endif
old_devices = bus->children;
- printk(BIOS_DEBUG, "%s: old_devices %p, dev for this bus %p(%s)\n",
+ printk(BIOS_DEBUG, "%s: old_devices %p, dev for this bus %p (%s)\n",
__func__, old_devices, bus->dev, bus->dev->dtsname);
bus->children = 0;
Modified: LinuxBIOSv3/device/pciexp_device.c
===================================================================
--- LinuxBIOSv3/device/pciexp_device.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/pciexp_device.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -32,7 +32,7 @@
/* error... */
return;
}
- printk_debug("PCIEXP: tuning %s\n", dev_path(dev));
+ printk(BIOS_DEBUG, "PCIEXP: tuning %s\n", dev_path(dev));
#warning "IMPLEMENT PCI EXPRESS TUNING"
}
Modified: LinuxBIOSv3/device/pcix_device.c
===================================================================
--- LinuxBIOSv3/device/pcix_device.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/pcix_device.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -37,7 +37,7 @@
if (!cap) {
return;
}
- printk_debug("%s PCI-X tuning\n", dev_path(dev));
+ printk(BIOS_DEBUG, "%s PCI-X tuning\n", dev_path(dev));
status = pci_read_config32(dev, cap + PCI_X_STATUS);
orig_cmd = cmd = pci_read_config16(dev, cap + PCI_X_CMD);
@@ -129,7 +129,7 @@
}
/* Print the PCI-X bus speed. */
- printk_debug("PCI: %02x: %s\n", dev->link[0].secondary,
+ printk(BIOS_DEBUG, "PCI: %02x: %s\n", dev->link[0].secondary,
pcix_speed(sstatus));
return max;
Modified: LinuxBIOSv3/device/pnp_device.c
===================================================================
--- LinuxBIOSv3/device/pnp_device.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/pnp_device.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -23,9 +23,6 @@
#include <types.h>
#include <console.h>
-#include <stdlib.h>
-// #include <stdint.h>
-// #include <bitops.h>
#include <string.h>
#include <io.h>
#include <device/device.h>
Modified: LinuxBIOSv3/device/root_device.c
===================================================================
--- LinuxBIOSv3/device/root_device.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/root_device.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -108,7 +108,7 @@
struct device *child;
unsigned int link;
- printk(BIOS_INFO, "%s for %s(%s)\n", __func__, busdevice->dtsname,
+ printk(BIOS_INFO, "%s for %s (%s)\n", __func__, busdevice->dtsname,
dev_path(busdevice));
for (link = 0; link < busdevice->links; link++) {
Modified: LinuxBIOSv3/device/smbus_ops.c
===================================================================
--- LinuxBIOSv3/device/smbus_ops.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/device/smbus_ops.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -33,7 +33,7 @@
}
if (!pbus || !pbus->dev || !pbus->dev->ops
|| !pbus->dev->ops->ops_smbus_bus) {
- printk_alert("%s Cannot find smbus bus operations",
+ printk(BIOS_ALERT, "%s Cannot find smbus bus operations",
dev_path(dev));
die("");
}
@@ -56,9 +56,9 @@
pbus_a[pbus_num++] = pbus;
pbus = pbus->dev->bus;
}
-// printk_info("smbus_set_link: ");
+// printk(BIOS_INFO, "smbus_set_link: ");
for (i = pbus_num - 1; i >= 0; i--) {
-// printk_info(" %s[%d] -> ", dev_path(pbus_a[i]->dev), pbus_a[i]->link);
+// printk(BIOS_INFO, " %s[%d] -> ", dev_path(pbus_a[i]->dev), pbus_a[i]->link);
if (ops_smbus_bus(get_pbus_smbus(pbus_a[i]->dev))) {
if (pbus_a[i]->dev->ops
&& pbus_a[i]->dev->ops->set_link)
@@ -66,7 +66,7 @@
pbus_a[i]->link);
}
}
-// printk_info(" %s\n", dev_path(dev));
+// printk(BIOS_INFO, " %s\n", dev_path(dev));
return pbus_num;
}
Modified: LinuxBIOSv3/lib/lzma.c
===================================================================
--- LinuxBIOSv3/lib/lzma.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/lib/lzma.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -23,17 +23,17 @@
memcpy(properties, src, LZMA_PROPERTIES_SIZE);
outSize = *(UInt32 *)(src + LZMA_PROPERTIES_SIZE);
if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) {
- printk_warning("Incorrect stream properties\n");
+ printk(BIOS_WARNING, "Incorrect stream properties\n");
}
mallocneeds = (LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
if (mallocneeds > 15980) {
- printk_warning("Decoder scratchpad too small!\n");
+ printk(BIOS_WARNING, "Decoder scratchpad too small!\n");
}
state.Probs = (CProb *)scratchpad;
res = LzmaDecode(&state, src + LZMA_PROPERTIES_SIZE + 8, (SizeT)0xffffffff, &inProcessed,
dst, outSize, &outProcessed);
if (res != 0) {
- printk_warning("Decoding error = %d\n", res);
+ printk(BIOS_WARNING, "Decoding error = %d\n", res);
}
return outSize;
}
Modified: LinuxBIOSv3/lib/stage2.c
===================================================================
--- LinuxBIOSv3/lib/stage2.c 2007-05-19 21:31:23 UTC (rev 326)
+++ LinuxBIOSv3/lib/stage2.c 2007-05-19 23:55:25 UTC (rev 327)
@@ -43,7 +43,19 @@
{
/* TODO: Add comment. */
void show_all_devs(void);
+
+ static const char console_test[] =
+ "\n\nLinuxBIOS-"
+ LINUXBIOS_VERSION
+ LINUXBIOS_EXTRA_VERSION
+ " "
+ LINUXBIOS_BUILD
+ " booting...\n";
+
post_code(0x20);
+
+ printk(BIOS_NOTICE, console_test);
+
dev_init();
/* Console init, also ANYTHING that has to be done
@@ -53,12 +65,6 @@
dev_phase1();
show_all_devs();
-// printk_notice("LinuxBIOS-%s%s %s booting...\n",
-// linuxbios_version, linuxbios_extra_version, linuxbios_build);
-
-// printk_notice("LinuxBIOS-%s%s %s booting...\n",
-// linuxbios_version, linuxbios_extra_version, linuxbios_build);
-
/* Here is where weird stuff like init_timer handling should be
* done. This is for ANYTHING that might have to happen before
* device enumeration but that needs a printk.
More information about the coreboot
mailing list