cmd_pci.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /*
  2. * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  3. * Andreas Heppel <aheppel@sysgo.de>
  4. *
  5. * (C) Copyright 2002
  6. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  7. * Wolfgang Grandegger, DENX Software Engineering, wg@denx.de.
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. /*
  28. * PCI routines
  29. */
  30. #include <common.h>
  31. #ifdef CONFIG_PCI
  32. #include <command.h>
  33. #include <asm/processor.h>
  34. #include <asm/io.h>
  35. #include <pci.h>
  36. #if (CONFIG_COMMANDS & CFG_CMD_PCI)
  37. extern int cmd_get_data_size(char* arg, int default_size);
  38. unsigned char ShortPCIListing = 1;
  39. /*
  40. * Follows routines for the output of infos about devices on PCI bus.
  41. */
  42. void pci_header_show(pci_dev_t dev);
  43. void pci_header_show_brief(pci_dev_t dev);
  44. /*
  45. * Subroutine: pciinfo
  46. *
  47. * Description: Show information about devices on PCI bus.
  48. * Depending on the define CFG_SHORT_PCI_LISTING
  49. * the output will be more or less exhaustive.
  50. *
  51. * Inputs: bus_no the number of the bus to be scanned.
  52. *
  53. * Return: None
  54. *
  55. */
  56. void pciinfo(int BusNum, int ShortPCIListing)
  57. {
  58. int Device;
  59. int Function;
  60. unsigned char HeaderType;
  61. unsigned short VendorID;
  62. pci_dev_t dev;
  63. printf("Scanning PCI devices on bus %d\n", BusNum);
  64. if (ShortPCIListing) {
  65. printf("BusDevFun VendorId DeviceId Device Class Sub-Class\n");
  66. printf("_____________________________________________________________\n");
  67. }
  68. for (Device = 0; Device < PCI_MAX_PCI_DEVICES; Device++) {
  69. HeaderType = 0;
  70. VendorID = 0;
  71. for (Function = 0; Function < PCI_MAX_PCI_FUNCTIONS; Function++) {
  72. /*
  73. * If this is not a multi-function device, we skip the rest.
  74. */
  75. if (Function && !(HeaderType & 0x80))
  76. break;
  77. dev = PCI_BDF(BusNum, Device, Function);
  78. pci_read_config_word(dev, PCI_VENDOR_ID, &VendorID);
  79. if ((VendorID == 0xFFFF) || (VendorID == 0x0000))
  80. continue;
  81. if (!Function) pci_read_config_byte(dev, PCI_HEADER_TYPE, &HeaderType);
  82. if (ShortPCIListing)
  83. {
  84. printf("%02x.%02x.%02x ", BusNum, Device, Function);
  85. pci_header_show_brief(dev);
  86. }
  87. else
  88. {
  89. printf("\nFound PCI device %02x.%02x.%02x:\n",
  90. BusNum, Device, Function);
  91. pci_header_show(dev);
  92. }
  93. }
  94. }
  95. }
  96. static char *pci_classes_str(u8 class)
  97. {
  98. switch (class) {
  99. case PCI_CLASS_NOT_DEFINED:
  100. return "Build before PCI Rev2.0";
  101. break;
  102. case PCI_BASE_CLASS_STORAGE:
  103. return "Mass storage controller";
  104. break;
  105. case PCI_BASE_CLASS_NETWORK:
  106. return "Network controller";
  107. break;
  108. case PCI_BASE_CLASS_DISPLAY:
  109. return "Display controller";
  110. break;
  111. case PCI_BASE_CLASS_MULTIMEDIA:
  112. return "Multimedia device";
  113. break;
  114. case PCI_BASE_CLASS_MEMORY:
  115. return "Memory controller";
  116. break;
  117. case PCI_BASE_CLASS_BRIDGE:
  118. return "Bridge device";
  119. break;
  120. case PCI_BASE_CLASS_COMMUNICATION:
  121. return "Simple comm. controller";
  122. break;
  123. case PCI_BASE_CLASS_SYSTEM:
  124. return "Base system peripheral";
  125. break;
  126. case PCI_BASE_CLASS_INPUT:
  127. return "Input device";
  128. break;
  129. case PCI_BASE_CLASS_DOCKING:
  130. return "Docking station";
  131. break;
  132. case PCI_BASE_CLASS_PROCESSOR:
  133. return "Processor";
  134. break;
  135. case PCI_BASE_CLASS_SERIAL:
  136. return "Serial bus controller";
  137. break;
  138. case PCI_BASE_CLASS_INTELLIGENT:
  139. return "Intelligent controller";
  140. break;
  141. case PCI_BASE_CLASS_SATELLITE:
  142. return "Satellite controller";
  143. break;
  144. case PCI_BASE_CLASS_CRYPT:
  145. return "Cryptographic device";
  146. break;
  147. case PCI_BASE_CLASS_SIGNAL_PROCESSING:
  148. return "DSP";
  149. break;
  150. case PCI_CLASS_OTHERS:
  151. return "Does not fit any class";
  152. break;
  153. default:
  154. return "???";
  155. break;
  156. };
  157. }
  158. /*
  159. * Subroutine: pci_header_show_brief
  160. *
  161. * Description: Reads and prints the header of the
  162. * specified PCI device in short form.
  163. *
  164. * Inputs: dev Bus+Device+Function number
  165. *
  166. * Return: None
  167. *
  168. */
  169. void pci_header_show_brief(pci_dev_t dev)
  170. {
  171. u16 vendor, device;
  172. u8 class, subclass;
  173. pci_read_config_word(dev, PCI_VENDOR_ID, &vendor);
  174. pci_read_config_word(dev, PCI_DEVICE_ID, &device);
  175. pci_read_config_byte(dev, PCI_CLASS_CODE, &class);
  176. pci_read_config_byte(dev, PCI_CLASS_SUB_CODE, &subclass);
  177. printf("0x%.4x 0x%.4x %-23s 0x%.2x\n",
  178. vendor, device,
  179. pci_classes_str(class), subclass);
  180. }
  181. /*
  182. * Subroutine: PCI_Header_Show
  183. *
  184. * Description: Reads the header of the specified PCI device.
  185. *
  186. * Inputs: BusDevFunc Bus+Device+Function number
  187. *
  188. * Return: None
  189. *
  190. */
  191. void pci_header_show(pci_dev_t dev)
  192. {
  193. u8 _byte, header_type;
  194. u16 _word;
  195. u32 _dword;
  196. #define PRINT(msg, type, reg) \
  197. pci_read_config_##type(dev, reg, &_##type); \
  198. printf(msg, _##type)
  199. #define PRINT2(msg, type, reg, func) \
  200. pci_read_config_##type(dev, reg, &_##type); \
  201. printf(msg, _##type, func(_##type))
  202. pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type);
  203. PRINT (" vendor ID = 0x%.4x\n", word, PCI_VENDOR_ID);
  204. PRINT (" device ID = 0x%.4x\n", word, PCI_DEVICE_ID);
  205. PRINT (" command register = 0x%.4x\n", word, PCI_COMMAND);
  206. PRINT (" status register = 0x%.4x\n", word, PCI_STATUS);
  207. PRINT (" revision ID = 0x%.2x\n", byte, PCI_REVISION_ID);
  208. PRINT2(" class code = 0x%.2x (%s)\n", byte, PCI_CLASS_CODE,
  209. pci_classes_str);
  210. PRINT (" sub class code = 0x%.2x\n", byte, PCI_CLASS_SUB_CODE);
  211. PRINT (" programming interface = 0x%.2x\n", byte, PCI_CLASS_PROG);
  212. PRINT (" cache line = 0x%.2x\n", byte, PCI_CACHE_LINE_SIZE);
  213. PRINT (" latency time = 0x%.2x\n", byte, PCI_LATENCY_TIMER);
  214. PRINT (" header type = 0x%.2x\n", byte, PCI_HEADER_TYPE);
  215. PRINT (" BIST = 0x%.2x\n", byte, PCI_BIST);
  216. PRINT (" base address 0 = 0x%.8x\n", dword, PCI_BASE_ADDRESS_0);
  217. switch (header_type & 0x03) {
  218. case PCI_HEADER_TYPE_NORMAL: /* "normal" PCI device */
  219. PRINT (" base address 1 = 0x%.8x\n", dword, PCI_BASE_ADDRESS_1);
  220. PRINT (" base address 2 = 0x%.8x\n", dword, PCI_BASE_ADDRESS_2);
  221. PRINT (" base address 3 = 0x%.8x\n", dword, PCI_BASE_ADDRESS_3);
  222. PRINT (" base address 4 = 0x%.8x\n", dword, PCI_BASE_ADDRESS_4);
  223. PRINT (" base address 5 = 0x%.8x\n", dword, PCI_BASE_ADDRESS_5);
  224. PRINT (" cardBus CIS pointer = 0x%.8x\n", dword, PCI_CARDBUS_CIS);
  225. PRINT (" sub system vendor ID = 0x%.4x\n", word, PCI_SUBSYSTEM_VENDOR_ID);
  226. PRINT (" sub system ID = 0x%.4x\n", word, PCI_SUBSYSTEM_ID);
  227. PRINT (" expansion ROM base address = 0x%.8x\n", dword, PCI_ROM_ADDRESS);
  228. PRINT (" interrupt line = 0x%.2x\n", byte, PCI_INTERRUPT_LINE);
  229. PRINT (" interrupt pin = 0x%.2x\n", byte, PCI_INTERRUPT_PIN);
  230. PRINT (" min Grant = 0x%.2x\n", byte, PCI_MIN_GNT);
  231. PRINT (" max Latency = 0x%.2x\n", byte, PCI_MAX_LAT);
  232. break;
  233. case PCI_HEADER_TYPE_BRIDGE: /* PCI-to-PCI bridge */
  234. PRINT (" base address 1 = 0x%.8x\n", dword, PCI_BASE_ADDRESS_1);
  235. PRINT (" primary bus number = 0x%.2x\n", byte, PCI_PRIMARY_BUS);
  236. PRINT (" secondary bus number = 0x%.2x\n", byte, PCI_SECONDARY_BUS);
  237. PRINT (" subordinate bus number = 0x%.2x\n", byte, PCI_SUBORDINATE_BUS);
  238. PRINT (" secondary latency timer = 0x%.2x\n", byte, PCI_SEC_LATENCY_TIMER);
  239. PRINT (" IO base = 0x%.2x\n", byte, PCI_IO_BASE);
  240. PRINT (" IO limit = 0x%.2x\n", byte, PCI_IO_LIMIT);
  241. PRINT (" secondary status = 0x%.4x\n", word, PCI_SEC_STATUS);
  242. PRINT (" memory base = 0x%.4x\n", word, PCI_MEMORY_BASE);
  243. PRINT (" memory limit = 0x%.4x\n", word, PCI_MEMORY_LIMIT);
  244. PRINT (" prefetch memory base = 0x%.4x\n", word, PCI_PREF_MEMORY_BASE);
  245. PRINT (" prefetch memory limit = 0x%.4x\n", word, PCI_PREF_MEMORY_LIMIT);
  246. PRINT (" prefetch memory base upper = 0x%.8x\n", dword, PCI_PREF_BASE_UPPER32);
  247. PRINT (" prefetch memory limit upper = 0x%.8x\n", dword, PCI_PREF_LIMIT_UPPER32);
  248. PRINT (" IO base upper 16 bits = 0x%.4x\n", word, PCI_IO_BASE_UPPER16);
  249. PRINT (" IO limit upper 16 bits = 0x%.4x\n", word, PCI_IO_LIMIT_UPPER16);
  250. PRINT (" expansion ROM base address = 0x%.8x\n", dword, PCI_ROM_ADDRESS1);
  251. PRINT (" interrupt line = 0x%.2x\n", byte, PCI_INTERRUPT_LINE);
  252. PRINT (" interrupt pin = 0x%.2x\n", byte, PCI_INTERRUPT_PIN);
  253. PRINT (" bridge control = 0x%.4x\n", word, PCI_BRIDGE_CONTROL);
  254. break;
  255. case PCI_HEADER_TYPE_CARDBUS: /* PCI-to-CardBus bridge */
  256. PRINT (" capabilities = 0x%.2x\n", byte, PCI_CB_CAPABILITY_LIST);
  257. PRINT (" secondary status = 0x%.4x\n", word, PCI_CB_SEC_STATUS);
  258. PRINT (" primary bus number = 0x%.2x\n", byte, PCI_CB_PRIMARY_BUS);
  259. PRINT (" CardBus number = 0x%.2x\n", byte, PCI_CB_CARD_BUS);
  260. PRINT (" subordinate bus number = 0x%.2x\n", byte, PCI_CB_SUBORDINATE_BUS);
  261. PRINT (" CardBus latency timer = 0x%.2x\n", byte, PCI_CB_LATENCY_TIMER);
  262. PRINT (" CardBus memory base 0 = 0x%.8x\n", dword, PCI_CB_MEMORY_BASE_0);
  263. PRINT (" CardBus memory limit 0 = 0x%.8x\n", dword, PCI_CB_MEMORY_LIMIT_0);
  264. PRINT (" CardBus memory base 1 = 0x%.8x\n", dword, PCI_CB_MEMORY_BASE_1);
  265. PRINT (" CardBus memory limit 1 = 0x%.8x\n", dword, PCI_CB_MEMORY_LIMIT_1);
  266. PRINT (" CardBus IO base 0 = 0x%.4x\n", word, PCI_CB_IO_BASE_0);
  267. PRINT (" CardBus IO base high 0 = 0x%.4x\n", word, PCI_CB_IO_BASE_0_HI);
  268. PRINT (" CardBus IO limit 0 = 0x%.4x\n", word, PCI_CB_IO_LIMIT_0);
  269. PRINT (" CardBus IO limit high 0 = 0x%.4x\n", word, PCI_CB_IO_LIMIT_0_HI);
  270. PRINT (" CardBus IO base 1 = 0x%.4x\n", word, PCI_CB_IO_BASE_1);
  271. PRINT (" CardBus IO base high 1 = 0x%.4x\n", word, PCI_CB_IO_BASE_1_HI);
  272. PRINT (" CardBus IO limit 1 = 0x%.4x\n", word, PCI_CB_IO_LIMIT_1);
  273. PRINT (" CardBus IO limit high 1 = 0x%.4x\n", word, PCI_CB_IO_LIMIT_1_HI);
  274. PRINT (" interrupt line = 0x%.2x\n", byte, PCI_INTERRUPT_LINE);
  275. PRINT (" interrupt pin = 0x%.2x\n", byte, PCI_INTERRUPT_PIN);
  276. PRINT (" bridge control = 0x%.4x\n", word, PCI_CB_BRIDGE_CONTROL);
  277. PRINT (" subvendor ID = 0x%.4x\n", word, PCI_CB_SUBSYSTEM_VENDOR_ID);
  278. PRINT (" subdevice ID = 0x%.4x\n", word, PCI_CB_SUBSYSTEM_ID);
  279. PRINT (" PC Card 16bit base address = 0x%.8x\n", dword, PCI_CB_LEGACY_MODE_BASE);
  280. break;
  281. default:
  282. printf("unknown header\n");
  283. break;
  284. }
  285. #undef PRINT
  286. #undef PRINT2
  287. }
  288. /* Convert the "bus.device.function" identifier into a number.
  289. */
  290. static pci_dev_t get_pci_dev(char* name)
  291. {
  292. char cnum[12];
  293. int len, i, iold, n;
  294. int bdfs[3] = {0,0,0};
  295. len = strlen(name);
  296. if (len > 8)
  297. return -1;
  298. for (i = 0, iold = 0, n = 0; i < len; i++) {
  299. if (name[i] == '.') {
  300. memcpy(cnum, &name[iold], i - iold);
  301. cnum[i - iold] = '\0';
  302. bdfs[n++] = simple_strtoul(cnum, NULL, 16);
  303. iold = i + 1;
  304. }
  305. }
  306. strcpy(cnum, &name[iold]);
  307. if (n == 0)
  308. n = 1;
  309. bdfs[n] = simple_strtoul(cnum, NULL, 16);
  310. return PCI_BDF(bdfs[0], bdfs[1], bdfs[2]);
  311. }
  312. static int pci_cfg_display(pci_dev_t bdf, ulong addr, ulong size, ulong length)
  313. {
  314. #define DISP_LINE_LEN 16
  315. ulong i, nbytes, linebytes;
  316. int rc = 0;
  317. if (length == 0)
  318. length = 0x40 / size; /* Standard PCI configuration space */
  319. /* Print the lines.
  320. * once, and all accesses are with the specified bus width.
  321. */
  322. nbytes = length * size;
  323. do {
  324. uint val4;
  325. ushort val2;
  326. u_char val1;
  327. printf("%08lx:", addr);
  328. linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
  329. for (i=0; i<linebytes; i+= size) {
  330. if (size == 4) {
  331. pci_read_config_dword(bdf, addr, &val4);
  332. printf(" %08x", val4);
  333. } else if (size == 2) {
  334. pci_read_config_word(bdf, addr, &val2);
  335. printf(" %04x", val2);
  336. } else {
  337. pci_read_config_byte(bdf, addr, &val1);
  338. printf(" %02x", val1);
  339. }
  340. addr += size;
  341. }
  342. printf("\n");
  343. nbytes -= linebytes;
  344. if (ctrlc()) {
  345. rc = 1;
  346. break;
  347. }
  348. } while (nbytes > 0);
  349. return (rc);
  350. }
  351. static int pci_cfg_write (pci_dev_t bdf, ulong addr, ulong size, ulong value)
  352. {
  353. if (size == 4) {
  354. pci_write_config_dword(bdf, addr, value);
  355. }
  356. else if (size == 2) {
  357. ushort val = value & 0xffff;
  358. pci_write_config_word(bdf, addr, val);
  359. }
  360. else {
  361. u_char val = value & 0xff;
  362. pci_write_config_byte(bdf, addr, val);
  363. }
  364. return 0;
  365. }
  366. static int
  367. pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag)
  368. {
  369. ulong i;
  370. int nbytes;
  371. extern char console_buffer[];
  372. uint val4;
  373. ushort val2;
  374. u_char val1;
  375. /* Print the address, followed by value. Then accept input for
  376. * the next value. A non-converted value exits.
  377. */
  378. do {
  379. printf("%08lx:", addr);
  380. if (size == 4) {
  381. pci_read_config_dword(bdf, addr, &val4);
  382. printf(" %08x", val4);
  383. }
  384. else if (size == 2) {
  385. pci_read_config_word(bdf, addr, &val2);
  386. printf(" %04x", val2);
  387. }
  388. else {
  389. pci_read_config_byte(bdf, addr, &val1);
  390. printf(" %02x", val1);
  391. }
  392. nbytes = readline (" ? ");
  393. if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
  394. /* <CR> pressed as only input, don't modify current
  395. * location and move to next. "-" pressed will go back.
  396. */
  397. if (incrflag)
  398. addr += nbytes ? -size : size;
  399. nbytes = 1;
  400. #ifdef CONFIG_BOOT_RETRY_TIME
  401. reset_cmd_timeout(); /* good enough to not time out */
  402. #endif
  403. }
  404. #ifdef CONFIG_BOOT_RETRY_TIME
  405. else if (nbytes == -2) {
  406. break; /* timed out, exit the command */
  407. }
  408. #endif
  409. else {
  410. char *endp;
  411. i = simple_strtoul(console_buffer, &endp, 16);
  412. nbytes = endp - console_buffer;
  413. if (nbytes) {
  414. #ifdef CONFIG_BOOT_RETRY_TIME
  415. /* good enough to not time out
  416. */
  417. reset_cmd_timeout();
  418. #endif
  419. pci_cfg_write (bdf, addr, size, i);
  420. if (incrflag)
  421. addr += size;
  422. }
  423. }
  424. } while (nbytes);
  425. return 0;
  426. }
  427. /* PCI Configuration Space access commands
  428. *
  429. * Syntax:
  430. * pci display[.b, .w, .l] bus.device.function} [addr] [len]
  431. * pci next[.b, .w, .l] bus.device.function [addr]
  432. * pci modify[.b, .w, .l] bus.device.function [addr]
  433. * pci write[.b, .w, .l] bus.device.function addr value
  434. */
  435. int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  436. {
  437. ulong addr = 0, value = 0, size = 0;
  438. pci_dev_t bdf = 0;
  439. char cmd = 's';
  440. if (argc > 1)
  441. cmd = argv[1][0];
  442. switch (cmd) {
  443. case 'd': /* display */
  444. case 'n': /* next */
  445. case 'm': /* modify */
  446. case 'w': /* write */
  447. /* Check for a size specification. */
  448. size = cmd_get_data_size(argv[1], 4);
  449. if (argc > 3)
  450. addr = simple_strtoul(argv[3], NULL, 16);
  451. if (argc > 4)
  452. value = simple_strtoul(argv[4], NULL, 16);
  453. case 'h': /* header */
  454. if (argc < 3)
  455. goto usage;
  456. if ((bdf = get_pci_dev(argv[2])) == -1)
  457. return 1;
  458. break;
  459. default: /* scan bus */
  460. value = 1; /* short listing */
  461. bdf = 0; /* bus number */
  462. if (argc > 1) {
  463. if (argv[argc-1][0] == 'l') {
  464. value = 0;
  465. argc--;
  466. }
  467. if (argc > 1)
  468. bdf = simple_strtoul(argv[1], NULL, 16);
  469. }
  470. pciinfo(bdf, value);
  471. return 0;
  472. }
  473. switch (argv[1][0]) {
  474. case 'h': /* header */
  475. pci_header_show(bdf);
  476. return 0;
  477. case 'd': /* display */
  478. return pci_cfg_display(bdf, addr, size, value);
  479. case 'n': /* next */
  480. if (argc < 4)
  481. goto usage;
  482. return pci_cfg_modify(bdf, addr, size, value, 0);
  483. case 'm': /* modify */
  484. if (argc < 4)
  485. goto usage;
  486. return pci_cfg_modify(bdf, addr, size, value, 1);
  487. case 'w': /* write */
  488. if (argc < 5)
  489. goto usage;
  490. return pci_cfg_write(bdf, addr, size, value);
  491. }
  492. return 1;
  493. usage:
  494. printf ("Usage:\n%s\n", cmdtp->usage);
  495. return 1;
  496. }
  497. /***************************************************/
  498. U_BOOT_CMD(
  499. pci, 5, 1, do_pci,
  500. "pci - list and access PCI Configuration Space\n",
  501. "[bus] [long]\n"
  502. " - short or long list of PCI devices on bus 'bus'\n"
  503. "pci header b.d.f\n"
  504. " - show header of PCI device 'bus.device.function'\n"
  505. "pci display[.b, .w, .l] b.d.f [address] [# of objects]\n"
  506. " - display PCI configuration space (CFG)\n"
  507. "pci next[.b, .w, .l] b.d.f address\n"
  508. " - modify, read and keep CFG address\n"
  509. "pci modify[.b, .w, .l] b.d.f address\n"
  510. " - modify, auto increment CFG address\n"
  511. "pci write[.b, .w, .l] b.d.f address value\n"
  512. " - write to CFG address\n"
  513. );
  514. #endif /* (CONFIG_COMMANDS & CFG_CMD_PCI) */
  515. #endif /* CONFIG_PCI */