2010-10-04 03:05:03     ioctl() in 2010R1-RC1

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-10-04 03:05:03     ioctl() in 2010R1-RC1

Kay Duenzer (GERMANY)

Message: 94157   

 

Hello,

 

the last days I've tried to update the running 2009R1 system to 2010R1-RC1 on a BF561 based board. Now it seems that the ioctl() Function on all character devices isn't called correctly anymore. For example I'm using the build-in corebld to load and start a small program for Core B. Corebld uses an Ioctl on the driver coreb.c to start core B, but this is not called correctly. To see what happens I did put a printk in the Ioctl function:

 

 

 

static long

coreb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)

{

    int ret = 0;

 

    printk( "coreb.c: ioctl() called\n" );

 

    switch (cmd) {

    case CMD_COREB_START:

        bfin_write_SICA_SYSCR(bfin_read_SICA_SYSCR() & ~0x0020);

        break;

    case CMD_COREB_STOP:

        bfin_write_SICA_SYSCR(bfin_read_SICA_SYSCR() | 0x0020);

        bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | 0x0080);

        break;

    case CMD_COREB_RESET:

        bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | 0x0080);

        break;

    default:

        ret = -EINVAL;

        break;

    }

 

    CSYNC();

 

    return ret;

}

  

 

The output is this:

 

## Booting image at 01000000 ...

   Image Name:   bf561-2.6.34.7-ADI-2010R1

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    2383121 Bytes =  2.3 MB

   Load Address: 00001000

   Entry Point:  001a22b8

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 1a22b8

Linux version 2.6.34.7-ADI-2010R1 (duenzer@dunke-x2-linux) (gcc version 4.3.5 (ADI-2010R1-RC3) ) #8 Mon Oct 4 08:32:14 CEST 2010

register early platform devices

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Board Memory: 32MB

Kernel Managed Memory: 32MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x00111190

  rodata    = 0x00111190-0x00171b08

  bss       = 0x00172000-0x001857b4

  data      = 0x001857b4-0x00198000

    stack   = 0x00196000-0x00198000

  init      = 0x00198000-0x004ea000

  available = 0x004ea000-0x01f00000

  DMA Zone  = 0x01f00000-0x02000000

Hardware Trace Active and Enabled

Boot Mode: 6

Blackfin support (C) 2004-2010 Analog Devices, Inc.

Compiled for ADSP-BF561 Rev 0.5

Blackfin Linux support by   blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 100 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

  External memory: cacheable in instruction cache

  L2 SRAM        : uncacheable in instruction cache

Data Cache Enabled for CPU0

  External memory: cacheable (write-through) in data cache

  L2 SRAM        : uncacheable in data cache

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 7874

Kernel command line: root=/dev/mtdblock0 rw earlyprintk=serial,uart0,57600 console=ttyBF0,57600

PID hash table entries: 128 (order: -3, 512 bytes)

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory available: 26424k/32768k RAM, (3400k init code, 1088k kernel code, 540k data, 1024k dma, 292k reserved)

Hierarchical RCU implementation.

NR_IRQS:153

Configuring Blackfin Priority Driven Interrupts

console [ttyBF0] enabled, bootconsole disabled

console [ttyBF0] enabled, bootconsole disabled

Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (16 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 16 KB (4 KB free)

Blackfin L2 SRAM: 128 KB (128 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

ezkit_init(): registering device resources

bio: create slab <bio-0> at 0

Switching to clocksource bfin_cs_cycles

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

NET: Registered protocol family 1

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

RPC: Registered tcp NFSv4.1 backchannel transport module.

coreb.c: init() called

msgmni has been set to 51

io scheduler noop registered (default)

bfin-uart: Blackfin serial driver

bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 35) is a BFIN-UART

brd: module loaded

smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@fluxnic.net>

eth0: SMC91C11xFD (rev 2) at 2c010300 IRQ 82 [nowait]

eth0: Ethernet addr: 00:09:ba:06:00:12

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

dma_alloc_init: dma_page @ 0x01509000 - 256 pages at 0x01f00000

Freeing unused kernel memory: 3400k freed

eth0: link down

eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

writing to 0xff400000, 0x8ac     bytes: OK

writing to 0xff600000, 0x20e8    bytes: OK

 

 

BusyBox v1.16.2 (2010-10-04 08:17:20 CEST) hush - the humble shell

 

root:/>

 

 

 

This behaviour can be seen on all device drivers which include an Ioctl function. What am I doing wrong? As mentioned on 2009R1 it worked without any problems.

 

Kay

TranslateQuoteReplyEditDelete

 

 

2010-10-06 02:33:32     Re: ioctl() in 2010R1-RC1

Mike Frysinger (UNITED STATES)

Message: 94213   

 

ioctls work fine.  if they didnt, your system wouldnt even really get userspace to a usable state.

 

run corebld through strace and you'll see the real problem -- ioctl request collision.  changing the request numbers to something else works fine.

 

dont know what you mean by "all device drivers".  guessing you're still just using the wrong ioctl request number.

 

ive fixed the coreb driver and corebld userspace app in the 2009R1+ branches.

QuoteReplyEditDelete

 

 

2010-10-06 04:02:08     Re: ioctl() in 2010R1-RC1

Kay Duenzer (GERMANY)

Message: 94245   

 

Thanks a lot, its works now. I've modified the define in corebld.c from

 

#define CMD_COREB_START 2

 

to

 

#define CMD_COREB_START 3

 

and in coreb.c the lines

 

#define CMD_COREB_START        2

#define CMD_COREB_STOP        3

#define CMD_COREB_RESET        4

 

to

 

#define CMD_COREB_START        3

#define CMD_COREB_STOP        4

#define CMD_COREB_RESET        5

 

I use the request number "2" in my own drivers too, so I will change them in the same way.

Attachments

    Outcomes