From 689634a3ea12418e1238d5df5c3c2131fae3ae1f Mon Sep 17 00:00:00 2001 From: Andrew Gallatin Date: Fri, 1 Dec 2000 15:27:48 +0000 Subject: [PATCH] Convert the pcib_{read,write}_config args from signed to unsigned, like the args to the config space accessors these functions replaced. This reduces the likelyhood of overflow when the args are used in macros on the alpha. This prevents memory management faults when probing the pci bus on sables, multias and nonames. Approved by: dfr Tested by: Bernd Walter --- sys/alpha/pci/apecs_pci.c | 8 ++++---- sys/alpha/pci/apecsvar.h | 4 ++-- sys/alpha/pci/cia_pci.c | 10 +++++----- sys/alpha/pci/irongate_pci.c | 8 ++++---- sys/alpha/pci/lca_pci.c | 8 ++++---- sys/alpha/pci/lcavar.h | 4 ++-- sys/alpha/pci/t2_pci.c | 8 ++++---- sys/alpha/pci/tsunami_pci.c | 8 ++++---- sys/dev/pci/pcib_if.m | 16 ++++++++-------- sys/pci/pcib_if.m | 16 ++++++++-------- 10 files changed, 45 insertions(+), 45 deletions(-) diff --git a/sys/alpha/pci/apecs_pci.c b/sys/alpha/pci/apecs_pci.c index d262013705f4..703011140076 100644 --- a/sys/alpha/pci/apecs_pci.c +++ b/sys/alpha/pci/apecs_pci.c @@ -134,8 +134,8 @@ apecs_pcib_maxslots(device_t dev) } while (0) u_int32_t -apecs_pcib_read_config(device_t dev, int b, int s, int f, - int reg, int width) +apecs_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, int width) { switch (width) { case 1: @@ -151,8 +151,8 @@ apecs_pcib_read_config(device_t dev, int b, int s, int f, } static void -apecs_pcib_write_config(device_t dev, int b, int s, int f, - int reg, u_int32_t val, int width) +apecs_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, u_int32_t val, int width) { switch (width) { case 1: diff --git a/sys/alpha/pci/apecsvar.h b/sys/alpha/pci/apecsvar.h index 56ade546aa62..2c6987edc54f 100644 --- a/sys/alpha/pci/apecsvar.h +++ b/sys/alpha/pci/apecsvar.h @@ -29,5 +29,5 @@ struct device; extern void apecs_init(void); -u_int32_t apecs_pcib_read_config(struct device *dev, int b, int s, int f, - int reg, int width); +u_int32_t apecs_pcib_read_config(struct device *dev, u_int b, u_int s, u_int f, + u_int reg, int width); diff --git a/sys/alpha/pci/cia_pci.c b/sys/alpha/pci/cia_pci.c index 1ccb6189c18f..aa09f410a593 100644 --- a/sys/alpha/pci/cia_pci.c +++ b/sys/alpha/pci/cia_pci.c @@ -298,7 +298,7 @@ cia_check_abort(void) } while (0) static u_int32_t -cia_pcib_swiz_read_config(int b, int s, int f, int reg, int width) +cia_pcib_swiz_read_config(u_int b, u_int s, u_int f, u_int reg, int width) { switch (width) { case 1: @@ -314,7 +314,7 @@ cia_pcib_swiz_read_config(int b, int s, int f, int reg, int width) } static void -cia_pcib_swiz_write_config(int b, int s, int f, int reg, +cia_pcib_swiz_write_config(u_int b, u_int s, u_int f, u_int reg, u_int32_t val, int width) { switch (width) { @@ -330,7 +330,7 @@ cia_pcib_swiz_write_config(int b, int s, int f, int reg, } static u_int32_t -cia_pcib_bwx_read_config(int b, int s, int f, int reg, int width) +cia_pcib_bwx_read_config(u_int b, u_int s, u_int f, u_int reg, int width) { switch (width) { case 1: @@ -346,8 +346,8 @@ cia_pcib_bwx_read_config(int b, int s, int f, int reg, int width) } static void -cia_pcib_bwx_write_config(int b, int s, int f, int reg, - u_int32_t val, int width) +cia_pcib_bwx_write_config(u_int b, u_int s, u_int f, u_int reg, + u_int32_t val, u_int width) { switch (width) { case 1: diff --git a/sys/alpha/pci/irongate_pci.c b/sys/alpha/pci/irongate_pci.c index 14278be9b032..00c90aa712cf 100644 --- a/sys/alpha/pci/irongate_pci.c +++ b/sys/alpha/pci/irongate_pci.c @@ -147,8 +147,8 @@ irongate_check_abort(void) } while (0) static u_int32_t -irongate_pcib_read_config(device_t dev, int b, int s, int f, - int reg, int width) +irongate_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, int width) { switch (width) { case 1: @@ -164,8 +164,8 @@ irongate_pcib_read_config(device_t dev, int b, int s, int f, } static void -irongate_pcib_write_config(device_t dev, int b, int s, int f, - int reg, u_int32_t val, int width) +irongate_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, u_int32_t val, int width) { switch (width) { case 1: diff --git a/sys/alpha/pci/lca_pci.c b/sys/alpha/pci/lca_pci.c index cd7ae9d63061..36ede70fc045 100644 --- a/sys/alpha/pci/lca_pci.c +++ b/sys/alpha/pci/lca_pci.c @@ -130,8 +130,8 @@ lca_pcib_maxslots(device_t dev) } while (0) u_int32_t -lca_pcib_read_config(device_t dev, int b, int s, int f, - int reg, int width) +lca_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, int width) { switch (width) { case 1: @@ -147,8 +147,8 @@ lca_pcib_read_config(device_t dev, int b, int s, int f, } static void -lca_pcib_write_config(device_t dev, int b, int s, int f, - int reg, u_int32_t val, int width) +lca_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, u_int32_t val, int width) { switch (width) { case 1: diff --git a/sys/alpha/pci/lcavar.h b/sys/alpha/pci/lcavar.h index 2f22adec0be6..ee53b755ffdd 100644 --- a/sys/alpha/pci/lcavar.h +++ b/sys/alpha/pci/lcavar.h @@ -29,5 +29,5 @@ struct device; extern void lca_init(void); -u_int32_t lca_pcib_read_config(struct device *dev, int b, int s, int f, - int reg, int width); +u_int32_t lca_pcib_read_config(struct device *dev, u_int b, u_int s, u_int f, + u_int reg, int width); diff --git a/sys/alpha/pci/t2_pci.c b/sys/alpha/pci/t2_pci.c index 687aa1791bba..4424ed978c57 100644 --- a/sys/alpha/pci/t2_pci.c +++ b/sys/alpha/pci/t2_pci.c @@ -136,8 +136,8 @@ t2_pcib_maxslots(device_t dev) } while (0) static u_int32_t -t2_pcib_read_config(device_t dev, int b, int s, int f, - int reg, int width) +t2_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, int width) { switch (width) { case 1: @@ -153,8 +153,8 @@ t2_pcib_read_config(device_t dev, int b, int s, int f, } static void -t2_pcib_write_config(device_t dev, int b, int s, int f, - int reg, u_int32_t val, int width) +t2_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, u_int32_t val, int width) { switch (width) { case 1: diff --git a/sys/alpha/pci/tsunami_pci.c b/sys/alpha/pci/tsunami_pci.c index cd392e1e1968..f4a190ba21e5 100644 --- a/sys/alpha/pci/tsunami_pci.c +++ b/sys/alpha/pci/tsunami_pci.c @@ -217,8 +217,8 @@ tsunami_check_abort(void) } while (0) static u_int32_t -tsunami_pcib_read_config(device_t dev, int b, int s, int f, - int reg, int width) +tsunami_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, int width) { int h = device_get_unit(dev); switch (width) { @@ -235,8 +235,8 @@ tsunami_pcib_read_config(device_t dev, int b, int s, int f, } static void -tsunami_pcib_write_config(device_t dev, int b, int s, int f, - int reg, u_int32_t val, int width) +tsunami_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, + u_int reg, u_int32_t val, int width) { int h = device_get_unit(dev); switch (width) { diff --git a/sys/dev/pci/pcib_if.m b/sys/dev/pci/pcib_if.m index 2b38ef791e58..5224778caab6 100644 --- a/sys/dev/pci/pcib_if.m +++ b/sys/dev/pci/pcib_if.m @@ -46,10 +46,10 @@ METHOD int maxslots { # METHOD u_int32_t read_config { device_t dev; - int bus; - int slot; - int func; - int reg; + u_int bus; + u_int slot; + u_int func; + u_int reg; int width; }; @@ -62,10 +62,10 @@ METHOD u_int32_t read_config { # METHOD void write_config { device_t dev; - int bus; - int slot; - int func; - int reg; + u_int bus; + u_int slot; + u_int func; + u_int reg; u_int32_t value; int width; }; diff --git a/sys/pci/pcib_if.m b/sys/pci/pcib_if.m index 2b38ef791e58..5224778caab6 100644 --- a/sys/pci/pcib_if.m +++ b/sys/pci/pcib_if.m @@ -46,10 +46,10 @@ METHOD int maxslots { # METHOD u_int32_t read_config { device_t dev; - int bus; - int slot; - int func; - int reg; + u_int bus; + u_int slot; + u_int func; + u_int reg; int width; }; @@ -62,10 +62,10 @@ METHOD u_int32_t read_config { # METHOD void write_config { device_t dev; - int bus; - int slot; - int func; - int reg; + u_int bus; + u_int slot; + u_int func; + u_int reg; u_int32_t value; int width; };