Print this page
XXXX introduce drv_sectohz


 178  */
 179 static int
 180 kcs_start_write(struct ipmi_softc *sc)
 181 {
 182         int retry, status;
 183 
 184         for (retry = 0; retry < 10; retry++) {
 185                 /* Wait for IBF = 0 */
 186                 status = kcs_wait_for_ibf(sc, 0);
 187 
 188                 /* Clear OBF */
 189                 kcs_clear_obf(sc, status);
 190 
 191                 /* Write start to command */
 192                 OUTB(sc, KCS_CTL_STS, KCS_CONTROL_WRITE_START);
 193 
 194                 /* Wait for IBF = 0 */
 195                 status = kcs_wait_for_ibf(sc, 0);
 196                 if (KCS_STATUS_STATE(status) == KCS_STATUS_STATE_WRITE)
 197                         break;
 198                 delay(drv_usectohz(1000000));
 199         }
 200 
 201         if (KCS_STATUS_STATE(status) != KCS_STATUS_STATE_WRITE)
 202                 /* error state */
 203                 return (0);
 204 
 205         /* Clear OBF */
 206         kcs_clear_obf(sc, status);
 207 
 208         return (1);
 209 }
 210 
 211 /*
 212  * Write a byte of the request message, excluding the last byte of the
 213  * message which requires special handling.
 214  */
 215 static int
 216 kcs_write_byte(struct ipmi_softc *sc, uchar_t data)
 217 {
 218         int status;




 178  */
 179 static int
 180 kcs_start_write(struct ipmi_softc *sc)
 181 {
 182         int retry, status;
 183 
 184         for (retry = 0; retry < 10; retry++) {
 185                 /* Wait for IBF = 0 */
 186                 status = kcs_wait_for_ibf(sc, 0);
 187 
 188                 /* Clear OBF */
 189                 kcs_clear_obf(sc, status);
 190 
 191                 /* Write start to command */
 192                 OUTB(sc, KCS_CTL_STS, KCS_CONTROL_WRITE_START);
 193 
 194                 /* Wait for IBF = 0 */
 195                 status = kcs_wait_for_ibf(sc, 0);
 196                 if (KCS_STATUS_STATE(status) == KCS_STATUS_STATE_WRITE)
 197                         break;
 198                 delay(drv_sectohz(1));
 199         }
 200 
 201         if (KCS_STATUS_STATE(status) != KCS_STATUS_STATE_WRITE)
 202                 /* error state */
 203                 return (0);
 204 
 205         /* Clear OBF */
 206         kcs_clear_obf(sc, status);
 207 
 208         return (1);
 209 }
 210 
 211 /*
 212  * Write a byte of the request message, excluding the last byte of the
 213  * message which requires special handling.
 214  */
 215 static int
 216 kcs_write_byte(struct ipmi_softc *sc, uchar_t data)
 217 {
 218         int status;