From de2652db9eb801c4b86240e1d9e0bd6fc3ddefcb Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sat, 21 Apr 2001 19:49:15 +0000 Subject: [PATCH] Change base-address-setting parameter from force or force_via686a to force_addr. It is now consistent with the bus PCI adapters that support base address setting (piix4, i801, viapro). Other benefit is that via686a_find can now return -ENODEV, and module will fail to load when base address is not set and parameter is not used. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1073 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 3 +-- doc/chips/MODPARMS | 19 ++++++++++++++----- doc/chips/via686a | 5 ++--- kernel/chips/via686a.c | 35 +++++++++++++++-------------------- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/CHANGES b/CHANGES index 83da4089..f181095f 100644 --- a/CHANGES +++ b/CHANGES @@ -21,7 +21,6 @@ ask CVS about it: NOTE: i2c-2.6.0 MUST BE be compiled AND installed first!!! If your make fails because it can't find , you forgot this step!!! - Also, mkpatch is probably broken right now. File doc/FAQ: Many updates and additions File doc/chips/via686a: Claim support for 686b. File README.thinkpad: new @@ -43,7 +42,7 @@ ask CVS about it: Save BIOS pin configuration of temps and fans Module sensors: Disabled, moved to i2c package as i2c-proc.c Module sis5595: Fix temp, add in4 for chip revision 0xc0. - Module via686a: Allow force=9191,address (for A7V/K7V boards) + Module via686a: Allow force_addr=0xaddr (for A7V/K7V boards) Module w83781d: Don't reinitialize as99127f chip; this may cause fan/temp reading changes Programs i2cdetect, i2cdump: add devfs /dev/i2c/x support diff --git a/doc/chips/MODPARMS b/doc/chips/MODPARMS index 0cef9ac5..ee65c5a9 100644 --- a/doc/chips/MODPARMS +++ b/doc/chips/MODPARMS @@ -1,4 +1,9 @@ -All chip drivers have a few insmod module parameters in common. These +Paramters for modprobe and insmod +================================= + +All chip drivers have a few modprobe module parameters in common. +(Insmod can also be used, but we recommend modprobe so that +other required modules are automatically loaded.) These parameters can be used when a module is inserted, to give some additional information about how it should function. In this case, they tell where the module should look for what chips. Usually, you don't need them, and @@ -12,15 +17,15 @@ nineteenth and `A' the first). If you want 'any I2C bus', use '-1' (or 65535). Each adapter has a number of addresses on I2C/SMBus adapters and/or the -ISA bus that are always scanned if no insmod parameters are given. The +ISA bus that are always scanned if no modprobe parameters are given. The parameters below override those addresses that are scanned by default. -All insmod parameters described below take lists of positive integers +All modprobe parameters described below take lists of positive integers (unsigned, in the range of 0 to 65535) as their arguments. Integers are separated by comma's, and may be given as ordinary decimal numbers, as octal numbers (by starting them with a `0') or as hexadecimal numbers (by starting them with a `0x'). More information can be found by -entering `man insmod'. +entering `man modprobe' or `man insmod'. `force', `force_*', `ignore' and `probe' parameters take pairs of numbers. Each first (odd) number is a bus number, each second (even) number is @@ -57,7 +62,11 @@ will skip all detection and recognition routines. This can lead to very strange results... An example: - insmod lm78 force_lm79=9191,0x390 ignore=0,0x2d,1,0x20 probe_range=-1,0,0x7f + modprobe lm78 force_lm79=9191,0x390 ignore=0,0x2d,1,0x20 probe_range=-1,0,0x7f # ISA address 0x390 contains a LM79 # Scan all I2C addresses (from 0 to 0x7f) for all I2C adapters # But skip address 0x2d on adapter 0, and address 0x20 on adapter 1 + +`force_addr' is a parameter used for PCI sensor adapters. +It is used to program the base address of the sensor registers. +This is required if the BIOS does not initialize the base address. diff --git a/doc/chips/via686a b/doc/chips/via686a index 919f57cd..823022e3 100644 --- a/doc/chips/via686a +++ b/doc/chips/via686a @@ -18,14 +18,13 @@ Authors: Ky Module Parameters ----------------- -force=9191,address Set the I/O base address. Useful for Asus A7V boards +force_addr=0xaddr Set the I/O base address. Useful for Asus A7V boards that don't set the address in the BIOS. Does not do a PCI force; the via686a must still be present in lspci. Don't use this unless the driver complains that the base address is not set. Otherwise the driver will recognize both the old and the forced address. - -force_via686a=9191,address Same as force. + Example: 'modprobe via686a force_addr=0x290' Description diff --git a/kernel/chips/via686a.c b/kernel/chips/via686a.c index 1d678fd1..34b5607a 100644 --- a/kernel/chips/via686a.c +++ b/kernel/chips/via686a.c @@ -58,6 +58,13 @@ #define THIS_MODULE NULL #endif +/* If force_addr is set to anything different from 0, we forcibly enable + the PIIX4 at the given address. VERY DANGEROUS! */ +static int force_addr = 0; +MODULE_PARM(force_addr, "i"); +MODULE_PARM_DESC(force_addr, + "Initialize the Via686a at the given address"); + /* Addresses to scan. Note that we can't determine the ISA address until we have initialized our module */ @@ -526,25 +533,13 @@ int via686a_find(int *address) pci_read_config_word(s_bridge, VIA686A_BASE_REG, &val)) return -ENODEV; *address = val & ~(VIA686A_EXTENT - 1); - if (*address == 0) { - printk("via686a.o: base address not set - upgrade BIOS or use force=9191,addr\n"); -/* - If we do this then the module won't load and force won't work. - But unfortunately the above printk is printed even if we are doing a force. + if (*address == 0 && force_addr == 0) { + printk("via686a.o: base address not set - upgrade BIOS or use force_addr=0xaddr\n"); return -ENODEV; -*/ } -/* - Moved below. - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(s_bridge, VIA686A_ENABLE_REG, &val)) - return -ENODEV; - if (!(val & 0x01)) { - printk("via686a.o: enabling sensors\n"); - pci_write_config_word(s_bridge, VIA686A_ENABLE_REG, - val | 0x01); - } -*/ + if (force_addr) + *address = force_addr; /* so detect will get called */ + return 0; } @@ -565,15 +560,15 @@ int via686a_detect(struct i2c_adapter *adapter, int address, return 0; } - if(kind >= 0) /* force or force_via686a */ - address &= ~(VIA686A_EXTENT - 1); + if(force_addr) + address = force_addr & ~(VIA686A_EXTENT - 1); if (check_region(address, VIA686A_EXTENT)) { printk("via686a.o: region 0x%x already in use!\n", address); return -ENODEV; } - if(kind >= 0) { /* treat force and force_via686a equally */ + if(force_addr) { printk("via686a.o: forcing ISA address 0x%04X\n", address); if (PCIBIOS_SUCCESSFUL != pci_write_config_word(s_bridge, VIA686A_BASE_REG, address))