Readonly resource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm new to kernel programming. I've been making a
kernel testmodule to use motherboards RTC alarm
feature. It wakes computer from mechanical shutdown
and is not part of acpi or any other that I know of.

Problem:
It's ok to read register values for alarm, but writing
is not. 

Flags in ioport.h are tested with:
flag = pci_resource_flags(&chip, PCI_BASE_ADDRESS_0);
printk(KERN_ALERT "\n82471eb: test: flag=%d ,
0",flag);
and following is set:
MEM=on, PREFETCH=on, READONLY=on, UNSET=on, others
off. This READONLY seems to be the problem. 

Module is character driver and device (chip eb82471
from Intel) is:
struct pci_dev * chp = ( struct pci_dev * )
pci_find_device(INTEL_VID, CHIP_DID, NULL); 
it has commands:
major = register_chrdev(major, DEVICE_NAME, &fops);
pci_enable_device(chp);
chip=*chp;
pci_read_config_byte(&chip, reg, &ptr);
pci_write_config_byte(&chip, reg, ptr);

Code is simple but long enough to not to paste in
this. I can send the code if necessary.

Is for example pci_register command necessary instead
of plain char_module registering to enable writes? Do
flags have to be changed somehow or has some other
driver locked the device? 

Found that devices struct resource has the flags, but
can READONLY be enabled straight from it?

Ayway, in real life, should this code be integrated to
some other device driver, or is it in bios? Can there
be two drivers for the same device?

best regards,

jnl

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux