blob: 303f3b44c714fd2974a69d79ea61c1dd451e994f [file] [log] [blame]
David Hendricks82fd8ae2010-08-04 14:34:54 -07001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2000 Silicon Integrated System Corporation
5 * Copyright (C) 2000 Ronald G. Minnich <rminnich@gmail.com>
6 * Copyright (C) 2005-2009 coresystems GmbH
7 * Copyright (C) 2006-2009 Carl-Daniel Hailfinger
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef __PROGRAMMER_H__
25#define __PROGRAMMER_H__ 1
26
27enum programmer {
28#if CONFIG_INTERNAL == 1
29 PROGRAMMER_INTERNAL,
30#endif
31#if CONFIG_DUMMY == 1
32 PROGRAMMER_DUMMY,
33#endif
34#if CONFIG_NIC3COM == 1
35 PROGRAMMER_NIC3COM,
36#endif
37#if CONFIG_NICREALTEK == 1
38 PROGRAMMER_NICREALTEK,
39 PROGRAMMER_NICREALTEK2,
David Hendricksc801adb2010-12-09 16:58:56 -080040#endif
David Hendricks82fd8ae2010-08-04 14:34:54 -070041#if CONFIG_NICNATSEMI == 1
42 PROGRAMMER_NICNATSEMI,
David Hendricksc801adb2010-12-09 16:58:56 -080043#endif
David Hendricks82fd8ae2010-08-04 14:34:54 -070044#if CONFIG_GFXNVIDIA == 1
45 PROGRAMMER_GFXNVIDIA,
46#endif
47#if CONFIG_DRKAISER == 1
48 PROGRAMMER_DRKAISER,
49#endif
50#if CONFIG_SATASII == 1
51 PROGRAMMER_SATASII,
52#endif
53#if CONFIG_ATAHPT == 1
54 PROGRAMMER_ATAHPT,
55#endif
56#if CONFIG_INTERNAL == 1
57#if defined(__i386__) || defined(__x86_64__)
58 PROGRAMMER_IT87SPI,
59#endif
60#endif
61#if CONFIG_FT2232_SPI == 1
62 PROGRAMMER_FT2232_SPI,
63#endif
64#if CONFIG_SERPROG == 1
65 PROGRAMMER_SERPROG,
66#endif
67#if CONFIG_BUSPIRATE_SPI == 1
68 PROGRAMMER_BUSPIRATE_SPI,
69#endif
70#if CONFIG_DEDIPROG == 1
71 PROGRAMMER_DEDIPROG,
72#endif
73#if CONFIG_RAYER_SPI == 1
74 PROGRAMMER_RAYER_SPI,
75#endif
David Hendricksc801adb2010-12-09 16:58:56 -080076#if CONFIG_NICINTEL_SPI == 1
77 PROGRAMMER_NICINTEL_SPI,
78#endif
David Hendricks82fd8ae2010-08-04 14:34:54 -070079 PROGRAMMER_INVALID /* This must always be the last entry. */
80};
81
82extern enum programmer programmer;
83
84struct programmer_entry {
85 const char *vendor;
86 const char *name;
87
88 int (*init) (void);
89 int (*shutdown) (void);
90
91 void * (*map_flash_region) (const char *descr, unsigned long phys_addr,
92 size_t len);
93 void (*unmap_flash_region) (void *virt_addr, size_t len);
94
95 void (*chip_writeb) (uint8_t val, chipaddr addr);
96 void (*chip_writew) (uint16_t val, chipaddr addr);
97 void (*chip_writel) (uint32_t val, chipaddr addr);
98 void (*chip_writen) (uint8_t *buf, chipaddr addr, size_t len);
99 uint8_t (*chip_readb) (const chipaddr addr);
100 uint16_t (*chip_readw) (const chipaddr addr);
101 uint32_t (*chip_readl) (const chipaddr addr);
102 void (*chip_readn) (uint8_t *buf, const chipaddr addr, size_t len);
103 void (*delay) (int usecs);
104};
105
106extern const struct programmer_entry programmer_table[];
107
108int programmer_init(char *param);
109int programmer_shutdown(void);
110
111enum bitbang_spi_master_type {
112 BITBANG_SPI_INVALID = 0, /* This must always be the first entry. */
113#if CONFIG_RAYER_SPI == 1
114 BITBANG_SPI_MASTER_RAYER,
115#endif
David Hendricksc801adb2010-12-09 16:58:56 -0800116#if CONFIG_NICINTEL_SPI == 1
117 BITBANG_SPI_MASTER_NICINTEL,
118#endif
David Hendricks82fd8ae2010-08-04 14:34:54 -0700119#if CONFIG_INTERNAL == 1
120#if defined(__i386__) || defined(__x86_64__)
121 BITBANG_SPI_MASTER_MCP,
122#endif
123#endif
124};
125
126struct bitbang_spi_master {
127 enum bitbang_spi_master_type type;
128
129 /* Note that CS# is active low, so val=0 means the chip is active. */
130 void (*set_cs) (int val);
131 void (*set_sck) (int val);
132 void (*set_mosi) (int val);
133 int (*get_miso) (void);
David Hendricksc801adb2010-12-09 16:58:56 -0800134 void (*request_bus) (void);
135 void (*release_bus) (void);
David Hendricks82fd8ae2010-08-04 14:34:54 -0700136};
137
138#if CONFIG_INTERNAL == 1
139struct penable {
140 uint16_t vendor_id;
141 uint16_t device_id;
142 int status;
143 const char *vendor_name;
144 const char *device_name;
145 int (*doit) (struct pci_dev *dev, const char *name);
146};
147
148extern const struct penable chipset_enables[];
149
150struct board_pciid_enable {
151 /* Any device, but make it sensible, like the ISA bridge. */
152 uint16_t first_vendor;
153 uint16_t first_device;
154 uint16_t first_card_vendor;
155 uint16_t first_card_device;
156
157 /* Any device, but make it sensible, like
158 * the host bridge. May be NULL.
159 */
160 uint16_t second_vendor;
161 uint16_t second_device;
162 uint16_t second_card_vendor;
163 uint16_t second_card_device;
164
165 /* Pattern to match DMI entries */
166 const char *dmi_pattern;
167
168 /* The vendor / part name from the coreboot table. */
169 const char *lb_vendor;
170 const char *lb_part;
171
172 const char *vendor_name;
173 const char *board_name;
174
175 int max_rom_decode_parallel;
176 int status;
177 int (*enable) (void);
178};
179
180extern const struct board_pciid_enable board_pciid_enables[];
181
182struct board_info {
183 const char *vendor;
184 const char *name;
185 const int working;
186#ifdef CONFIG_PRINT_WIKI
187 const char *url;
188 const char *note;
189#endif
190};
191
192extern const struct board_info boards_known[];
193extern const struct board_info laptops_known[];
194#endif
195
196/* udelay.c */
197void myusec_delay(int usecs);
198void myusec_calibrate_delay(void);
199void internal_delay(int usecs);
200
201#if NEED_PCI == 1
202/* pcidev.c */
203extern uint32_t io_base_addr;
204extern struct pci_access *pacc;
205extern struct pci_dev *pcidev_dev;
206struct pcidev_status {
207 uint16_t vendor_id;
208 uint16_t device_id;
209 int status;
210 const char *vendor_name;
211 const char *device_name;
212};
213uint32_t pcidev_validate(struct pci_dev *dev, uint32_t bar, const struct pcidev_status *devs);
214uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar, const struct pcidev_status *devs);
David Hendricksc801adb2010-12-09 16:58:56 -0800215/* rpci_write_* are reversible writes. The original PCI config space register
216 * contents will be restored on shutdown.
217 */
218int rpci_write_byte(struct pci_dev *dev, int reg, u8 data);
219int rpci_write_word(struct pci_dev *dev, int reg, u16 data);
220int rpci_write_long(struct pci_dev *dev, int reg, u32 data);
David Hendricks82fd8ae2010-08-04 14:34:54 -0700221#endif
222
223/* print.c */
David Hendricksc801adb2010-12-09 16:58:56 -0800224#if CONFIG_NIC3COM+CONFIG_NICREALTEK+CONFIG_NICNATSEMI+CONFIG_GFXNVIDIA+CONFIG_DRKAISER+CONFIG_SATASII+CONFIG_ATAHPT+CONFIG_NICINTEL_SPI >= 1
David Hendricks82fd8ae2010-08-04 14:34:54 -0700225void print_supported_pcidevs(const struct pcidev_status *devs);
226#endif
227
228/* board_enable.c */
229void w836xx_ext_enter(uint16_t port);
230void w836xx_ext_leave(uint16_t port);
231int it8705f_write_enable(uint8_t port);
232uint8_t sio_read(uint16_t port, uint8_t reg);
233void sio_write(uint16_t port, uint8_t reg, uint8_t data);
234void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask);
235int board_flash_enable(const char *vendor, const char *part);
236
237/* chipset_enable.c */
238int chipset_flash_enable(void);
239
240/* processor_enable.c */
241int processor_flash_enable(void);
242
243/* physmap.c */
244void *physmap(const char *descr, unsigned long phys_addr, size_t len);
245void *physmap_try_ro(const char *descr, unsigned long phys_addr, size_t len);
246void physunmap(void *virt_addr, size_t len);
247int setup_cpu_msr(int cpu);
248void cleanup_cpu_msr(void);
249
250/* cbtable.c */
251void lb_vendor_dev_from_string(char *boardstring);
252int coreboot_init(void);
253extern char *lb_part, *lb_vendor;
254extern int partvendor_from_cbtable;
255
256/* dmi.c */
257extern int has_dmi_support;
258void dmi_init(void);
259int dmi_match(const char *pattern);
260
261/* internal.c */
262#if NEED_PCI == 1
263struct superio {
264 uint16_t vendor;
265 uint16_t port;
266 uint16_t model;
267};
268extern struct superio superio;
269#define SUPERIO_VENDOR_NONE 0x0
270#define SUPERIO_VENDOR_ITE 0x1
271struct pci_dev *pci_dev_find_filter(struct pci_filter filter);
272struct pci_dev *pci_dev_find_vendorclass(uint16_t vendor, uint16_t class);
273struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
274struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
275 uint16_t card_vendor, uint16_t card_device);
276#endif
277void get_io_perms(void);
278void release_io_perms(void);
279#if CONFIG_INTERNAL == 1
280extern int is_laptop;
281extern int force_boardenable;
282extern int force_boardmismatch;
283void probe_superio(void);
284int internal_init(void);
285int internal_shutdown(void);
286void internal_chip_writeb(uint8_t val, chipaddr addr);
287void internal_chip_writew(uint16_t val, chipaddr addr);
288void internal_chip_writel(uint32_t val, chipaddr addr);
289uint8_t internal_chip_readb(const chipaddr addr);
290uint16_t internal_chip_readw(const chipaddr addr);
291uint32_t internal_chip_readl(const chipaddr addr);
292void internal_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
293#endif
294
295/* hwaccess.c */
296void mmio_writeb(uint8_t val, void *addr);
297void mmio_writew(uint16_t val, void *addr);
298void mmio_writel(uint32_t val, void *addr);
299uint8_t mmio_readb(void *addr);
300uint16_t mmio_readw(void *addr);
301uint32_t mmio_readl(void *addr);
302void mmio_le_writeb(uint8_t val, void *addr);
303void mmio_le_writew(uint16_t val, void *addr);
304void mmio_le_writel(uint32_t val, void *addr);
305uint8_t mmio_le_readb(void *addr);
306uint16_t mmio_le_readw(void *addr);
307uint32_t mmio_le_readl(void *addr);
308#define pci_mmio_writeb mmio_le_writeb
309#define pci_mmio_writew mmio_le_writew
310#define pci_mmio_writel mmio_le_writel
311#define pci_mmio_readb mmio_le_readb
312#define pci_mmio_readw mmio_le_readw
313#define pci_mmio_readl mmio_le_readl
314
315/* programmer.c */
316int noop_shutdown(void);
317void *fallback_map(const char *descr, unsigned long phys_addr, size_t len);
318void fallback_unmap(void *virt_addr, size_t len);
319uint8_t noop_chip_readb(const chipaddr addr);
320void noop_chip_writeb(uint8_t val, chipaddr addr);
321void fallback_chip_writew(uint16_t val, chipaddr addr);
322void fallback_chip_writel(uint32_t val, chipaddr addr);
323void fallback_chip_writen(uint8_t *buf, chipaddr addr, size_t len);
324uint16_t fallback_chip_readw(const chipaddr addr);
325uint32_t fallback_chip_readl(const chipaddr addr);
326void fallback_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
327
328/* dummyflasher.c */
329#if CONFIG_DUMMY == 1
330int dummy_init(void);
331int dummy_shutdown(void);
332void *dummy_map(const char *descr, unsigned long phys_addr, size_t len);
333void dummy_unmap(void *virt_addr, size_t len);
334void dummy_chip_writeb(uint8_t val, chipaddr addr);
335void dummy_chip_writew(uint16_t val, chipaddr addr);
336void dummy_chip_writel(uint32_t val, chipaddr addr);
337void dummy_chip_writen(uint8_t *buf, chipaddr addr, size_t len);
338uint8_t dummy_chip_readb(const chipaddr addr);
339uint16_t dummy_chip_readw(const chipaddr addr);
340uint32_t dummy_chip_readl(const chipaddr addr);
341void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
342int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt,
343 const unsigned char *writearr, unsigned char *readarr);
344int dummy_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
345int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
346#endif
347
348/* nic3com.c */
349#if CONFIG_NIC3COM == 1
350int nic3com_init(void);
351int nic3com_shutdown(void);
352void nic3com_chip_writeb(uint8_t val, chipaddr addr);
353uint8_t nic3com_chip_readb(const chipaddr addr);
354extern const struct pcidev_status nics_3com[];
355#endif
356
357/* gfxnvidia.c */
358#if CONFIG_GFXNVIDIA == 1
359int gfxnvidia_init(void);
360int gfxnvidia_shutdown(void);
361void gfxnvidia_chip_writeb(uint8_t val, chipaddr addr);
362uint8_t gfxnvidia_chip_readb(const chipaddr addr);
363extern const struct pcidev_status gfx_nvidia[];
364#endif
365
366/* drkaiser.c */
367#if CONFIG_DRKAISER == 1
368int drkaiser_init(void);
369int drkaiser_shutdown(void);
370void drkaiser_chip_writeb(uint8_t val, chipaddr addr);
371uint8_t drkaiser_chip_readb(const chipaddr addr);
372extern const struct pcidev_status drkaiser_pcidev[];
373#endif
374
375/* nicrealtek.c */
376#if CONFIG_NICREALTEK == 1
377int nicrealtek_init(void);
378int nicsmc1211_init(void);
379int nicrealtek_shutdown(void);
380void nicrealtek_chip_writeb(uint8_t val, chipaddr addr);
381uint8_t nicrealtek_chip_readb(const chipaddr addr);
382extern const struct pcidev_status nics_realtek[];
383extern const struct pcidev_status nics_realteksmc1211[];
384#endif
385
386/* nicnatsemi.c */
387#if CONFIG_NICNATSEMI == 1
388int nicnatsemi_init(void);
389int nicnatsemi_shutdown(void);
390void nicnatsemi_chip_writeb(uint8_t val, chipaddr addr);
391uint8_t nicnatsemi_chip_readb(const chipaddr addr);
392extern const struct pcidev_status nics_natsemi[];
393#endif
394
David Hendricksc801adb2010-12-09 16:58:56 -0800395/* nicintel_spi.c */
396#if CONFIG_NICINTEL_SPI == 1
397int nicintel_spi_init(void);
398int nicintel_spi_shutdown(void);
399int nicintel_spi_send_command(unsigned int writecnt, unsigned int readcnt,
400 const unsigned char *writearr, unsigned char *readarr);
401void nicintel_spi_chip_writeb(uint8_t val, chipaddr addr);
402extern const struct pcidev_status nics_intel_spi[];
403#endif
404
David Hendricks82fd8ae2010-08-04 14:34:54 -0700405/* satasii.c */
406#if CONFIG_SATASII == 1
407int satasii_init(void);
408int satasii_shutdown(void);
409void satasii_chip_writeb(uint8_t val, chipaddr addr);
410uint8_t satasii_chip_readb(const chipaddr addr);
411extern const struct pcidev_status satas_sii[];
412#endif
413
414/* atahpt.c */
415#if CONFIG_ATAHPT == 1
416int atahpt_init(void);
417int atahpt_shutdown(void);
418void atahpt_chip_writeb(uint8_t val, chipaddr addr);
419uint8_t atahpt_chip_readb(const chipaddr addr);
420extern const struct pcidev_status ata_hpt[];
421#endif
422
423/* ft2232_spi.c */
424#if CONFIG_FT2232_SPI == 1
425struct usbdev_status {
David Hendricksc801adb2010-12-09 16:58:56 -0800426 uint16_t vendor_id;
427 uint16_t device_id;
428 int status;
429 const char *vendor_name;
430 const char *device_name;
David Hendricks82fd8ae2010-08-04 14:34:54 -0700431};
432int ft2232_spi_init(void);
433int ft2232_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
434int ft2232_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
435int ft2232_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
436extern const struct usbdev_status devs_ft2232spi[];
437void print_supported_usbdevs(const struct usbdev_status *devs);
438#endif
439
440/* rayer_spi.c */
441#if CONFIG_RAYER_SPI == 1
442int rayer_spi_init(void);
443#endif
444
445/* mcp6x_spi.c */
446#if CONFIG_INTERNAL == 1
447#if defined(__i386__) || defined(__x86_64__)
448int mcp6x_spi_init(int want_spi);
449#endif
450#endif
451
452/* bitbang_spi.c */
453int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod);
David Hendricksc801adb2010-12-09 16:58:56 -0800454int bitbang_spi_shutdown(const struct bitbang_spi_master *master);
David Hendricks82fd8ae2010-08-04 14:34:54 -0700455int bitbang_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
456int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
457int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
458
459/* buspirate_spi.c */
460struct buspirate_spispeeds {
461 const char *name;
462 const int speed;
463};
464int buspirate_spi_init(void);
465int buspirate_spi_shutdown(void);
466int buspirate_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
467int buspirate_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
468int buspirate_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
469
470/* dediprog.c */
471int dediprog_init(void);
472int dediprog_shutdown(void);
473int dediprog_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
474int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
David Hendricksc801adb2010-12-09 16:58:56 -0800475int dediprog_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
David Hendricks82fd8ae2010-08-04 14:34:54 -0700476
477/* flashrom.c */
478struct decode_sizes {
479 uint32_t parallel;
480 uint32_t lpc;
481 uint32_t fwh;
482 uint32_t spi;
483};
484extern struct decode_sizes max_rom_decode;
485extern int programmer_may_write;
486extern unsigned long flashbase;
487void check_chip_supported(struct flashchip *flash);
488int check_max_decode(enum chipbustype buses, uint32_t size);
489char *extract_programmer_param(char *param_name);
490
491/* layout.c */
492int show_id(uint8_t *bios, int size, int force);
493
494/* spi.c */
495enum spi_controller {
496 SPI_CONTROLLER_NONE,
497#if CONFIG_INTERNAL == 1
498#if defined(__i386__) || defined(__x86_64__)
499 SPI_CONTROLLER_ICH7,
500 SPI_CONTROLLER_ICH9,
David Hendricks52c18be2010-08-16 18:13:59 -0700501 SPI_CONTROLLER_IT85XX,
David Hendricks82fd8ae2010-08-04 14:34:54 -0700502 SPI_CONTROLLER_IT87XX,
503 SPI_CONTROLLER_SB600,
504 SPI_CONTROLLER_VIA,
505 SPI_CONTROLLER_WBSIO,
506 SPI_CONTROLLER_MCP6X_BITBANG,
David Hendricksc801adb2010-12-09 16:58:56 -0800507 SPI_CONTROLLER_WPCE775X,
David Hendricks82fd8ae2010-08-04 14:34:54 -0700508#endif
509#endif
510#if CONFIG_FT2232_SPI == 1
511 SPI_CONTROLLER_FT2232,
512#endif
513#if CONFIG_DUMMY == 1
514 SPI_CONTROLLER_DUMMY,
515#endif
516#if CONFIG_BUSPIRATE_SPI == 1
517 SPI_CONTROLLER_BUSPIRATE,
518#endif
519#if CONFIG_DEDIPROG == 1
520 SPI_CONTROLLER_DEDIPROG,
521#endif
522#if CONFIG_RAYER_SPI == 1
523 SPI_CONTROLLER_RAYER,
524#endif
David Hendricksc801adb2010-12-09 16:58:56 -0800525#if CONFIG_NICINTEL_SPI == 1
526 SPI_CONTROLLER_NICINTEL,
527#endif
David Hendricks82fd8ae2010-08-04 14:34:54 -0700528 SPI_CONTROLLER_INVALID /* This must always be the last entry. */
529};
530extern const int spi_programmer_count;
531struct spi_programmer {
532 int (*command)(unsigned int writecnt, unsigned int readcnt,
533 const unsigned char *writearr, unsigned char *readarr);
534 int (*multicommand)(struct spi_command *cmds);
535
536 /* Optimized functions for this programmer */
537 int (*read)(struct flashchip *flash, uint8_t *buf, int start, int len);
538 int (*write_256)(struct flashchip *flash, uint8_t *buf, int start, int len);
539};
540
541extern enum spi_controller spi_controller;
542extern const struct spi_programmer spi_programmer[];
543int default_spi_send_command(unsigned int writecnt, unsigned int readcnt,
544 const unsigned char *writearr, unsigned char *readarr);
545int default_spi_send_multicommand(struct spi_command *cmds);
546
547/* ichspi.c */
548#if CONFIG_INTERNAL == 1
549extern uint32_t ichspi_bbar;
550int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb,
551 int ich_generation);
552int via_init_spi(struct pci_dev *dev);
553int ich_spi_send_command(unsigned int writecnt, unsigned int readcnt,
554 const unsigned char *writearr, unsigned char *readarr);
555int ich_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
556int ich_spi_write_256(struct flashchip *flash, uint8_t * buf, int start, int len);
557int ich_spi_send_multicommand(struct spi_command *cmds);
558#endif
559
David Hendricks52c18be2010-08-16 18:13:59 -0700560/* it85spi.c */
561struct superio probe_superio_ite85xx(void);
562int it85xx_spi_init(void);
563int it85xx_shutdown(void);
564int it85xx_probe_spi_flash(const char *name);
565int it85xx_spi_send_command(unsigned int writecnt, unsigned int readcnt,
566 const unsigned char *writearr, unsigned char *readarr);
567
David Hendricks82fd8ae2010-08-04 14:34:54 -0700568/* it87spi.c */
569void enter_conf_mode_ite(uint16_t port);
570void exit_conf_mode_ite(uint16_t port);
571struct superio probe_superio_ite(void);
572int init_superio_ite(void);
573int it87spi_init(void);
574int it8716f_spi_send_command(unsigned int writecnt, unsigned int readcnt,
575 const unsigned char *writearr, unsigned char *readarr);
576int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len);
577int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
578
579/* sb600spi.c */
580#if CONFIG_INTERNAL == 1
581int sb600_probe_spi(struct pci_dev *dev);
582int sb600_spi_send_command(unsigned int writecnt, unsigned int readcnt,
583 const unsigned char *writearr, unsigned char *readarr);
584int sb600_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
585int sb600_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
586#endif
587
588/* wbsio_spi.c */
589#if CONFIG_INTERNAL == 1
590int wbsio_check_for_spi(void);
591int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt,
592 const unsigned char *writearr, unsigned char *readarr);
593int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
594#endif
595
596/* serprog.c */
597int serprog_init(void);
598int serprog_shutdown(void);
599void serprog_chip_writeb(uint8_t val, chipaddr addr);
600uint8_t serprog_chip_readb(const chipaddr addr);
601void serprog_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
602void serprog_delay(int delay);
603
604/* serial.c */
605#if _WIN32
606typedef HANDLE fdtype;
607#else
608typedef int fdtype;
609#endif
610
David Hendricksc801adb2010-12-09 16:58:56 -0800611/* wpce775x.c */
612struct superio probe_superio_wpce775x(void);
613int wpce775x_shutdown(void);
614int wpce775x_probe_spi_flash(const char *name);
615int wpce775x_spi_read(struct flashchip *flash,
616 uint8_t * buf, int start, int len);
617int wpce775x_spi_write_256(struct flashchip *flash,
618 uint8_t *buf, int start, int len);
619int wpce775x_spi_send_command(unsigned int writecnt, unsigned int readcnt,
620 const unsigned char *writearr,
621 unsigned char *readarr);
622
David Hendricks82fd8ae2010-08-04 14:34:54 -0700623void sp_flush_incoming(void);
624fdtype sp_openserport(char *dev, unsigned int baud);
625void __attribute__((noreturn)) sp_die(char *msg);
626extern fdtype sp_fd;
627int serialport_shutdown(void);
628int serialport_write(unsigned char *buf, unsigned int writecnt);
629int serialport_read(unsigned char *buf, unsigned int readcnt);
630
631#endif /* !__PROGRAMMER_H__ */