Module not writing to memory

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

 



Hello,

I'm new to kernel programming and have been making a
kernelmodule to use motherboards RTC alarm
feature. Feature wakes computer from mechanical
shutdown and is not part of acpi or any other.

Problem is that:
It is 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); 
included are 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. Can send.

chip->driver is NULL, so there is no other driver for
it, but device is still found? Found that devices
struct resource has the flags.

Is for example pci_register_module command necessary
instead of plain char_module registering to enable
writes? Do flags have to be changed somehow and where,
is it possible? 

In real life, should this kind of code be integrated
to some other device driver if it is supposed to be
good implementation? Is it in bios that handles chips
on board? Can there be two drivers for the same
device?

regards,

jnl

=====
_____________________
Jouni J. Laakso
jounijl@yahoo.co.uk
phone: +358-41-5165554
Helsinki, Finland

,

________________________________________________________________________
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