--- linux-2.6.23.14/drivers/char/moxa.c 2008-01-14 21:49:56.000000000 +0100 +++ linux/drivers/char/moxa.c 2008-01-20 18:30:15.000000000 +0100 @@ -109,6 +109,8 @@ int busType; int loadstat; + unsigned short busNum; + unsigned short devNum; void __iomem *basemem; void __iomem *intNdx; @@ -116,6 +118,16 @@ void __iomem *intTable; } moxa_boards[MAX_BOARDS]; +/* Used by userspace application moxaload (firmware download) */ +static struct moxa_board_info { + int boardType; + int numPorts; + unsigned long baseAddr; + int busType; + unsigned short busNum; + unsigned short devNum; +} moxa_board_info[MAX_BOARDS]; + struct mxser_mstatus { tcflag_t cflag; int cts; @@ -304,6 +316,9 @@ goto err; board->boardType = board_type; + board->baseAddr = pci_resource_start(pdev, 2); + board->busNum = pdev->bus->number; + board->devNum = PCI_SLOT(pdev->devfn); switch (board_type) { case MOXA_BOARD_C218_ISA: case MOXA_BOARD_C218_PCI: @@ -1494,8 +1509,16 @@ } switch (cmd) { case MOXA_GET_CONF: - if(copy_to_user(argp, &moxa_boards, MAX_BOARDS * - sizeof(struct moxa_board_conf))) + for (i = 0; i < MAX_BOARDS; i++) { + moxa_board_info[i].boardType = moxa_boards[i].boardType; + moxa_board_info[i].numPorts = moxa_boards[i].numPorts; + moxa_board_info[i].baseAddr = moxa_boards[i].baseAddr; + moxa_board_info[i].busType = moxa_boards[i].busType; + moxa_board_info[i].busNum = moxa_boards[i].busNum; + moxa_board_info[i].devNum = moxa_boards[i].devNum; + } + if(copy_to_user(argp, &moxa_board_info, MAX_BOARDS * + sizeof(struct moxa_board_info))) return -EFAULT; return (0); case MOXA_INIT_DRIVER: