Added some commnets.

Changed valid slot numbers from 0-7 to 1-8.
Reset (leave) setup-mode for slot after reading POS data.

svn path=/trunk/; revision=3602
This commit is contained in:
Eric Kohl 2002-10-03 09:11:00 +00:00
parent 5073fe8a33
commit df43e0e3f8

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: mca.c,v 1.1 2002/10/02 19:32:57 ekohl Exp $
/* $Id: mca.c,v 1.2 2002/10/03 09:11:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -25,6 +25,11 @@
* PROGRAMMER: Eric Kohl (ekohl@rz-online.de)
*/
/*
* TODO:
* What Adapter ID is read from an empty slot?
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
@ -52,11 +57,15 @@ HalpGetMicroChannelData(PBUS_HANDLER BusHandler,
DPRINT(" Offset 0x%lx\n", Offset);
DPRINT(" Length 0x%lx\n", Length);
if ((BusNumber != 0) || (SlotNumber > 7) || (Length < sizeof(CM_MCA_POS_DATA)))
if ((BusNumber != 0) ||
(SlotNumber == 0) || (SlotNumber > 8) ||
(Length < sizeof(CM_MCA_POS_DATA)))
return(0);
WRITE_PORT_UCHAR((PUCHAR)0x96, ((UCHAR)SlotNumber & 0x07) | 0x08);
/* Enter Setup-Mode for given slot */
WRITE_PORT_UCHAR((PUCHAR)0x96, ((UCHAR)(SlotNumber - 1) & 0x07) | 0x08);
/* Read POS data */
PosData->AdapterId = (READ_PORT_UCHAR((PUCHAR)0x101) << 8) +
READ_PORT_UCHAR((PUCHAR)0x100);
PosData->PosData1 = READ_PORT_UCHAR((PUCHAR)0x102);
@ -64,6 +73,9 @@ HalpGetMicroChannelData(PBUS_HANDLER BusHandler,
PosData->PosData3 = READ_PORT_UCHAR((PUCHAR)0x104);
PosData->PosData4 = READ_PORT_UCHAR((PUCHAR)0x105);
/* Leave Setup-Mode for given slot */
WRITE_PORT_UCHAR((PUCHAR)0x96, (UCHAR)(SlotNumber - 1) & 0x07);
return(sizeof(CM_MCA_POS_DATA));
}