static void
mpt_dump_sgl(SGE_IO_UNION *su)
{
	SGE_SIMPLE32 *se = (SGE_SIMPLE32 *) su;
	int iCount, flags;

	iCount = MPT_SGL_MAX;
	do {
		int iprt;

		printf("\t");
		flags = MPI_SGE_GET_FLAGS(le32toh(se->FlagsLength));
		switch (flags & MPI_SGE_FLAGS_ELEMENT_MASK) {
		case MPI_SGE_FLAGS_SIMPLE_ELEMENT:
		{
			printf("SE32 %p: Addr=0x%0x FlagsLength=0x%0x\n",
			    se, le32toh(se->Address), le32toh(se->FlagsLength));
			printf(" ");
			break;
		}
		case MPI_SGE_FLAGS_CHAIN_ELEMENT:
		{
			SGE_CHAIN32 *ce = (SGE_CHAIN32 *) se;
			printf("CE32 %p: Addr=0x%0x NxtChnO=0x%x Flgs=0x%x "
			    "Len=0x%0x\n", ce, le32toh(ce->Address),
			    ce->NextChainOffset, ce->Flags,
			    le16toh(ce->Length));
			flags = 0;
			break;
		}
		case MPI_SGE_FLAGS_TRANSACTION_ELEMENT:
			printf("TE32 @ %p\n", se);
			flags = 0;
			break;
		}
		iprt = 0;
#define MPT_PRINT_FLAG(x)						\
		if (flags & MPI_SGE_FLAGS_ ## x ) { 			\
			if (iprt == 0) {				\
				printf("\t");				\
			}						\
			printf(" ");					\
			printf( #x );					\
			iprt++;						\
		}
		MPT_PRINT_FLAG(LOCAL_ADDRESS);
		MPT_PRINT_FLAG(HOST_TO_IOC);
		MPT_PRINT_FLAG(64_BIT_ADDRESSING);
		MPT_PRINT_FLAG(LAST_ELEMENT);
		MPT_PRINT_FLAG(END_OF_BUFFER);
		MPT_PRINT_FLAG(END_OF_LIST);
#undef MPT_PRINT_FLAG
		if (iprt)
			printf("\n");
		se++;
		iCount -= 1;
	} while ((flags & MPI_SGE_FLAGS_END_OF_LIST) == 0 && iCount != 0);
}
Beispiel #2
0
void
mpt_dump_sgl(SGE_IO_UNION *su, int offset)
{
	SGE_SIMPLE32 *se = (SGE_SIMPLE32 *) su;
	const char allfox[4] = { 0xff, 0xff, 0xff, 0xff };
	void *nxtaddr = se;
	void *lim;
	int flags;

	/*
	 * Can't be any bigger than this.
	 */
	lim = &((char *)se)[MPT_REQUEST_AREA - offset];

	do {
		int iprt;

		printf("\t");
		if (memcmp(se, allfox, 4) == 0) {
			uint32_t *nxt = (uint32_t *)se;
			printf("PAD  %p\n", se);
			nxtaddr = nxt + 1;
			se = nxtaddr;
			flags = 0;
			continue;
		}
		nxtaddr = se + 1;
		flags = MPI_SGE_GET_FLAGS(se->FlagsLength);
		switch (flags & MPI_SGE_FLAGS_ELEMENT_MASK) {
		case MPI_SGE_FLAGS_SIMPLE_ELEMENT:
			if (flags & MPI_SGE_FLAGS_64_BIT_ADDRESSING) {
				SGE_SIMPLE64 *se64 = (SGE_SIMPLE64 *)se;
				printf("SE64 %p: Addr=0x%08x%08x FlagsLength"
				    "=0x%0x\n", se64, se64->Address.High,
				    se64->Address.Low, se64->FlagsLength);
				nxtaddr = se64 + 1;
			} else {
				printf("SE32 %p: Addr=0x%0x FlagsLength=0x%0x"
	                            "\n", se, se->Address, se->FlagsLength);
			}
			printf(" ");
			break;
		case MPI_SGE_FLAGS_CHAIN_ELEMENT:
			if (flags & MPI_SGE_FLAGS_64_BIT_ADDRESSING) {
				SGE_CHAIN64 *ce64 = (SGE_CHAIN64 *) se;
				printf("CE64 %p: Addr=0x%08x%08x NxtChnO=0x%x "
				    "Flgs=0x%x Len=0x%0x\n", ce64,
				    ce64->Address.High, ce64->Address.Low,
				    ce64->NextChainOffset,
				    ce64->Flags, ce64->Length);
				nxtaddr = ce64 + 1;
			} else {
				SGE_CHAIN32 *ce = (SGE_CHAIN32 *) se;
				printf("CE32 %p: Addr=0x%0x NxtChnO=0x%x "
				    " Flgs=0x%x Len=0x%0x\n", ce, ce->Address,
				    ce->NextChainOffset, ce->Flags, ce->Length);
			}
			flags = 0;
			break;
		case MPI_SGE_FLAGS_TRANSACTION_ELEMENT:
			printf("TE32 @ %p\n", se);
			flags = 0;
			break;
		}
		iprt = 0;
#define MPT_PRINT_FLAG(x)						\
		if (flags & MPI_SGE_FLAGS_ ## x ) { 			\
			if (iprt == 0) {				\
				printf("\t");				\
			}						\
			printf(" ");					\
			printf( #x );					\
			iprt++;						\
		}
		MPT_PRINT_FLAG(LOCAL_ADDRESS);
		MPT_PRINT_FLAG(HOST_TO_IOC);
		MPT_PRINT_FLAG(64_BIT_ADDRESSING);
		MPT_PRINT_FLAG(LAST_ELEMENT);
		MPT_PRINT_FLAG(END_OF_BUFFER);
		MPT_PRINT_FLAG(END_OF_LIST);
#undef MPT_PRINT_FLAG
		if (iprt)
			printf("\n");
		se = nxtaddr;
		if ((flags & LAST_SGE) == LAST_SGE) {
			break;
		}
	} while ((flags & MPI_SGE_FLAGS_END_OF_LIST) == 0 && nxtaddr < lim);
}