aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/ibmphp_hpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_hpc.c')
-rw-r--r--drivers/pci/hotplug/ibmphp_hpc.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c
index d680bb472c7b..c3ac98a0a6a6 100644
--- a/drivers/pci/hotplug/ibmphp_hpc.c
+++ b/drivers/pci/hotplug/ibmphp_hpc.c
@@ -38,7 +38,7 @@
38 38
39#include "ibmphp.h" 39#include "ibmphp.h"
40 40
41static int to_debug = FALSE; 41static int to_debug = 0;
42#define debug_polling(fmt, arg...) do { if (to_debug) debug (fmt, arg); } while (0) 42#define debug_polling(fmt, arg...) do { if (to_debug) debug (fmt, arg); } while (0)
43 43
44//---------------------------------------------------------------------------- 44//----------------------------------------------------------------------------
@@ -95,8 +95,8 @@ static int to_debug = FALSE;
95//---------------------------------------------------------------------------- 95//----------------------------------------------------------------------------
96// macro utilities 96// macro utilities
97//---------------------------------------------------------------------------- 97//----------------------------------------------------------------------------
98// if bits 20,22,25,26,27,29,30 are OFF return TRUE 98// if bits 20,22,25,26,27,29,30 are OFF return 1
99#define HPC_I2CSTATUS_CHECK(s) ((u8)((s & 0x00000A76) ? FALSE : TRUE)) 99#define HPC_I2CSTATUS_CHECK(s) ((u8)((s & 0x00000A76) ? 0 : 1))
100 100
101//---------------------------------------------------------------------------- 101//----------------------------------------------------------------------------
102// global variables 102// global variables
@@ -136,8 +136,8 @@ void __init ibmphp_hpc_initvars (void)
136 mutex_init(&sem_hpcaccess); 136 mutex_init(&sem_hpcaccess);
137 init_MUTEX (&semOperations); 137 init_MUTEX (&semOperations);
138 init_MUTEX_LOCKED (&sem_exit); 138 init_MUTEX_LOCKED (&sem_exit);
139 to_debug = FALSE; 139 to_debug = 0;
140 ibmphp_shutdown = FALSE; 140 ibmphp_shutdown = 0;
141 tid_poll = 0; 141 tid_poll = 0;
142 142
143 debug ("%s - Exit\n", __FUNCTION__); 143 debug ("%s - Exit\n", __FUNCTION__);
@@ -739,21 +739,21 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
739 // check controller is still not working on the command 739 // check controller is still not working on the command
740 //-------------------------------------------------------------------- 740 //--------------------------------------------------------------------
741 timeout = CMD_COMPLETE_TOUT_SEC; 741 timeout = CMD_COMPLETE_TOUT_SEC;
742 done = FALSE; 742 done = 0;
743 while (!done) { 743 while (!done) {
744 rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, 744 rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar,
745 &status); 745 &status);
746 if (!rc) { 746 if (!rc) {
747 if (NEEDTOCHECK_CMDSTATUS (cmd)) { 747 if (NEEDTOCHECK_CMDSTATUS (cmd)) {
748 if (CTLR_FINISHED (status) == HPC_CTLR_FINISHED_YES) 748 if (CTLR_FINISHED (status) == HPC_CTLR_FINISHED_YES)
749 done = TRUE; 749 done = 1;
750 } else 750 } else
751 done = TRUE; 751 done = 1;
752 } 752 }
753 if (!done) { 753 if (!done) {
754 msleep(1000); 754 msleep(1000);
755 if (timeout < 1) { 755 if (timeout < 1) {
756 done = TRUE; 756 done = 1;
757 err ("%s - Error command complete timeout\n", __FUNCTION__); 757 err ("%s - Error command complete timeout\n", __FUNCTION__);
758 rc = -EFAULT; 758 rc = -EFAULT;
759 } else 759 } else
@@ -799,7 +799,7 @@ void free_hpc_access (void)
799void ibmphp_lock_operations (void) 799void ibmphp_lock_operations (void)
800{ 800{
801 down (&semOperations); 801 down (&semOperations);
802 to_debug = TRUE; 802 to_debug = 1;
803} 803}
804 804
805/*---------------------------------------------------------------------- 805/*----------------------------------------------------------------------
@@ -809,7 +809,7 @@ void ibmphp_unlock_operations (void)
809{ 809{
810 debug ("%s - Entry\n", __FUNCTION__); 810 debug ("%s - Entry\n", __FUNCTION__);
811 up (&semOperations); 811 up (&semOperations);
812 to_debug = FALSE; 812 to_debug = 0;
813 debug ("%s - Exit\n", __FUNCTION__); 813 debug ("%s - Exit\n", __FUNCTION__);
814} 814}
815 815
@@ -937,40 +937,40 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
937{ 937{
938 u8 status; 938 u8 status;
939 int rc = 0; 939 int rc = 0;
940 u8 disable = FALSE; 940 u8 disable = 0;
941 u8 update = FALSE; 941 u8 update = 0;
942 942
943 debug ("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n", pslot, poldslot); 943 debug ("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n", pslot, poldslot);
944 944
945 // bit 0 - HPC_SLOT_POWER 945 // bit 0 - HPC_SLOT_POWER
946 if ((pslot->status & 0x01) != (poldslot->status & 0x01)) 946 if ((pslot->status & 0x01) != (poldslot->status & 0x01))
947 update = TRUE; 947 update = 1;
948 948
949 // bit 1 - HPC_SLOT_CONNECT 949 // bit 1 - HPC_SLOT_CONNECT
950 // ignore 950 // ignore
951 951
952 // bit 2 - HPC_SLOT_ATTN 952 // bit 2 - HPC_SLOT_ATTN
953 if ((pslot->status & 0x04) != (poldslot->status & 0x04)) 953 if ((pslot->status & 0x04) != (poldslot->status & 0x04))
954 update = TRUE; 954 update = 1;
955 955
956 // bit 3 - HPC_SLOT_PRSNT2 956 // bit 3 - HPC_SLOT_PRSNT2
957 // bit 4 - HPC_SLOT_PRSNT1 957 // bit 4 - HPC_SLOT_PRSNT1
958 if (((pslot->status & 0x08) != (poldslot->status & 0x08)) 958 if (((pslot->status & 0x08) != (poldslot->status & 0x08))
959 || ((pslot->status & 0x10) != (poldslot->status & 0x10))) 959 || ((pslot->status & 0x10) != (poldslot->status & 0x10)))
960 update = TRUE; 960 update = 1;
961 961
962 // bit 5 - HPC_SLOT_PWRGD 962 // bit 5 - HPC_SLOT_PWRGD
963 if ((pslot->status & 0x20) != (poldslot->status & 0x20)) 963 if ((pslot->status & 0x20) != (poldslot->status & 0x20))
964 // OFF -> ON: ignore, ON -> OFF: disable slot 964 // OFF -> ON: ignore, ON -> OFF: disable slot
965 if ((poldslot->status & 0x20) && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) 965 if ((poldslot->status & 0x20) && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status)))
966 disable = TRUE; 966 disable = 1;
967 967
968 // bit 6 - HPC_SLOT_BUS_SPEED 968 // bit 6 - HPC_SLOT_BUS_SPEED
969 // ignore 969 // ignore
970 970
971 // bit 7 - HPC_SLOT_LATCH 971 // bit 7 - HPC_SLOT_LATCH
972 if ((pslot->status & 0x80) != (poldslot->status & 0x80)) { 972 if ((pslot->status & 0x80) != (poldslot->status & 0x80)) {
973 update = TRUE; 973 update = 1;
974 // OPEN -> CLOSE 974 // OPEN -> CLOSE
975 if (pslot->status & 0x80) { 975 if (pslot->status & 0x80) {
976 if (SLOT_PWRGD (pslot->status)) { 976 if (SLOT_PWRGD (pslot->status)) {
@@ -979,7 +979,7 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
979 msleep(1000); 979 msleep(1000);
980 rc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &status); 980 rc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &status);
981 if (SLOT_PWRGD (status)) 981 if (SLOT_PWRGD (status))
982 update = TRUE; 982 update = 1;
983 else // overwrite power in pslot to OFF 983 else // overwrite power in pslot to OFF
984 pslot->status &= ~HPC_SLOT_POWER; 984 pslot->status &= ~HPC_SLOT_POWER;
985 } 985 }
@@ -987,17 +987,17 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
987 // CLOSE -> OPEN 987 // CLOSE -> OPEN
988 else if ((SLOT_PWRGD (poldslot->status) == HPC_SLOT_PWRGD_GOOD) 988 else if ((SLOT_PWRGD (poldslot->status) == HPC_SLOT_PWRGD_GOOD)
989 && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) { 989 && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) {
990 disable = TRUE; 990 disable = 1;
991 } 991 }
992 // else - ignore 992 // else - ignore
993 } 993 }
994 // bit 4 - HPC_SLOT_BLINK_ATTN 994 // bit 4 - HPC_SLOT_BLINK_ATTN
995 if ((pslot->ext_status & 0x08) != (poldslot->ext_status & 0x08)) 995 if ((pslot->ext_status & 0x08) != (poldslot->ext_status & 0x08))
996 update = TRUE; 996 update = 1;
997 997
998 if (disable) { 998 if (disable) {
999 debug ("process_changeinstatus - disable slot\n"); 999 debug ("process_changeinstatus - disable slot\n");
1000 pslot->flag = FALSE; 1000 pslot->flag = 0;
1001 rc = ibmphp_do_disable_slot (pslot); 1001 rc = ibmphp_do_disable_slot (pslot);
1002 } 1002 }
1003 1003
@@ -1102,7 +1102,7 @@ void __exit ibmphp_hpc_stop_poll_thread (void)
1102{ 1102{
1103 debug ("%s - Entry\n", __FUNCTION__); 1103 debug ("%s - Entry\n", __FUNCTION__);
1104 1104
1105 ibmphp_shutdown = TRUE; 1105 ibmphp_shutdown = 1;
1106 debug ("before locking operations \n"); 1106 debug ("before locking operations \n");
1107 ibmphp_lock_operations (); 1107 ibmphp_lock_operations ();
1108 debug ("after locking operations \n"); 1108 debug ("after locking operations \n");
@@ -1136,7 +1136,7 @@ static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, v
1136 u8 * pstatus) 1136 u8 * pstatus)
1137{ 1137{
1138 int rc = 0; 1138 int rc = 0;
1139 u8 done = FALSE; 1139 u8 done = 0;
1140 1140
1141 debug_polling ("hpc_wait_ctlr_notworking - Entry timeout[%d]\n", timeout); 1141 debug_polling ("hpc_wait_ctlr_notworking - Entry timeout[%d]\n", timeout);
1142 1142
@@ -1144,14 +1144,14 @@ static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, v
1144 *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, WPG_CTLR_INDEX); 1144 *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, WPG_CTLR_INDEX);
1145 if (*pstatus == HPC_ERROR) { 1145 if (*pstatus == HPC_ERROR) {
1146 rc = HPC_ERROR; 1146 rc = HPC_ERROR;
1147 done = TRUE; 1147 done = 1;
1148 } 1148 }
1149 if (CTLR_WORKING (*pstatus) == HPC_CTLR_WORKING_NO) 1149 if (CTLR_WORKING (*pstatus) == HPC_CTLR_WORKING_NO)
1150 done = TRUE; 1150 done = 1;
1151 if (!done) { 1151 if (!done) {
1152 msleep(1000); 1152 msleep(1000);
1153 if (timeout < 1) { 1153 if (timeout < 1) {
1154 done = TRUE; 1154 done = 1;
1155 err ("HPCreadslot - Error ctlr timeout\n"); 1155 err ("HPCreadslot - Error ctlr timeout\n");
1156 rc = HPC_ERROR; 1156 rc = HPC_ERROR;
1157 } else 1157 } else