aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/padlock-aes.c153
-rw-r--r--drivers/crypto/padlock.h22
-rw-r--r--drivers/i2c/busses/i2c-keywest.c7
-rw-r--r--drivers/ide/ppc/pmac.c12
-rw-r--r--drivers/ieee1394/ieee1394_core.h4
-rw-r--r--drivers/macintosh/Makefile2
-rw-r--r--drivers/macintosh/macio_asic.c78
-rw-r--r--drivers/macintosh/macio_sysfs.c50
-rw-r--r--drivers/macintosh/mediabay.c7
-rw-r--r--drivers/macintosh/therm_pm72.c9
-rw-r--r--drivers/macintosh/therm_windtunnel.c6
-rw-r--r--drivers/media/dvb/frontends/tda80xx.c1
-rw-r--r--drivers/net/bmac.c7
-rw-r--r--drivers/net/mace.c6
-rw-r--r--drivers/net/wireless/airport.c8
-rw-r--r--drivers/pci/setup-bus.c1
-rw-r--r--drivers/scsi/mac53c94.c7
-rw-r--r--drivers/scsi/mesh.c8
-rw-r--r--drivers/serial/pmac_zilog.c9
-rw-r--r--drivers/video/platinumfb.c6
20 files changed, 268 insertions, 135 deletions
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index ed708b4427b0..71407c578afe 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -49,6 +49,7 @@
49#include <linux/errno.h> 49#include <linux/errno.h>
50#include <linux/crypto.h> 50#include <linux/crypto.h>
51#include <linux/interrupt.h> 51#include <linux/interrupt.h>
52#include <linux/kernel.h>
52#include <asm/byteorder.h> 53#include <asm/byteorder.h>
53#include "padlock.h" 54#include "padlock.h"
54 55
@@ -59,8 +60,12 @@
59#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t)) 60#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t))
60 61
61struct aes_ctx { 62struct aes_ctx {
62 uint32_t e_data[AES_EXTENDED_KEY_SIZE+4]; 63 uint32_t e_data[AES_EXTENDED_KEY_SIZE];
63 uint32_t d_data[AES_EXTENDED_KEY_SIZE+4]; 64 uint32_t d_data[AES_EXTENDED_KEY_SIZE];
65 struct {
66 struct cword encrypt;
67 struct cword decrypt;
68 } cword;
64 uint32_t *E; 69 uint32_t *E;
65 uint32_t *D; 70 uint32_t *D;
66 int key_length; 71 int key_length;
@@ -280,10 +285,15 @@ aes_hw_extkey_available(uint8_t key_len)
280 return 0; 285 return 0;
281} 286}
282 287
288static inline struct aes_ctx *aes_ctx(void *ctx)
289{
290 return (struct aes_ctx *)ALIGN((unsigned long)ctx, PADLOCK_ALIGNMENT);
291}
292
283static int 293static int
284aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t *flags) 294aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t *flags)
285{ 295{
286 struct aes_ctx *ctx = ctx_arg; 296 struct aes_ctx *ctx = aes_ctx(ctx_arg);
287 uint32_t i, t, u, v, w; 297 uint32_t i, t, u, v, w;
288 uint32_t P[AES_EXTENDED_KEY_SIZE]; 298 uint32_t P[AES_EXTENDED_KEY_SIZE];
289 uint32_t rounds; 299 uint32_t rounds;
@@ -295,25 +305,36 @@ aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t
295 305
296 ctx->key_length = key_len; 306 ctx->key_length = key_len;
297 307
308 /*
309 * If the hardware is capable of generating the extended key
310 * itself we must supply the plain key for both encryption
311 * and decryption.
312 */
298 ctx->E = ctx->e_data; 313 ctx->E = ctx->e_data;
299 ctx->D = ctx->d_data; 314 ctx->D = ctx->e_data;
300
301 /* Ensure 16-Bytes alignmentation of keys for VIA PadLock. */
302 if ((int)(ctx->e_data) & 0x0F)
303 ctx->E += 4 - (((int)(ctx->e_data) & 0x0F) / sizeof (ctx->e_data[0]));
304
305 if ((int)(ctx->d_data) & 0x0F)
306 ctx->D += 4 - (((int)(ctx->d_data) & 0x0F) / sizeof (ctx->d_data[0]));
307 315
308 E_KEY[0] = uint32_t_in (in_key); 316 E_KEY[0] = uint32_t_in (in_key);
309 E_KEY[1] = uint32_t_in (in_key + 4); 317 E_KEY[1] = uint32_t_in (in_key + 4);
310 E_KEY[2] = uint32_t_in (in_key + 8); 318 E_KEY[2] = uint32_t_in (in_key + 8);
311 E_KEY[3] = uint32_t_in (in_key + 12); 319 E_KEY[3] = uint32_t_in (in_key + 12);
312 320
321 /* Prepare control words. */
322 memset(&ctx->cword, 0, sizeof(ctx->cword));
323
324 ctx->cword.decrypt.encdec = 1;
325 ctx->cword.encrypt.rounds = 10 + (key_len - 16) / 4;
326 ctx->cword.decrypt.rounds = ctx->cword.encrypt.rounds;
327 ctx->cword.encrypt.ksize = (key_len - 16) / 8;
328 ctx->cword.decrypt.ksize = ctx->cword.encrypt.ksize;
329
313 /* Don't generate extended keys if the hardware can do it. */ 330 /* Don't generate extended keys if the hardware can do it. */
314 if (aes_hw_extkey_available(key_len)) 331 if (aes_hw_extkey_available(key_len))
315 return 0; 332 return 0;
316 333
334 ctx->D = ctx->d_data;
335 ctx->cword.encrypt.keygen = 1;
336 ctx->cword.decrypt.keygen = 1;
337
317 switch (key_len) { 338 switch (key_len) {
318 case 16: 339 case 16:
319 t = E_KEY[3]; 340 t = E_KEY[3];
@@ -369,10 +390,9 @@ aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t
369 390
370/* ====== Encryption/decryption routines ====== */ 391/* ====== Encryption/decryption routines ====== */
371 392
372/* This is the real call to PadLock. */ 393/* These are the real call to PadLock. */
373static inline void 394static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
374padlock_xcrypt_ecb(uint8_t *input, uint8_t *output, uint8_t *key, 395 void *control_word, u32 count)
375 void *control_word, uint32_t count)
376{ 396{
377 asm volatile ("pushfl; popfl"); /* enforce key reload. */ 397 asm volatile ("pushfl; popfl"); /* enforce key reload. */
378 asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ 398 asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */
@@ -380,60 +400,70 @@ padlock_xcrypt_ecb(uint8_t *input, uint8_t *output, uint8_t *key,
380 : "d"(control_word), "b"(key), "c"(count)); 400 : "d"(control_word), "b"(key), "c"(count));
381} 401}
382 402
383static void 403static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
384aes_padlock(void *ctx_arg, uint8_t *out_arg, const uint8_t *in_arg, int encdec) 404 u8 *iv, void *control_word, u32 count)
385{ 405{
386 /* Don't blindly modify this structure - the items must 406 /* Enforce key reload. */
387 fit on 16-Bytes boundaries! */ 407 asm volatile ("pushfl; popfl");
388 struct padlock_xcrypt_data { 408 /* rep xcryptcbc */
389 uint8_t buf[AES_BLOCK_SIZE]; 409 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0"
390 union cword cword; 410 : "+S" (input), "+D" (output), "+a" (iv)
391 }; 411 : "d" (control_word), "b" (key), "c" (count));
392 412 return iv;
393 struct aes_ctx *ctx = ctx_arg;
394 char bigbuf[sizeof(struct padlock_xcrypt_data) + 16];
395 struct padlock_xcrypt_data *data;
396 void *key;
397
398 /* Place 'data' at the first 16-Bytes aligned address in 'bigbuf'. */
399 if (((long)bigbuf) & 0x0F)
400 data = (void*)(bigbuf + 16 - ((long)bigbuf & 0x0F));
401 else
402 data = (void*)bigbuf;
403
404 /* Prepare Control word. */
405 memset (data, 0, sizeof(struct padlock_xcrypt_data));
406 data->cword.b.encdec = !encdec; /* in the rest of cryptoapi ENC=1/DEC=0 */
407 data->cword.b.rounds = 10 + (ctx->key_length - 16) / 4;
408 data->cword.b.ksize = (ctx->key_length - 16) / 8;
409
410 /* Is the hardware capable to generate the extended key? */
411 if (!aes_hw_extkey_available(ctx->key_length))
412 data->cword.b.keygen = 1;
413
414 /* ctx->E starts with a plain key - if the hardware is capable
415 to generate the extended key itself we must supply
416 the plain key for both Encryption and Decryption. */
417 if (encdec == CRYPTO_DIR_ENCRYPT || data->cword.b.keygen == 0)
418 key = ctx->E;
419 else
420 key = ctx->D;
421
422 memcpy(data->buf, in_arg, AES_BLOCK_SIZE);
423 padlock_xcrypt_ecb(data->buf, data->buf, key, &data->cword, 1);
424 memcpy(out_arg, data->buf, AES_BLOCK_SIZE);
425} 413}
426 414
427static void 415static void
428aes_encrypt(void *ctx_arg, uint8_t *out, const uint8_t *in) 416aes_encrypt(void *ctx_arg, uint8_t *out, const uint8_t *in)
429{ 417{
430 aes_padlock(ctx_arg, out, in, CRYPTO_DIR_ENCRYPT); 418 struct aes_ctx *ctx = aes_ctx(ctx_arg);
419 padlock_xcrypt_ecb(in, out, ctx->E, &ctx->cword.encrypt, 1);
431} 420}
432 421
433static void 422static void
434aes_decrypt(void *ctx_arg, uint8_t *out, const uint8_t *in) 423aes_decrypt(void *ctx_arg, uint8_t *out, const uint8_t *in)
435{ 424{
436 aes_padlock(ctx_arg, out, in, CRYPTO_DIR_DECRYPT); 425 struct aes_ctx *ctx = aes_ctx(ctx_arg);
426 padlock_xcrypt_ecb(in, out, ctx->D, &ctx->cword.decrypt, 1);
427}
428
429static unsigned int aes_encrypt_ecb(const struct cipher_desc *desc, u8 *out,
430 const u8 *in, unsigned int nbytes)
431{
432 struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm));
433 padlock_xcrypt_ecb(in, out, ctx->E, &ctx->cword.encrypt,
434 nbytes / AES_BLOCK_SIZE);
435 return nbytes & ~(AES_BLOCK_SIZE - 1);
436}
437
438static unsigned int aes_decrypt_ecb(const struct cipher_desc *desc, u8 *out,
439 const u8 *in, unsigned int nbytes)
440{
441 struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm));
442 padlock_xcrypt_ecb(in, out, ctx->D, &ctx->cword.decrypt,
443 nbytes / AES_BLOCK_SIZE);
444 return nbytes & ~(AES_BLOCK_SIZE - 1);
445}
446
447static unsigned int aes_encrypt_cbc(const struct cipher_desc *desc, u8 *out,
448 const u8 *in, unsigned int nbytes)
449{
450 struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm));
451 u8 *iv;
452
453 iv = padlock_xcrypt_cbc(in, out, ctx->E, desc->info,
454 &ctx->cword.encrypt, nbytes / AES_BLOCK_SIZE);
455 memcpy(desc->info, iv, AES_BLOCK_SIZE);
456
457 return nbytes & ~(AES_BLOCK_SIZE - 1);
458}
459
460static unsigned int aes_decrypt_cbc(const struct cipher_desc *desc, u8 *out,
461 const u8 *in, unsigned int nbytes)
462{
463 struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm));
464 padlock_xcrypt_cbc(in, out, ctx->D, desc->info, &ctx->cword.decrypt,
465 nbytes / AES_BLOCK_SIZE);
466 return nbytes & ~(AES_BLOCK_SIZE - 1);
437} 467}
438 468
439static struct crypto_alg aes_alg = { 469static struct crypto_alg aes_alg = {
@@ -441,6 +471,7 @@ static struct crypto_alg aes_alg = {
441 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 471 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
442 .cra_blocksize = AES_BLOCK_SIZE, 472 .cra_blocksize = AES_BLOCK_SIZE,
443 .cra_ctxsize = sizeof(struct aes_ctx), 473 .cra_ctxsize = sizeof(struct aes_ctx),
474 .cra_alignmask = PADLOCK_ALIGNMENT - 1,
444 .cra_module = THIS_MODULE, 475 .cra_module = THIS_MODULE,
445 .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), 476 .cra_list = LIST_HEAD_INIT(aes_alg.cra_list),
446 .cra_u = { 477 .cra_u = {
@@ -449,7 +480,11 @@ static struct crypto_alg aes_alg = {
449 .cia_max_keysize = AES_MAX_KEY_SIZE, 480 .cia_max_keysize = AES_MAX_KEY_SIZE,
450 .cia_setkey = aes_set_key, 481 .cia_setkey = aes_set_key,
451 .cia_encrypt = aes_encrypt, 482 .cia_encrypt = aes_encrypt,
452 .cia_decrypt = aes_decrypt 483 .cia_decrypt = aes_decrypt,
484 .cia_encrypt_ecb = aes_encrypt_ecb,
485 .cia_decrypt_ecb = aes_decrypt_ecb,
486 .cia_encrypt_cbc = aes_encrypt_cbc,
487 .cia_decrypt_cbc = aes_decrypt_cbc,
453 } 488 }
454 } 489 }
455}; 490};
diff --git a/drivers/crypto/padlock.h b/drivers/crypto/padlock.h
index 7a500605e449..3cf2b7a12348 100644
--- a/drivers/crypto/padlock.h
+++ b/drivers/crypto/padlock.h
@@ -13,18 +13,18 @@
13#ifndef _CRYPTO_PADLOCK_H 13#ifndef _CRYPTO_PADLOCK_H
14#define _CRYPTO_PADLOCK_H 14#define _CRYPTO_PADLOCK_H
15 15
16#define PADLOCK_ALIGNMENT 16
17
16/* Control word. */ 18/* Control word. */
17union cword { 19struct cword {
18 uint32_t cword[4]; 20 int __attribute__ ((__packed__))
19 struct { 21 rounds:4,
20 int rounds:4; 22 algo:3,
21 int algo:3; 23 keygen:1,
22 int keygen:1; 24 interm:1,
23 int interm:1; 25 encdec:1,
24 int encdec:1; 26 ksize:2;
25 int ksize:2; 27} __attribute__ ((__aligned__(PADLOCK_ALIGNMENT)));
26 } b;
27};
28 28
29#define PFX "padlock: " 29#define PFX "padlock: "
30 30
diff --git a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c
index 363e545fc01f..94ae808314f7 100644
--- a/drivers/i2c/busses/i2c-keywest.c
+++ b/drivers/i2c/busses/i2c-keywest.c
@@ -698,7 +698,7 @@ dispose_iface(struct device *dev)
698} 698}
699 699
700static int 700static int
701create_iface_macio(struct macio_dev* dev, const struct of_match *match) 701create_iface_macio(struct macio_dev* dev, const struct of_device_id *match)
702{ 702{
703 return create_iface(dev->ofdev.node, &dev->ofdev.dev); 703 return create_iface(dev->ofdev.node, &dev->ofdev.dev);
704} 704}
@@ -710,7 +710,7 @@ dispose_iface_macio(struct macio_dev* dev)
710} 710}
711 711
712static int 712static int
713create_iface_of_platform(struct of_device* dev, const struct of_match *match) 713create_iface_of_platform(struct of_device* dev, const struct of_device_id *match)
714{ 714{
715 return create_iface(dev->node, &dev->dev); 715 return create_iface(dev->node, &dev->dev);
716} 716}
@@ -721,10 +721,9 @@ dispose_iface_of_platform(struct of_device* dev)
721 return dispose_iface(&dev->dev); 721 return dispose_iface(&dev->dev);
722} 722}
723 723
724static struct of_match i2c_keywest_match[] = 724static struct of_device_id i2c_keywest_match[] =
725{ 725{
726 { 726 {
727 .name = OF_ANY_MATCH,
728 .type = "i2c", 727 .type = "i2c",
729 .compatible = "keywest" 728 .compatible = "keywest"
730 }, 729 },
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 818380b5fd27..be0fcc8f4b15 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1419,7 +1419,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1419 * Attach to a macio probed interface 1419 * Attach to a macio probed interface
1420 */ 1420 */
1421static int __devinit 1421static int __devinit
1422pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_match *match) 1422pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1423{ 1423{
1424 void __iomem *base; 1424 void __iomem *base;
1425 unsigned long regbase; 1425 unsigned long regbase;
@@ -1637,27 +1637,19 @@ pmac_ide_pci_resume(struct pci_dev *pdev)
1637 return rc; 1637 return rc;
1638} 1638}
1639 1639
1640static struct of_match pmac_ide_macio_match[] = 1640static struct of_device_id pmac_ide_macio_match[] =
1641{ 1641{
1642 { 1642 {
1643 .name = "IDE", 1643 .name = "IDE",
1644 .type = OF_ANY_MATCH,
1645 .compatible = OF_ANY_MATCH
1646 }, 1644 },
1647 { 1645 {
1648 .name = "ATA", 1646 .name = "ATA",
1649 .type = OF_ANY_MATCH,
1650 .compatible = OF_ANY_MATCH
1651 }, 1647 },
1652 { 1648 {
1653 .name = OF_ANY_MATCH,
1654 .type = "ide", 1649 .type = "ide",
1655 .compatible = OF_ANY_MATCH
1656 }, 1650 },
1657 { 1651 {
1658 .name = OF_ANY_MATCH,
1659 .type = "ata", 1652 .type = "ata",
1660 .compatible = OF_ANY_MATCH
1661 }, 1653 },
1662 {}, 1654 {},
1663}; 1655};
diff --git a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h
index 73bd8efd2b6c..0b31429d0a68 100644
--- a/drivers/ieee1394/ieee1394_core.h
+++ b/drivers/ieee1394/ieee1394_core.h
@@ -38,8 +38,8 @@ struct hpsb_packet {
38 38
39 /* These are core internal. */ 39 /* These are core internal. */
40 signed char tlabel; 40 signed char tlabel;
41 char ack_code; 41 signed char ack_code;
42 char tcode; 42 unsigned char tcode;
43 43
44 unsigned expect_response:1; 44 unsigned expect_response:1;
45 unsigned no_waiter:1; 45 unsigned no_waiter:1;
diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile
index f5ae171dbfef..236291bd48a4 100644
--- a/drivers/macintosh/Makefile
+++ b/drivers/macintosh/Makefile
@@ -4,7 +4,7 @@
4 4
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_PPC_PMAC) += macio_asic.o 7obj-$(CONFIG_PPC_PMAC) += macio_asic.o macio_sysfs.o
8 8
9obj-$(CONFIG_PMAC_MEDIABAY) += mediabay.o 9obj-$(CONFIG_PMAC_MEDIABAY) += mediabay.o
10obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o 10obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index d0bda7e3e6aa..1ee003346923 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -33,7 +33,7 @@ static int macio_bus_match(struct device *dev, struct device_driver *drv)
33{ 33{
34 struct macio_dev * macio_dev = to_macio_device(dev); 34 struct macio_dev * macio_dev = to_macio_device(dev);
35 struct macio_driver * macio_drv = to_macio_driver(drv); 35 struct macio_driver * macio_drv = to_macio_driver(drv);
36 const struct of_match * matches = macio_drv->match_table; 36 const struct of_device_id * matches = macio_drv->match_table;
37 37
38 if (!matches) 38 if (!matches)
39 return 0; 39 return 0;
@@ -66,7 +66,7 @@ static int macio_device_probe(struct device *dev)
66 int error = -ENODEV; 66 int error = -ENODEV;
67 struct macio_driver *drv; 67 struct macio_driver *drv;
68 struct macio_dev *macio_dev; 68 struct macio_dev *macio_dev;
69 const struct of_match *match; 69 const struct of_device_id *match;
70 70
71 drv = to_macio_driver(dev->driver); 71 drv = to_macio_driver(dev->driver);
72 macio_dev = to_macio_device(dev); 72 macio_dev = to_macio_device(dev);
@@ -126,11 +126,85 @@ static int macio_device_resume(struct device * dev)
126 return 0; 126 return 0;
127} 127}
128 128
129static int macio_hotplug (struct device *dev, char **envp, int num_envp,
130 char *buffer, int buffer_size)
131{
132 struct macio_dev * macio_dev;
133 struct of_device * of;
134 char *scratch, *compat;
135 int i = 0;
136 int length = 0;
137 int cplen, seen = 0;
138
139 if (!dev)
140 return -ENODEV;
141
142 macio_dev = to_macio_device(dev);
143 if (!macio_dev)
144 return -ENODEV;
145
146 of = &macio_dev->ofdev;
147 scratch = buffer;
148
149 /* stuff we want to pass to /sbin/hotplug */
150 envp[i++] = scratch;
151 length += scnprintf (scratch, buffer_size - length, "OF_NAME=%s",
152 of->node->name);
153 if ((buffer_size - length <= 0) || (i >= num_envp))
154 return -ENOMEM;
155 ++length;
156 scratch += length;
157
158 envp[i++] = scratch;
159 length += scnprintf (scratch, buffer_size - length, "OF_TYPE=%s",
160 of->node->type);
161 if ((buffer_size - length <= 0) || (i >= num_envp))
162 return -ENOMEM;
163 ++length;
164 scratch += length;
165
166 /* Since the compatible field can contain pretty much anything
167 * it's not really legal to split it out with commas. We split it
168 * up using a number of environment variables instead. */
169
170 compat = (char *) get_property(of->node, "compatible", &cplen);
171 while (compat && cplen > 0) {
172 int l;
173 envp[i++] = scratch;
174 length += scnprintf (scratch, buffer_size - length,
175 "OF_COMPATIBLE_%d=%s", seen, compat);
176 if ((buffer_size - length <= 0) || (i >= num_envp))
177 return -ENOMEM;
178 length++;
179 scratch += length;
180 l = strlen (compat) + 1;
181 compat += l;
182 cplen -= l;
183 seen++;
184 }
185
186 envp[i++] = scratch;
187 length += scnprintf (scratch, buffer_size - length,
188 "OF_COMPATIBLE_N=%d", seen);
189 if ((buffer_size - length <= 0) || (i >= num_envp))
190 return -ENOMEM;
191 ++length;
192 scratch += length;
193
194 envp[i] = NULL;
195
196 return 0;
197}
198
199extern struct device_attribute macio_dev_attrs[];
200
129struct bus_type macio_bus_type = { 201struct bus_type macio_bus_type = {
130 .name = "macio", 202 .name = "macio",
131 .match = macio_bus_match, 203 .match = macio_bus_match,
204 .hotplug = macio_hotplug,
132 .suspend = macio_device_suspend, 205 .suspend = macio_device_suspend,
133 .resume = macio_device_resume, 206 .resume = macio_device_resume,
207 .dev_attrs = macio_dev_attrs,
134}; 208};
135 209
136static int __init macio_bus_driver_init(void) 210static int __init macio_bus_driver_init(void)
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
new file mode 100644
index 000000000000..97d22bb4516a
--- /dev/null
+++ b/drivers/macintosh/macio_sysfs.c
@@ -0,0 +1,50 @@
1#include <linux/config.h>
2#include <linux/kernel.h>
3#include <linux/stat.h>
4#include <asm/macio.h>
5
6
7#define macio_config_of_attr(field, format_string) \
8static ssize_t \
9field##_show (struct device *dev, struct device_attribute *attr, \
10 char *buf) \
11{ \
12 struct macio_dev *mdev = to_macio_device (dev); \
13 return sprintf (buf, format_string, mdev->ofdev.node->field); \
14}
15
16static ssize_t
17compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
18{
19 struct of_device *of;
20 char *compat;
21 int cplen;
22 int length = 0;
23
24 of = &to_macio_device (dev)->ofdev;
25 compat = (char *) get_property(of->node, "compatible", &cplen);
26 if (!compat) {
27 *buf = '\0';
28 return 0;
29 }
30 while (cplen > 0) {
31 int l;
32 length += sprintf (buf, "%s\n", compat);
33 buf += length;
34 l = strlen (compat) + 1;
35 compat += l;
36 cplen -= l;
37 }
38
39 return length;
40}
41
42macio_config_of_attr (name, "%s\n");
43macio_config_of_attr (type, "%s\n");
44
45struct device_attribute macio_dev_attrs[] = {
46 __ATTR_RO(name),
47 __ATTR_RO(type),
48 __ATTR_RO(compatible),
49 __ATTR_NULL
50};
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 4be709e13eec..7c16c25fc5d4 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -642,7 +642,7 @@ static int __pmac media_bay_task(void *x)
642 } 642 }
643} 643}
644 644
645static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_match *match) 645static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_device_id *match)
646{ 646{
647 struct media_bay_info* bay; 647 struct media_bay_info* bay;
648 u32 __iomem *regbase; 648 u32 __iomem *regbase;
@@ -797,23 +797,20 @@ static struct mb_ops keylargo_mb_ops __pmacdata = {
797 * Therefore we do it all by polling the media bay once each tick. 797 * Therefore we do it all by polling the media bay once each tick.
798 */ 798 */
799 799
800static struct of_match media_bay_match[] = 800static struct of_device_id media_bay_match[] =
801{ 801{
802 { 802 {
803 .name = "media-bay", 803 .name = "media-bay",
804 .type = OF_ANY_MATCH,
805 .compatible = "keylargo-media-bay", 804 .compatible = "keylargo-media-bay",
806 .data = &keylargo_mb_ops, 805 .data = &keylargo_mb_ops,
807 }, 806 },
808 { 807 {
809 .name = "media-bay", 808 .name = "media-bay",
810 .type = OF_ANY_MATCH,
811 .compatible = "heathrow-media-bay", 809 .compatible = "heathrow-media-bay",
812 .data = &heathrow_mb_ops, 810 .data = &heathrow_mb_ops,
813 }, 811 },
814 { 812 {
815 .name = "media-bay", 813 .name = "media-bay",
816 .type = OF_ANY_MATCH,
817 .compatible = "ohare-media-bay", 814 .compatible = "ohare-media-bay",
818 .data = &ohare_mb_ops, 815 .data = &ohare_mb_ops,
819 }, 816 },
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index feb4e2413858..703e31973314 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -120,6 +120,7 @@
120#include <asm/system.h> 120#include <asm/system.h>
121#include <asm/sections.h> 121#include <asm/sections.h>
122#include <asm/of_device.h> 122#include <asm/of_device.h>
123#include <asm/macio.h>
123 124
124#include "therm_pm72.h" 125#include "therm_pm72.h"
125 126
@@ -1986,7 +1987,7 @@ static void fcu_lookup_fans(struct device_node *fcu_node)
1986 } 1987 }
1987} 1988}
1988 1989
1989static int fcu_of_probe(struct of_device* dev, const struct of_match *match) 1990static int fcu_of_probe(struct of_device* dev, const struct of_device_id *match)
1990{ 1991{
1991 int rc; 1992 int rc;
1992 1993
@@ -2009,12 +2010,10 @@ static int fcu_of_remove(struct of_device* dev)
2009 return 0; 2010 return 0;
2010} 2011}
2011 2012
2012static struct of_match fcu_of_match[] = 2013static struct of_device_id fcu_match[] =
2013{ 2014{
2014 { 2015 {
2015 .name = OF_ANY_MATCH,
2016 .type = "fcu", 2016 .type = "fcu",
2017 .compatible = OF_ANY_MATCH
2018 }, 2017 },
2019 {}, 2018 {},
2020}; 2019};
@@ -2022,7 +2021,7 @@ static struct of_match fcu_of_match[] =
2022static struct of_platform_driver fcu_of_platform_driver = 2021static struct of_platform_driver fcu_of_platform_driver =
2023{ 2022{
2024 .name = "temperature", 2023 .name = "temperature",
2025 .match_table = fcu_of_match, 2024 .match_table = fcu_match,
2026 .probe = fcu_of_probe, 2025 .probe = fcu_of_probe,
2027 .remove = fcu_of_remove 2026 .remove = fcu_of_remove
2028}; 2027};
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 61400f04015e..cbb72eb0426d 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -43,6 +43,7 @@
43#include <asm/system.h> 43#include <asm/system.h>
44#include <asm/sections.h> 44#include <asm/sections.h>
45#include <asm/of_device.h> 45#include <asm/of_device.h>
46#include <asm/macio.h>
46 47
47#define LOG_TEMP 0 /* continously log temperature */ 48#define LOG_TEMP 0 /* continously log temperature */
48 49
@@ -450,7 +451,7 @@ do_probe( struct i2c_adapter *adapter, int addr, int kind )
450/************************************************************************/ 451/************************************************************************/
451 452
452static int 453static int
453therm_of_probe( struct of_device *dev, const struct of_match *match ) 454therm_of_probe( struct of_device *dev, const struct of_device_id *match )
454{ 455{
455 return i2c_add_driver( &g4fan_driver ); 456 return i2c_add_driver( &g4fan_driver );
456} 457}
@@ -461,9 +462,8 @@ therm_of_remove( struct of_device *dev )
461 return i2c_del_driver( &g4fan_driver ); 462 return i2c_del_driver( &g4fan_driver );
462} 463}
463 464
464static struct of_match therm_of_match[] = {{ 465static struct of_device_id therm_of_match[] = {{
465 .name = "fan", 466 .name = "fan",
466 .type = OF_ANY_MATCH,
467 .compatible = "adm1030" 467 .compatible = "adm1030"
468 }, {} 468 }, {}
469}; 469};
diff --git a/drivers/media/dvb/frontends/tda80xx.c b/drivers/media/dvb/frontends/tda80xx.c
index 032d348dafb7..88e125079ca1 100644
--- a/drivers/media/dvb/frontends/tda80xx.c
+++ b/drivers/media/dvb/frontends/tda80xx.c
@@ -27,7 +27,6 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/threads.h> 28#include <linux/threads.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/irq.h>
31#include <linux/kernel.h> 30#include <linux/kernel.h>
32#include <linux/module.h> 31#include <linux/module.h>
33#include <linux/slab.h> 32#include <linux/slab.h>
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 00e5257b176f..8dc657fc8afb 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1261,7 +1261,7 @@ static void bmac_reset_and_enable(struct net_device *dev)
1261 spin_unlock_irqrestore(&bp->lock, flags); 1261 spin_unlock_irqrestore(&bp->lock, flags);
1262} 1262}
1263 1263
1264static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_match *match) 1264static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_id *match)
1265{ 1265{
1266 int j, rev, ret; 1266 int j, rev, ret;
1267 struct bmac_data *bp; 1267 struct bmac_data *bp;
@@ -1645,16 +1645,13 @@ static int __devexit bmac_remove(struct macio_dev *mdev)
1645 return 0; 1645 return 0;
1646} 1646}
1647 1647
1648static struct of_match bmac_match[] = 1648static struct of_device_id bmac_match[] =
1649{ 1649{
1650 { 1650 {
1651 .name = "bmac", 1651 .name = "bmac",
1652 .type = OF_ANY_MATCH,
1653 .compatible = OF_ANY_MATCH,
1654 .data = (void *)0, 1652 .data = (void *)0,
1655 }, 1653 },
1656 { 1654 {
1657 .name = OF_ANY_MATCH,
1658 .type = "network", 1655 .type = "network",
1659 .compatible = "bmac+", 1656 .compatible = "bmac+",
1660 .data = (void *)1, 1657 .data = (void *)1,
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index 6ed2d7dbd44c..81d0a26e4f41 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -109,7 +109,7 @@ bitrev(int b)
109} 109}
110 110
111 111
112static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *match) 112static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_id *match)
113{ 113{
114 struct device_node *mace = macio_get_of_node(mdev); 114 struct device_node *mace = macio_get_of_node(mdev);
115 struct net_device *dev; 115 struct net_device *dev;
@@ -1009,12 +1009,10 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs)
1009 return IRQ_HANDLED; 1009 return IRQ_HANDLED;
1010} 1010}
1011 1011
1012static struct of_match mace_match[] = 1012static struct of_device_id mace_match[] =
1013{ 1013{
1014 { 1014 {
1015 .name = "mace", 1015 .name = "mace",
1016 .type = OF_ANY_MATCH,
1017 .compatible = OF_ANY_MATCH
1018 }, 1016 },
1019 {}, 1017 {},
1020}; 1018};
diff --git a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c
index b4f4bd7956a2..9d496703c465 100644
--- a/drivers/net/wireless/airport.c
+++ b/drivers/net/wireless/airport.c
@@ -184,7 +184,7 @@ static int airport_hard_reset(struct orinoco_private *priv)
184} 184}
185 185
186static int 186static int
187airport_attach(struct macio_dev *mdev, const struct of_match *match) 187airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
188{ 188{
189 struct orinoco_private *priv; 189 struct orinoco_private *priv;
190 struct net_device *dev; 190 struct net_device *dev;
@@ -266,16 +266,16 @@ MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
266MODULE_DESCRIPTION("Driver for the Apple Airport wireless card."); 266MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
267MODULE_LICENSE("Dual MPL/GPL"); 267MODULE_LICENSE("Dual MPL/GPL");
268 268
269static struct of_match airport_match[] = 269static struct of_device_id airport_match[] =
270{ 270{
271 { 271 {
272 .name = "radio", 272 .name = "radio",
273 .type = OF_ANY_MATCH,
274 .compatible = OF_ANY_MATCH
275 }, 273 },
276 {}, 274 {},
277}; 275};
278 276
277MODULE_DEVICE_TABLE (of, airport_match);
278
279static struct macio_driver airport_driver = 279static struct macio_driver airport_driver =
280{ 280{
281 .name = DRIVER_NAME, 281 .name = DRIVER_NAME,
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index c1bdfb424658..9fe48f712be9 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -74,6 +74,7 @@ pbus_assign_resources_sorted(struct pci_bus *bus)
74 idx = res - &list->dev->resource[0]; 74 idx = res - &list->dev->resource[0];
75 if (pci_assign_resource(list->dev, idx)) { 75 if (pci_assign_resource(list->dev, idx)) {
76 res->start = 0; 76 res->start = 0;
77 res->end = 0;
77 res->flags = 0; 78 res->flags = 0;
78 } 79 }
79 tmp = list; 80 tmp = list;
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index edd47d1f0b17..932dcf0366eb 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -424,7 +424,7 @@ static struct scsi_host_template mac53c94_template = {
424 .use_clustering = DISABLE_CLUSTERING, 424 .use_clustering = DISABLE_CLUSTERING,
425}; 425};
426 426
427static int mac53c94_probe(struct macio_dev *mdev, const struct of_match *match) 427static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match)
428{ 428{
429 struct device_node *node = macio_get_of_node(mdev); 429 struct device_node *node = macio_get_of_node(mdev);
430 struct pci_dev *pdev = macio_get_pci_dev(mdev); 430 struct pci_dev *pdev = macio_get_pci_dev(mdev);
@@ -544,15 +544,14 @@ static int mac53c94_remove(struct macio_dev *mdev)
544} 544}
545 545
546 546
547static struct of_match mac53c94_match[] = 547static struct of_device_id mac53c94_match[] =
548{ 548{
549 { 549 {
550 .name = "53c94", 550 .name = "53c94",
551 .type = OF_ANY_MATCH,
552 .compatible = OF_ANY_MATCH
553 }, 551 },
554 {}, 552 {},
555}; 553};
554MODULE_DEVICE_TABLE (of, mac53c94_match);
556 555
557static struct macio_driver mac53c94_driver = 556static struct macio_driver mac53c94_driver =
558{ 557{
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index b05737ae5eff..ff1933298da6 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1847,7 +1847,7 @@ static struct scsi_host_template mesh_template = {
1847 .use_clustering = DISABLE_CLUSTERING, 1847 .use_clustering = DISABLE_CLUSTERING,
1848}; 1848};
1849 1849
1850static int mesh_probe(struct macio_dev *mdev, const struct of_match *match) 1850static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
1851{ 1851{
1852 struct device_node *mesh = macio_get_of_node(mdev); 1852 struct device_node *mesh = macio_get_of_node(mdev);
1853 struct pci_dev* pdev = macio_get_pci_dev(mdev); 1853 struct pci_dev* pdev = macio_get_pci_dev(mdev);
@@ -2012,20 +2012,18 @@ static int mesh_remove(struct macio_dev *mdev)
2012} 2012}
2013 2013
2014 2014
2015static struct of_match mesh_match[] = 2015static struct of_device_id mesh_match[] =
2016{ 2016{
2017 { 2017 {
2018 .name = "mesh", 2018 .name = "mesh",
2019 .type = OF_ANY_MATCH,
2020 .compatible = OF_ANY_MATCH
2021 }, 2019 },
2022 { 2020 {
2023 .name = OF_ANY_MATCH,
2024 .type = "scsi", 2021 .type = "scsi",
2025 .compatible = "chrp,mesh0" 2022 .compatible = "chrp,mesh0"
2026 }, 2023 },
2027 {}, 2024 {},
2028}; 2025};
2026MODULE_DEVICE_TABLE (of, mesh_match);
2029 2027
2030static struct macio_driver mesh_driver = 2028static struct macio_driver mesh_driver =
2031{ 2029{
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 1c9f71617123..7db2f37532cf 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -1545,7 +1545,7 @@ static void pmz_dispose_port(struct uart_pmac_port *uap)
1545/* 1545/*
1546 * Called upon match with an escc node in the devive-tree. 1546 * Called upon match with an escc node in the devive-tree.
1547 */ 1547 */
1548static int pmz_attach(struct macio_dev *mdev, const struct of_match *match) 1548static int pmz_attach(struct macio_dev *mdev, const struct of_device_id *match)
1549{ 1549{
1550 int i; 1550 int i;
1551 1551
@@ -1850,20 +1850,17 @@ err_out:
1850 return rc; 1850 return rc;
1851} 1851}
1852 1852
1853static struct of_match pmz_match[] = 1853static struct of_device_id pmz_match[] =
1854{ 1854{
1855 { 1855 {
1856 .name = "ch-a", 1856 .name = "ch-a",
1857 .type = OF_ANY_MATCH,
1858 .compatible = OF_ANY_MATCH
1859 }, 1857 },
1860 { 1858 {
1861 .name = "ch-b", 1859 .name = "ch-b",
1862 .type = OF_ANY_MATCH,
1863 .compatible = OF_ANY_MATCH
1864 }, 1860 },
1865 {}, 1861 {},
1866}; 1862};
1863MODULE_DEVICE_TABLE (of, pmz_match);
1867 1864
1868static struct macio_driver pmz_driver = 1865static struct macio_driver pmz_driver =
1869{ 1866{
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index 3dd1de1539d2..b00887e9851c 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -523,7 +523,7 @@ int __init platinumfb_setup(char *options)
523#define invalidate_cache(addr) 523#define invalidate_cache(addr)
524#endif 524#endif
525 525
526static int __devinit platinumfb_probe(struct of_device* odev, const struct of_match *match) 526static int __devinit platinumfb_probe(struct of_device* odev, const struct of_device_id *match)
527{ 527{
528 struct device_node *dp = odev->node; 528 struct device_node *dp = odev->node;
529 struct fb_info *info; 529 struct fb_info *info;
@@ -647,12 +647,10 @@ static int __devexit platinumfb_remove(struct of_device* odev)
647 return 0; 647 return 0;
648} 648}
649 649
650static struct of_match platinumfb_match[] = 650static struct of_device_id platinumfb_match[] =
651{ 651{
652 { 652 {
653 .name = "platinum", 653 .name = "platinum",
654 .type = OF_ANY_MATCH,
655 .compatible = OF_ANY_MATCH,
656 }, 654 },
657 {}, 655 {},
658}; 656};